2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00
Commit Graph

1528 Commits

Author SHA1 Message Date
Victor Konyashkin
fc8c66c629 zdtm: Need add -Wno-unused-result option lib and static Makefile
It's need to add -Wno-unused-result option to lib and
static Makefile to avoid errors like:
msg.c:58:8: error: ignoring return value of 'write', declared with
attribute warn_unused_result [-Werror=unused-result]

Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:46:23 +04:00
Viktor Konyashkin
66a7f1a3df zdtm: open with O_CREAT in second argument needs 3 arguments
The mode argument must be supplied when O_CREAT is specified in flags.
Otherwise it will cause compile error due to -Werror is specified.

Signed-off-by: Viktor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:45:19 +04:00
Andrey Vagin
168b7ca7a2 zdtm: remove extra code from file_fown
The testcase is buggy -- the signal is delivered _before_ we checkpoint
and restore it, thus it checks nothing. But after the fix test fails,
due to bug in fowners restore. Will fix it later.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:43:38 +04:00
Andrey Vagin
b026e59c43 zdtm: initialize shared memory before fork
Otherwise this memory are initialized from parent and child,
but parent may initialize, when a child has written a useful data.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:41:16 +04:00
Andrey Vagin
ba61f94646 zdtm: set SA_RESTART for SIGIO in file_fown
Otherwise waitpid returns -EINTR and the test case fails.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:40:55 +04:00
Kinsbursky Stanislav
fa43c2f2cd parasite: remove unused headers
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:39:37 +04:00
Kinsbursky Stanislav
c0d40c764a syscall: remove unused headers
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:39:18 +04:00
Cyrill Gorcunov
63000f5bb2 dump: Don't dump file params with on-stack values
Otherwise I see output like

 | Dumping path for 1536412160 fd via self 27 [/usr/bin/screen]

where fd is taken from stack and what is worse -- we work
with root privilegues, thus dumping _anything_ from stack
is very bad idea.

With explicitly cleared stack data and FD_DESC_INVALID the
log file will have an entry like

 | Dumping path for -3 fd via self 27 [/usr/bin/screen]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:36:17 +04:00
Cyrill Gorcunov
9b2546576c dump: Use switch in dump_chrdev
This will allow to implement tty dumping
in future.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:30:53 +04:00
Cyrill Gorcunov
301b2fe2ce log: Open logc files with O_TRUNC
It's really confusing when one use -o option
and didn't see update on top of log file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:29:50 +04:00
Cyrill Gorcunov
eb12c976a3 pipes: Add test that pipe data is restored without errors
This eliminates the warning below as well

 | pipes.c: In function ‘open_pipe’:
 | pipes.c:252:6: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-25 10:34:28 +04:00
Andrey Vagin
fc4768f4a2 headers: mark functions as inline
to fix warning "error: ‘XXXXXX’ defined but not used"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:44 +04:00
Andrey Vagin
066ec066a0 crtools: remove unused variables (v3)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:21 +04:00
Andrey Vagin
7454ab1cd5 make: remove -Wno-unused
We want to know about this warnings

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-18 19:01:02 +04:00
Cyrill Gorcunov
f1690ee0b5 Beautify include/sockets.h
Make it more readable.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-16 00:44:07 +04:00
Andrey Vagin
a411c8f21c restore: don't use an uninitialized variable
The global variable me isn't initialized, when we tried to use it.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-15 18:25:36 +04:00
Pavel Emelyanov
3b21f72766 mount: Full parse of proc mountinfo file
The proc_parse file turns into a strange pile of homebrew
scanf/fgets/strtok/strchr/etc. combination. I don't like it :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-13 08:34:31 +04:00
Pavel Emelyanov
f986994272 proc: Move proc string parse into separate fn
We'll have to parse it all and the format is not scanf
friendly, so it's simpler to have it in a separate fn.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-13 08:34:26 +04:00
Pavel Emelyanov
5e593e9b57 proc: Sanitize mountinfo parsing
Make the proc_mountinfo obtaned after parse form a single linked list.
That's much easier to handle and doesn't have an artificial limitation
of 64 items...

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-13 08:34:16 +04:00
Andrey Vagin
f9d1f2b275 utsns: use pr_msg for showing content
Otherwise it shows nothing without the verbose option

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-15 13:35:55 +04:00
Andrey Vagin
8a1337641f namespaces: include namespaces.h
to be sure that all declarations consistent.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-15 13:35:36 +04:00
Pavel Emelyanov
90d0a6a0de mount: Collect mount root as well when parsing proc
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 03:45:47 +04:00
Pavel Emelyanov
79da538469 mount: Rename proc_mountinfo mnt_root to mountpoint
What is stored there is the path to mountpoint. The root
is the field previously named "parent root".

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 03:40:08 +04:00
Pavel Emelyanov
db297a0f97 mnt: Preparations for mountpoints dumping
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 03:30:10 +04:00
Pavel Emelyanov
3d64f9d140 crtools: Remove explicit FMT_FNAME_ macros
Just put names right into desc template array. Nobody uses
these individually.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 03:17:48 +04:00
Pavel Emelyanov
21075911cc image: Shorted fdset template description
Introduce a helper, that will declare one tmpl entry
with one line.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 03:12:12 +04:00
Pavel Emelyanov
5cfa8a6de1 crtools: Remove unused flags arg from parse_ns_string
Opts are now global and flags are just assigned on it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 02:34:22 +04:00
Andrey Vagin
6fd82bf702 zdtm.sh: check that a pid is valid
A test process should be alive.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:25:39 +04:00
Andrey Vagin
ef1c6035f1 zdtm: don't show a wrong path to log files
It showed old pathes.

Dump log   : /root/crtools/test/dump/inotify00/15673/dump.log
Restore log: /root/crtools/test/dump/inotify00/15673/restore.log
Output file: /root/crtools/test/zdtm/live/static/utsname.out
make: *** [test] Error 1

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:25:18 +04:00
Cyrill Gorcunov
0196d30a52 eventpoll, inotify: Don't fail on watchees absence
In case if eventpoll or inotify just created but
not watchee added we should not fail.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:23:33 +04:00
Andrey Vagin
a67d0cb25a zdtm: add gitignore
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:21:47 +04:00
Andrey Vagin
9fc24621d5 zdtm: delete an unused file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-12 16:17:12 +04:00
Cyrill Gorcunov
62ee701c89 Use /proc/pid/smaps for VMA parsing v2
This allows us to detect nonlinear mappings.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-11 17:41:05 +04:00
Cyrill Gorcunov
32e07745cc sockets: Print error message on unexpected socket state
While been playing with sockets dumping I found a case where
we exit without descriptive error message. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-11 17:39:45 +04:00
Andrey Vagin
f53888480e zdtm: open log files with O_APPEND
I'm a paranoiac.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-11 17:39:02 +04:00
Pavel Emelyanov
33051cd3b3 sockopt: Add basic options dump/restore
Only snd and rcv bufs and timeouts. Just as an example, others will be adder
sequentially.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-10 14:29:57 +04:00
Pavel Emelyanov
7f82ae1133 sockets: Prepare for dumping/restoring/showing socket options
Those sitting on the SOL_SOCKET level are common to different
socket families and will be handled in a generic code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-10 14:29:57 +04:00
Cyrill Gorcunov
7b7e86c9ca files: Print error if fcntl failed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-10 14:12:55 +04:00
Cyrill Gorcunov
112b2fe524 zdtm: Extend eventfs00 for deferred eventpoll test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:47:59 +04:00
Cyrill Gorcunov
649baf8ebe files: Handle eventpoll files deferred
Since event polling depends on other files
to be opened we split main files list into
two parst -- event poll files and all other
files, thus defer the creation of eventpoll
files in prepare_fds().

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:47:51 +04:00
Andrey Vagin
10b46351d1 log: fix log messages
They looks better in this state

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:24:39 +04:00
Andrey Vagin
f0decea728 log: remove pid from messages
Now log messages may be splitted by pid

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:24:20 +04:00
Andrey Vagin
fc7bedc50a crtools: make to be able to split messages by pid
If the option --log-pid is set, each process will have an own log file.
Otherwise PID is added to each log message.

A message can't be bigger than one page minus some bytes for pid.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:22:04 +04:00
Andrey Vagin
ad7c18a1d4 crtools: export opts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:19:29 +04:00
Pavel Emelyanov
fc830ddca9 anoninode: Report error when dumping unknown anon file
It will fall through all the other checks, but let's do it
explicitly for better code understanding.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 16:13:50 +04:00
Pavel Emelyanov
a604c63cdb restore: Move type from file_desc to file_desc_ops
This saves some space on dynamic file_desc and makes file_desc_ops
looks closer to fdinfo_ops used on dump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:41:05 +04:00
Pavel Emelyanov
6a55c1c596 dump: Move per-type dump opts into respective .c files
No functional changes, just a code move.

TODO:

* need to write personal make_gen_id implementations for special
files (device and pos is const for them effectively)
* need to merge dump ops with restore ones (file_desc_ops)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:34:55 +04:00
Pavel Emelyanov
2cea6414e6 fdpsrms: Remove now unused type field
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:28:28 +04:00
Pavel Emelyanov
f509fcf03f dump: Introduce file dumping operations
Now all the fds dump look very similar and we can reimplement
it via indirect calls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:25:25 +04:00
Pavel Emelyanov
37a3ed86f4 dump: Split dumping reg file and pipes
Reg files are those obtained by open() syscall on restore.

Pipes should be checked to belong to pipefs (fifos are not supported
yet).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-04 15:06:20 +04:00