[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 11/18] libxl: fork: Break out sigchld_sethandler_raw
On Mon, 2014-02-03 at 16:14 +0000, Ian Jackson wrote: > We are going to want introduce another call site in the final > substantive patch. > > Pure code motion; no functional change. > > Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> > Cc: Jim Fehlig <jfehlig@xxxxxxxx> Acked-by: Ian Campbell <Ian.Campbell@xxxxxxxxxx> > > --- > v3: Remove now-unused variables from sigchld_installhandler_core > --- > tools/libxl/libxl_fork.c | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > > diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c > index ce8e8eb..084d86a 100644 > --- a/tools/libxl/libxl_fork.c > +++ b/tools/libxl/libxl_fork.c > @@ -182,6 +182,19 @@ static void sigchld_handler(int signo) > errno = esave; > } > > +static void sigchld_sethandler_raw(void (*handler)(int), struct sigaction > *old) > +{ > + struct sigaction ours; > + int r; > + > + memset(&ours,0,sizeof(ours)); > + ours.sa_handler = handler; > + sigemptyset(&ours.sa_mask); > + ours.sa_flags = SA_NOCLDSTOP | SA_RESTART; > + r = sigaction(SIGCHLD, &ours, old); > + assert(!r); > +} > + > static void sigchld_removehandler_core(void) > { > struct sigaction was; > @@ -196,18 +209,10 @@ static void sigchld_removehandler_core(void) > > static void sigchld_installhandler_core(libxl__gc *gc) > { > - struct sigaction ours; > - int r; > - > assert(!sigchld_owner); > sigchld_owner = CTX; > > - memset(&ours,0,sizeof(ours)); > - ours.sa_handler = sigchld_handler; > - sigemptyset(&ours.sa_mask); > - ours.sa_flags = SA_NOCLDSTOP | SA_RESTART; > - r = sigaction(SIGCHLD, &ours, &sigchld_saved_action); > - assert(!r); > + sigchld_sethandler_raw(sigchld_handler, &sigchld_saved_action); > > assert(((void)"application must negotiate with libxl about SIGCHLD", > !(sigchld_saved_action.sa_flags & SA_SIGINFO) && _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |