2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

7582 Commits

Author SHA1 Message Date
Pavel Emelyanov
bf7a74d47e Helper for moving image fd
When opening an fd at a position where the current image fd sits
the latter one should be moved.

Introduce a helper for this.

Signed-off-by; Pavel Emelyanov <xemul@parallels.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 21:53:44 +04:00
Pavel Emelyanov
99cc87949f reopn_fd_as return code fixlet and cleanup
Nobody cares the returned fd, so just make it 0/-1 and clean up the callers.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 21:53:36 +04:00
Cyrill Gorcunov
d7ab5f2f7b restorer: Implement own BUG_ON_HANDLER
Due to code specifics (we're running without
glibc support) we need own one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 15:54:27 +04:00
Cyrill Gorcunov
f5a87742a0 util: Add BUG_ON helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 15:54:03 +04:00
Cyrill Gorcunov
42c755b466 restorer: last_pid_ns should be written without eol
Otherwise -EINVAL returned

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:25:06 +04:00
Cyrill Gorcunov
4f797015e6 test: Enhance pthreads test to include fork calls
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:24:56 +04:00
Cyrill Gorcunov
3c929e540c dump: Adopt dumping children for new format
Kernel has a new format for process children
(ie /proc/<pid>/task/<tid>/children) so adopt
crtools for it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:24:46 +04:00
Cyrill Gorcunov
894a626a52 dump: parse_threads - Pass single struct pstree_item instead of a few parameters
Parsing children will require to know the number
of threads found so in a sake of consistency pass
single struct pstree_item here as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:24:37 +04:00
Cyrill Gorcunov
3e45e04050 util: Add fopen_fmt helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:24:27 +04:00
Cyrill Gorcunov
7cf9246a8d restorer: Write failing tid
In error logging sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:10:39 +04:00
Cyrill Gorcunov
70938a3d61 restore: Make sure setting last-pid successed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 02:10:29 +04:00
Cyrill Gorcunov
5c7fae1449 show: Fix useless sigaction mask dereference which lead to sigsev
struct sa_entry was converted to native format so
no need for dereference here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:52:19 +04:00
Cyrill Gorcunov
8e5dc8a198 crtools: Allow to not specify a pid if to show a file contents
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:47:06 +04:00
Cyrill Gorcunov
344ccb365c crtools: Make sure pid is specified in command line
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 19:26:37 +04:00
Cyrill Gorcunov
7b1ea1470f Drop kernel/ directory
The kernel patches are carried in a separate
repo anyway, so a second place for patches
might be confusing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-20 16:56:04 +04:00
Cyrill Gorcunov
681ef94fc0 ptrace: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:25:08 +04:00
Cyrill Gorcunov
350225a2ae log: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:22:31 +04:00
Cyrill Gorcunov
62e9851a84 cr-show: Drop unneeded #includes
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:20:51 +04:00
Cyrill Gorcunov
ff954f655f dump: Drop unneeded #includes
This as well forces to move ptrace
definitions into ptrace.h, otherwise
freshly fetched kernel headers become
conflict with existing ptrace constants.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 23:18:17 +04:00
Cyrill Gorcunov
6e6a820bcf crtools: Drop unneeded headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 22:29:30 +04:00
Cyrill Gorcunov
92efe1921a types: Drop user_regs_struct_t for x86-32
We don't support x86-32 yet so no need to
carry this declaration, it's only confusing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 22:20:42 +04:00
Cyrill Gorcunov
2e3c4e3692 Move everything related to ptrace into ptrace.[ch]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:57:59 +04:00
Cyrill Gorcunov
83fd63d3fe Add missing extern to function prototypes
Regardless that we link all things in one executable
better declare them so from the very beggining.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:46:03 +04:00
Cyrill Gorcunov
32ac78a499 util: Drop ptrace seize helpers declaration from the header
Already defined in seize.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:19:28 +04:00
Cyrill Gorcunov
8a90464cc9 Drop some duplicated #include
And rearrange the rest.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 21:05:37 +04:00
Cyrill Gorcunov
d6eab944e3 Move logging functions to log.c
Instead of keeping all unrelated to
C/R procedure helpers in util.c move
logging related helpers to log.c.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 18:52:50 +04:00
Cyrill Gorcunov
3023837da9 crtools: Return negative number on error
In a sake of consistency.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 18:23:14 +04:00
Cyrill Gorcunov
dc883fe49f util: Drop unused inline_memcpy
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-19 16:13:04 +04:00
Cyrill Gorcunov
08faefd6bb crtools: Use safe strncpy in get_image_path
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:37:05 +04:00
Cyrill Gorcunov
6485fbd25f parasite: Make max size for path being PATH_MAX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:34:37 +04:00
Cyrill Gorcunov
6adce279e8 make: Force rebuild is headers changed
Not a clean solution yet.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:33:30 +04:00
Cyrill Gorcunov
12ea815642 restore: We should check for error returned in get_image_path
This as well implies we change paths to PATH_MAX size.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:32:27 +04:00
Cyrill Gorcunov
03a5e05a65 Rename 'name' member of cr_fd_desc to 'path'
It might contain working directory path as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:31:14 +04:00
Cyrill Gorcunov
bcba2f734a crtools: Update help message
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 15:26:51 +04:00
Cyrill Gorcunov
f65c75c78a crtools: Move global image_dir to the top of the file
Better to have global vars gathered.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
2011-12-19 14:58:50 +04:00
Andrey Vagin
b84babe630 get_image_path: calculate size of string correctly
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 16:26:48 +04:00
Andrey Vagin
4ba93d0806 pipe: initialize fields in pipe_info properly.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 16:26:42 +04:00
Andrey Vagin
c84d194343 zdtm: update list of passed tests (v2)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-16 15:24:38 +04:00
Cyrill Gorcunov
739ca109c6 crtools: Fix getcwd return value test
getcwd returns NULL on error, fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 15:07:06 +04:00
Cyrill Gorcunov
c1350f9ab1 Make error codes returned being a negative value
We have a mess in our return codes:
some functions return negative values,
while others -- positive.

Sanitize the return codes and make error
condition to return negative values.

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 15:03:33 +04:00
Cyrill Gorcunov
093e4f35c3 kernel: Update kernel patches
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-13 12:39:15 +04:00
Cyrill Gorcunov
950e788b1c Dump: Add missing ending new lines to pr_perror
pr_perror is not the same as perror and requires
new line at then end.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-10 12:49:55 +04:00
Andrey Vagin
57e8e3e8b2 restore: A child should not return to parent code.
Otherwise it may begin to restore a parent objects...

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:41 +04:00
Andrey Vagin
85b991c251 pipe: Don't redefine the variable ret
For this reason a function may return success in case of error.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:32 +04:00
Andrey Vagin
92a694cf14 pipe: re-execute splice if not all data have been transferred.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:37:11 +04:00
Andrey Vagin
dd444aac9b pipe: avoid intersection of pipe descriptors.
1. pipe() returns two descriptors with numbers (r: x, w: y).
We may want to restore it as (r: y, w: x).
2. Close a extra end, before try to restore a target end.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 20:36:51 +04:00
Cyrill Gorcunov
6840bcc4d4 restore: Move struct pipe_list_entry at top of file
Stage structures in one place.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 15:39:08 +04:00
Cyrill Gorcunov
bf9a873866 restore: Drop bogus comment
Even u64 address might consume not greater
than 20 bytes of string so 128 is enough and
safe here.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 15:14:16 +04:00
Andrey Vagin
335639dc7c crtools: kill all dumped processes by default
If a process continue to run, it may change a state of filesystem.

@gorcunov:
 - Drop -k option, it's not needed anymore.
 - Allow -c option (continue execution of a
   process after being dumped) in dumping procedure.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 12:37:08 +04:00
Cyrill Gorcunov
6701296f5a dump: Be ready for absence of output from /proc/pid/children
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-09 11:45:55 +04:00