mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-28 12:36:47 +00:00
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: Pavel Emelyanov <xemul@virtuozzo.com> Acked-by: Tycho Andersen <tycho.andersen@canonical.com> Travised-by: https://travis-ci.org/xemul/criu/builds/170726663
This commit is contained in:
parent
58d2ee6446
commit
27a481c888
3 changed files with 14 additions and 1 deletions
|
|
@ -362,6 +362,7 @@ void ns_create(int argc, char **argv)
|
|||
int ret, status;
|
||||
struct ns_exec_args args;
|
||||
int flags;
|
||||
char *pidf;
|
||||
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
|
|
@ -416,6 +417,14 @@ void ns_create(int argc, char **argv)
|
|||
}
|
||||
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;
|
||||
ret = read(args.status_pipe[0], &status, sizeof(status));
|
||||
if (ret != sizeof(status) || status) {
|
||||
|
|
@ -428,6 +437,9 @@ void ns_create(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
unlink(pidfile);
|
||||
pidfile = pidf;
|
||||
|
||||
if (write_pidfile(pid))
|
||||
exit(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ int test_fork_id(int id)
|
|||
|
||||
static int cwd = -1;
|
||||
|
||||
#define INPROGRESS ".inprogress"
|
||||
static void test_fini(void)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define INPROGRESS ".inprogress"
|
||||
|
||||
#ifndef PAGE_SIZE
|
||||
# define PAGE_SIZE (unsigned int)(sysconf(_SC_PAGESIZE))
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue