Hello! On Wed, Oct 12, 2016 at 08:44:25PM +0800, 李林哲 wrote:
> # HG changeset patch > # User lilinzhe <l...@antiy.cn> > # Date 1476275566 -28800 > # Node ID 07d294d39cc6ec07769c1a72d5ee9b7da27b9ce1 > # Parent 7cdf69d012f02a80c94d930b29c71847e203e4d6 > fork: subprocess quit when parent died > > diff -r 7cdf69d012f0 -r 07d294d39cc6 auto/os/linux > --- a/auto/os/linux Tue Oct 11 18:03:01 2016 +0300 > +++ b/auto/os/linux Wed Oct 12 20:32:46 2016 +0800 > @@ -157,6 +157,18 @@ > . auto/feature > > > +# prctl(PR_SET_PDEATHSIG) > + > +ngx_feature="prctl(PR_SET_PDEATHSIG)" > +ngx_feature_name="NGX_HAVE_PR_SET_PDEATHSIG" > +ngx_feature_run=yes > +ngx_feature_incs="#include <sys/prctl.h> > + #include <signal.h>" > +ngx_feature_path= > +ngx_feature_libs= > +ngx_feature_test="if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) == -1) > return 1" > +. auto/feature > + > # sched_setaffinity() > > ngx_feature="sched_setaffinity()" > diff -r 7cdf69d012f0 -r 07d294d39cc6 src/os/unix/ngx_daemon.c > --- a/src/os/unix/ngx_daemon.c Tue Oct 11 18:03:01 2016 +0300 > +++ b/src/os/unix/ngx_daemon.c Wed Oct 12 20:32:46 2016 +0800 > @@ -26,6 +26,13 @@ > exit(0); > } > > + #if(NGX_HAVE_PR_SET_PDEATHSIG) > + if(prctl(PR_SET_PDEATHSIG, SIGTERM, 0,0,0) == -1){ > + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "prctl > PR_SET_PDEATHSIG failed"); > + return NGX_ERROR; > + } > + #endif > + > ngx_pid = ngx_getpid(); > > if (setsid() == -1) { > diff -r 7cdf69d012f0 -r 07d294d39cc6 src/os/unix/ngx_process.c > --- a/src/os/unix/ngx_process.c Tue Oct 11 18:03:01 2016 +0300 > +++ b/src/os/unix/ngx_process.c Wed Oct 12 20:32:46 2016 +0800 > @@ -195,6 +195,13 @@ > > case 0: > ngx_pid = ngx_getpid(); > + > + #if(NGX_HAVE_PR_SET_PDEATHSIG) > + if(prctl(PR_SET_PDEATHSIG, SIGTERM, 0,0,0) == -1){ > + ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, "prctl > PR_SET_PDEATHSIG failed"); > + return NGX_ERROR; > + } > + #endif > proc(cycle, data); > break; It is not clear what problem you are trying to solve. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel