Commit graph

419 commits

Author SHA1 Message Date
Cyrill Gorcunov
c75c92db1d pie: Move send_fds/recv_fds helpers into separate pie/util-fd.c
We will need to reuse this code in criu library, where libc calls
are present thus we will be compiling it in shared mode.

Because internal syscalls library won't be needed we wrap them
with __sys macro which would hide the details of invocation depending
on CR_NOGLIBC preprocessor variable passed from command line.

Original-patch-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-29 14:48:10 +04:00
Pavel Emelyanov
84737e2796 build: Generate most of the pb-desc automatically
These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 21:47:31 +04:00
Pavel Emelyanov
72ec39f10c util: Rename pie's util-net.c into util.c
Will put more things there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-29 12:43:30 +04:00
Ruslan Kupreev Руслан
27f9b0335d v2 criu: Initial skeleton for criu library
Add target lib to Makefile for criu library.
Created directory lib and add there Makefile and criu.c - skelettons for criu library.

Signed-off-by: Ruslan Kupreev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-18 21:47:11 +04:00
Alexander Kartashov
3a94986310 cr: determine the version of the ARM architecture of the target machine
This patch modifies the build system to analyze the version
of the target ARM architecture and setup the compiler flags
accordingly. This makes it possible to support the ARM
architectures prior to ARMv7.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-10 15:56:57 +04:00
Pavel Emelyanov
1845284009 criu: Version 0.6 release
This release goes on increasing the bugfix-to-features
ratio. Though we still have a lot of new stuff in the tool
the amount of bugs we've caught and fixed increases.

As a very notable feature it's worth mentioning that we
have prepared crtools to be ready to restore images,
converted from those generated by rh6-openvz kernel, i.e.
we are very close to have live-migration from rh6 to
whatever-it-will-be as the next openvz kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-01 21:31:05 +04:00
Chanho Park
d3b122fbc0 Makefile: Add LDFLAGS directive
This patch adds LDFLAGS directive to build with -static.
You can build in static mode like below:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi LDFLAGS=-static

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Acked-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-11 11:02:42 +04:00
Cyrill Gorcunov
d73c4c1ff4 make: Allow to use CROSS_COMPILE prefix
Note it can be overriden from command line.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Chanho Park <chanho61.park@samsung.com>
CC: Myungjoo Ham <myungjoo.ham@samsung.com>
Acked-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-31 13:45:30 +04:00
Cyrill Gorcunov
61cc86ddd2 vdso: Introduce vdso pie-engine
It's quite minimal at moment and provides only two helpers

 - vdso_redirect_calls, to patch vdso area redirectling
   calls to some new place.

 - vdso_fill_symtable, to parse vma area as vdso library
   and fill symbols table with offsets and names.

Because these routines will be needed in both regular criu
code and restorer code -- we compile it in pie format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 13:27:13 +04:00
Cyrill Gorcunov
9208108c9f make: Define program object deps as separate variable
Will need to extend it to support vdso-pie code which
used in both -- pie code and plain executable code.

I know it's ugly and I must invent some more elegant
way, but need some solution at moment to be able to
compile existing code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-24 13:24:29 +04:00
Cyrill Gorcunov
66cc9b6657 make: Introduce compile time include/config.h generation
It's being reported that some systems (as Ubuntu 13.04) already
have struct tcp_repair_opt definition in their system headers.

| sk-tcp.c:25:8: error: redefinition of struct tcp_repair_opt
| sk-tcp.c:31:2: error: redeclaration of enumerator TCP_NO_QUEUE

So add a facility for compile time testing for reported entities
to be present on a system. For this we generate include/config.h
where all tested entries will lay and source code need to include
it only in places where really needed.

Reported-by: Vasily Averin <vvs@parallels.com>
Acked-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-20 16:02:14 +04:00
Kir Kolyshkin
befe5ad155 make help: document dist target
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-03 01:56:31 +04:00
Kir Kolyshkin
e516aa0122 Makefiles: add install target
Note to package maintainers:

1 Yes we do support DESTDIR.

2 From packaging scripts, use something like this:

	make install DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr

(v2: add PREFIX, install to /usr/local not /usr by default)
(v3: fix criu man section -- it is 8 not 1)

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-03 01:56:30 +04:00
Kir Kolyshkin
525da872b2 Makefile: mark gcov target as phony
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:35:36 +04:00
Kir Kolyshkin
fda4562049 Makefile: pass few targets at once
Be green -- save bytes!

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:35:28 +04:00
Kir Kolyshkin
15c3e884fa Makefile: fix whitespace in first $(E) argument
When silent make rules are enabled, we use special format
to inform what is going on, like this

$(E) "  ACTION  " files

We maintain specific whitespace around ACTION so different ones
are aligned nicely. Fix two places that were not aligned to the rest.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:35:01 +04:00
Kir Kolyshkin
c7f22b8daf make help: rename crtools to criu
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:34:39 +04:00
Kir Kolyshkin
fa291ae858 Makefile: don't use $(E) for help
$(E) is used for 'silent make' to inform about what is going on
when we are not printing actual commands being executed, and do
nothing in case of 'verbose make (i.e. make V=1).

For 'make help' we want to output the text regardless of whether
'silent make' is enabled or not.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:34:33 +04:00
Kir Kolyshkin
b94047e42f Makefile: add tar and dist targets
...using "git archive" command line from Pavel.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-02 22:32:21 +04:00
Pavel Emelyanov
9fec380c71 criu: Version 0.5 release
This is lots-of-bug-fixes release -- many new people started playing
with criu and reported a lot of issues with it.

Other than this, we have several new features. First of all it's C/R
of netlink sockets C/R (required for Fedora container dump) and pending
signals.

Next, we've changed the format of memory dumps. This allowed us to
implement so called page server, that allows to send memory dumps
directly on another box w/o intermediate dump file. Also this new
format made it possible to implement the (not yet final) --snapshot
option, that demonstrates the work of user memory changes tracker
in the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-30 20:50:03 +04:00
Kir Kolyshkin
354f82c3f5 crtools: rename binary to criu
"Tools" in the context of a binary name doesn't make any sense,
because every binary is a tool (lstool, dftool), plus it's one
tool.

So let's rename the beast to criu, which is short, pretty unique
and coincides with the name of the project.

Backward-compatible symlink is added for the sake of tests,
we can fix them later and remove the link.

Packagers beware: our binary is no longer crtools but criu.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-30 20:17:55 +04:00
Kir Kolyshkin
2cd78c5de7 Makefile: remove --no-print-directory
1 The comment before MAKEFLAGS assignment (see commit 25e8cb5) talks
about -r (and possibly -R) flags and has nothing to do with
--no-print-directory. Let's remove the last option to not confuse
a reader.

2 The --no-print-directory flag to build and build-crtools shorthands
is redundant, because scripts/Makefile.build has it already. Remove.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:06:40 +04:00
Kir Kolyshkin
4e1be049f5 Makefile: remove unused vars
We don't use TAGS, AWK or ECHO anywhere in the code (at least according
to git grep). Let's remove this.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:06:39 +04:00
Kir Kolyshkin
97802b0d55 Makefile.inc: restore
This reverts part of commit a519e0c which broke the man page build:

	[kir@kirpad Documentation]$ make
	"  GEN     " crtools.1
	/bin/sh:   GEN     : command not found
	make: *** [crtools.1] Error 127

So let's reintroduce Q and E in a separate Makefile.inc as it was
before.

Cc: Stanislav Kinsbursky <skinsbursky@openvz.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-29 16:06:37 +04:00
Cyrill Gorcunov
6bdc149642 Revert "make: Don't generate tags/cscope for tools/ and test/"
This reverts commit 396a08eb95.

As Andrew requested he needs the symbols to be generated for
all possible sources in the crtools code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-19 16:01:16 +04:00
Cyrill Gorcunov
396a08eb95 make: Don't generate tags/cscope for tools/ and test/
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:08:32 +04:00
Andrey Vagin
f238d56661 make: allow to change a compiler
clang-analyzer sets the environment variable CC
scan-build -plist-html --use-analyzer /usr/bin/clang make

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-04 14:00:19 +04:00
Cyrill Gorcunov
f7066d7dca make: Provide mandatory options in cflags-y variable
In case if CFLAGS is overriden from command line we don't
see our headers anymore. So provide mandatory options in
ccflags-y variable to fix that.

https://bugzilla.openvz.org/show_bug.cgi?id=2521

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-23 00:36:36 +04:00
Pavel Emelyanov
e3b4fb62cc criu: Version 0.4 release
This is the first release, that actually doesn't require a custom
kernel in order to make all the tool features to work. Just take
the v3.8 (with proper config) and that's it :)

Another coolness about this release is the ARM port. In this case,
however, one does require a custom kernel, since the kcmp system
call is not wired into the ARM table in the upstream kernel :(

What else? Quite a lot, actually:

* C/R ability of a LOT of new stuff
* Remote syscall execution
* Deprecation of --namespace option
* Build system rework
* Ability to collect gcov info

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-20 14:58:57 +04:00
Pavel Emelyanov
47eac37e8b make: Move criu version constants from scripts/ to root Makefile
It's nicer to have them there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-19 18:14:26 +04:00
Cyrill Gorcunov
55412e0d16 make: Use -iquote for headers lookup
Some of ours headers (such as syscall.h) are
clashes with system headers names. So we need
to be sure that the headers we include as

 | #include "something.h"

being searched in known place. In particular on
some machines it it already produced problems.

This btw revealved a problem in cr-dump.c -- we've
had #include <parasite.h> there. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Tested-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-19 15:46:06 +04:00
Cyrill Gorcunov
f50f7d01ec make: Move all generated files cleanup to clean-built target
This allows to reuse the code and make rebuild to work correctly.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:42:08 +04:00
Cyrill Gorcunov
25e8cb5c58 make: Switch main Makefile to simplified form
This is a bit tricky since the build infrastructure
we're switching to is targeted to per-directory targets
if simplified Makefiles are used.

So I did the following

 - move rules to compile general sources to Makefile.crtools
 - main Makefiles now simply calls for scritps/Makefile.build
   help to generate built-in.o target

Also note that we clean up suffixes for implicit rules with

	.SUFFIXES:

this is done on purpose to eliminate any possible side effect
in future -- all rules _must_ be described explicitly.

Because of implicit rules used in zdtm building procedure
I can't use of stict makefile mode and add

	MAKEFLAGS := -r

to the top of the general Makefile. This should be done
one day latter (if ever).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:49 +04:00
Cyrill Gorcunov
3ab787dba3 make: Use relative pathes where possible
We're building project from toplevel directory so
no need for absolute paths.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:47 +04:00
Cyrill Gorcunov
ecf73756ec make: No need for shell call, use CURDIR builtin instead
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:46 +04:00
Cyrill Gorcunov
c405549934 make: pie -- Switch to a new scheme
Because we need util-net.c for both PIE code and
a regular code, just move it to pie/ directory
and build with -fpie option, this way we can reuse
compiled file in main program without additional
compilation pass.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:45 +04:00
Cyrill Gorcunov
a210b5a1c5 make: protobuf -- Switch to a new scheme
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:44 +04:00
Cyrill Gorcunov
10ed5a0af4 make: arch -- Switch to a new build scheme
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-18 18:10:43 +04:00
Cyrill Gorcunov
4e6eca1881 make: Drop -r flag from $(RM)
It's already defined as RM := rm -f

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-15 17:37:20 +04:00
Cyrill Gorcunov
fdfef4b485 headers: Change "../protobuf/" to "protobuf/"
No need to walk up the directories if we need
to include protobuf file. This was always a bad
use of ability to walk the filesystem from other
headers.

Same time we don't need -I$(SRC_DIR)/protobuf/
in general makefile anymore.

[xemul: Small fixlet in head Makefile, since patch
 it out-of-order]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-15 17:33:06 +04:00
Cyrill Gorcunov
90fbbabb34 make: Generate crtools version from Makefile definition
This allows us to have a unique place where version lives
and what is more important other subsystems (such as docs
generation) may reuse version definitions.

At moment EXTRA (which corresponds kernels -rc tag) and
NAME is not yet used, but I desided to put them in place
for future needs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-11 19:24:06 +04:00
Cyrill Gorcunov
12298bf470 make: Use -f option for rm
Otherwise I'm getting warnings (especially in zdtm)
when we are trying to remove non-generated .d files.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-07 02:12:23 +04:00
Cyrill Gorcunov
286c8b2384 make: Drop unneeded HEXDUMP
We don't use it at all.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-02-07 02:12:03 +04:00
Cyrill Gorcunov
7d1d2e9f9d make: Simplify ARCH retrieval
Actually the former code was being expanding
uname_M variable which is not set that early
(this was not a problem since we assign it a
line below, still it was a dead code which
should be fixed).

Also update

 | ifeq ($(findstring arm,$(ARCH)),arm)

to simple

 | ifeq ($(ARCH),arm)

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-24 13:20:57 +04:00
Cyrill Gorcunov
709b091f9f make: Yield error on x86-32
Since we don't support x86-32 yet, issue an error early.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:30 +04:00
Cyrill Gorcunov
43407bdf87 make: Drop redundant DEBUG assignment
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:12 +04:00
Cyrill Gorcunov
79f27d49e8 make: Split long lines
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-23 17:43:04 +04:00
Alexander Kartashov
8fa8ca9feb arm: added ARM-specific files modelled after arch/x86
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-22 22:53:24 +04:00
Qiang Huang
286801d4c1 crtools: collect and check file locks
We collect all file locks to a golbal list, so we can use them easily
in dump_one_task. For optimizaton, we only collect file locks hold by
tasks in the pstree.

Thanks to the ptrace-seize machanism, we can aviod the blocked file lock
issue, makes the work simpler.

Right now, the check handles only one situation:
-- Dumping tasks with file locks hold without the -l option.

This covers for the most part. But we still need some more work to make
it perfect robust in the future.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 14:42:07 +04:00
Cyrill Gorcunov
b724096f0f fsnotify: Rename inotify files to fsnotify
We will be handling both inotify and fanotify
objects here thus to make less confusion rename
the files to fsnotify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:26 +04:00