From e31a5847e269d865b7248554e328bc9ac358454a Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Thu, 20 Sep 2012 00:30:39 -0700 Subject: runner: introduce a new variant runner_run_nowait() which makes the child blindly _exit(0) (thereby relieving the caller quickly) and the grandchild continues to actually do execvp(). Change-Id: I4dac0f39aaaa5b2ae5dbeb96e221b8257f8d3a22 BUG: 762935 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/3962 Tested-by: Gluster Build System Reviewed-by: Csaba Henk --- libglusterfs/src/run.c | 19 +++++++++++++++++++ libglusterfs/src/run.h | 6 ++++++ 2 files changed, 25 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index 50c1e30b..94511b1c 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -392,6 +392,25 @@ runner_run (runner_t *runner) return runner_run_generic (runner, runner_end); } + +int +runner_run_nowait (runner_t *runner) +{ + int pid; + + pid = fork (); + + if (!pid) { + setsid (); + _exit (runner_start (runner)); + } + + if (pid > 0) + runner->chpid = pid; + return runner_end (runner); +} + + int runner_run_reuse (runner_t *runner) { diff --git a/libglusterfs/src/run.h b/libglusterfs/src/run.h index 508c59c1..d7554ef6 100644 --- a/libglusterfs/src/run.h +++ b/libglusterfs/src/run.h @@ -165,6 +165,12 @@ int runner_end_reuse (runner_t *runner); */ int runner_run (runner_t *runner); +/** + * variant for runner_run() which does not wait for acknowledgement + * from child, and always assumes it succeeds. + */ +int runner_run_nowait (runner_t *runner); + /** * variant of runner_run() which does not free internal data * so that the runner instance can be run again. -- cgit