Commit 27a481c8 authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Write .inprogress pidfile

This one will contain pid of the task living in a sub-ns and
waiting for the rest of the test to get daemonized.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Travised-by: https://travis-ci.org/xemul/criu/builds/170726663
parent 58d2ee64
...@@ -362,6 +362,7 @@ void ns_create(int argc, char **argv) ...@@ -362,6 +362,7 @@ void ns_create(int argc, char **argv)
int ret, status; int ret, status;
struct ns_exec_args args; struct ns_exec_args args;
int flags; int flags;
char *pidf;
args.argc = argc; args.argc = argc;
args.argv = argv; args.argv = argv;
...@@ -416,6 +417,14 @@ void ns_create(int argc, char **argv) ...@@ -416,6 +417,14 @@ void ns_create(int argc, char **argv)
} }
shutdown(args.status_pipe[0], SHUT_WR); shutdown(args.status_pipe[0], SHUT_WR);
pidf = pidfile;
pidfile = malloc(strlen(pidfile) + 13);
sprintf(pidfile, "%s%s", pidf, INPROGRESS);
if (write_pidfile(pid)) {
fprintf(stderr, "Preparations fail\n");
exit(1);
}
status = 1; status = 1;
ret = read(args.status_pipe[0], &status, sizeof(status)); ret = read(args.status_pipe[0], &status, sizeof(status));
if (ret != sizeof(status) || status) { if (ret != sizeof(status) || status) {
...@@ -428,6 +437,9 @@ void ns_create(int argc, char **argv) ...@@ -428,6 +437,9 @@ void ns_create(int argc, char **argv)
exit(1); exit(1);
} }
unlink(pidfile);
pidfile = pidf;
if (write_pidfile(pid)) if (write_pidfile(pid))
exit(1); exit(1);
......
...@@ -41,7 +41,6 @@ int test_fork_id(int id) ...@@ -41,7 +41,6 @@ int test_fork_id(int id)
static int cwd = -1; static int cwd = -1;
#define INPROGRESS ".inprogress"
static void test_fini(void) static void test_fini(void)
{ {
char path[PATH_MAX]; char path[PATH_MAX];
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#define INPROGRESS ".inprogress"
#ifndef PAGE_SIZE #ifndef PAGE_SIZE
# define PAGE_SIZE (unsigned int)(sysconf(_SC_PAGESIZE)) # define PAGE_SIZE (unsigned int)(sysconf(_SC_PAGESIZE))
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment