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>
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>
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>
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>
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>
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>
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>
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>
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>
If you execute this script without arguments, it will execute
all test cases, which should pass.
Or the first argument may be a path to the test case.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Since we use pure syscalls there is no
need to keep intermediate layer for signals.
Moreover mask entry moved at the end of the structure
so we will easily expand it if it'll be ever needed.
Note it breaks backward compatibility with older image
but since it's development stage it should be safe.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Probably all of you know about "lock inversion". There was a similar
problem on restoring pipes.
One process try to restore pipe1 and waits when another process attached
to it. In this time another process restores pipe2 and waits too.
I know two solves.
1. Open all pipes -> attach to them -> close unnecessary ends.
This method has a problem, if only one end belongs to the process. In
this cases another end occupies a descriptor, which may be needed to
another pipe.
2. Restore pipes in the same order. This patch does that.
A sorted list of pipe entries are constructed.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This patch removed stange logic about minusers.
Now we calculate foreign users only.
The main idea of this patch, that we bind a pipe ends to correct
descriptos immediately.
When a process X creates a pipe, we have two cases:
1. Both ends belongs to this process. It's simple, we bind both ends
to their descriptors and we go further.
2. Only one end of a pipe belongs to this process. In this case we are
waiting all foreign users and we go futher.
In second case we should wait, because a end which doesn't belong to
this process occupies a file descriptor, which may be used by another
pipe.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelianov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CWD is saved as file descriptor with number -1.
v2: use dump_regular_file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Now I try to restore CWD and a relative path will be invalid.
Add new options -D to set image files directory.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Probably all of you know about "lock inversion". We have a similar
problem on restoring pipes.
This test case creates two process and two pipes.
process 1:
11: pipe1 (w)
12: pipe2 (r)
process 2:
11: pipe2 (r)
12: pipe1 (w)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>