Commit 23501ffe authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: add ability to set id of a test proccess

It's just easy for debugging
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent faf12f40
...@@ -30,11 +30,13 @@ static pid_t master_pid = 0; ...@@ -30,11 +30,13 @@ static pid_t master_pid = 0;
int proc_id = 0; int proc_id = 0;
static int proc_id_cur = 0; static int proc_id_cur = 0;
int test_fork() { int test_fork_id(int id)
proc_id_cur++; {
pid_t pid = fork(); pid_t pid = fork();
if (id < 0)
id = ++proc_id_cur;
if (pid == 0) if (pid == 0)
proc_id = proc_id_cur; proc_id = id;
return pid; return pid;
} }
......
...@@ -12,7 +12,8 @@ extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int ( ...@@ -12,7 +12,8 @@ extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int (
#endif #endif
/*wrapper for fork: init log offset*/ /*wrapper for fork: init log offset*/
extern int test_fork(); #define test_fork() test_fork_id(-1)
extern int test_fork_id(int id);
/* finish setting up the test, write out pid file, and go to background */ /* finish setting up the test, write out pid file, and go to background */
extern void test_daemon(void); extern void test_daemon(void);
/* store a message to a static buffer */ /* store a message to a static buffer */
......
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