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

zdtm: show a process tree before and after c/r

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2013-03-29 00:01:56 +04:00
committed by Pavel Emelyanov
parent cc97a2d012
commit 1b234fd890
2 changed files with 18 additions and 1 deletions

View File

@@ -186,11 +186,15 @@ construct_root()
{
local root=$1
local test_path=$2
local ps_path=`type -P ps`
local libdir=$root/lib
local libdir2=$root/lib64
mkdir $root/bin
cp $ps_path $root/bin
mkdir $libdir $libdir2
for i in `ldd $test_path | awk '{ print $1 }' | grep -v vdso`; do
for i in `ldd $test_path $ps_path | awk '/^\s/{ print $1 }' | grep -v vdso`; do
local lib=`basename $i`
[ -f $libdir/$lib ] && continue ||
[ -f $i ] && cp $i $libdir && cp $i $libdir2 && continue ||

View File

@@ -210,6 +210,13 @@ int ns_init(int argc, char **argv)
ret = 1;
waitpid(pid, &ret, 0);
pid = fork();
if (pid == 0) {
execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL);
} else if (pid > 0)
waitpid(pid, NULL, 0);
/* Daemonize */
write(status_pipe, &ret, sizeof(ret));
close(status_pipe);
@@ -219,6 +226,12 @@ int ns_init(int argc, char **argv)
/* suspend/resume */
test_waitsig();
pid = fork();
if (pid == 0) {
execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL);
} else if (pid > 0)
waitpid(pid, NULL, 0);
fd = open(pidfile, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "open(%s) failed: %m\n", pidfile);