305
310
cur_extra = next;
314
/* Before sending the signal to the pid this function verifies that
315
* the pid is a member of the current process group; either using
316
* apr_proc_wait(), where waitpid() guarantees to fail for non-child
317
* processes; or by using getpgid() directly, if available. */
318
apr_status_t ap_mpm_safe_kill(pid_t pid, int sig)
326
/* Ensure pid sanity */
332
rv = apr_proc_wait(&proc, &status, &why, APR_NOWAIT);
333
if (rv == APR_CHILD_DONE) {
334
#ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS
335
/* The child already died - log the termination status if
337
ap_process_child_status(&proc, why, status);
341
else if (rv != APR_CHILD_NOTDONE) {
342
/* The child is already dead and reaped, or was a bogus pid -
343
* log this either way. */
344
ap_log_error(APLOG_MARK, APLOG_NOTICE, rv, ap_server_conf,
345
"cannot send signal %d to pid %ld (non-child or "
346
"already dead)", sig, (long)pid);
352
/* Ensure pid sanity. */
359
/* Process already dead... */
363
if (pg != getpgrp()) {
364
ap_log_error(APLOG_MARK, APLOG_ALERT, 0, ap_server_conf,
365
"refusing to send signal %d to pid %ld outside "
366
"process group", sig, (long)pid);
371
return kill(pid, sig) ? errno : APR_SUCCESS;
308
373
#endif /* AP_MPM_WANT_RECLAIM_CHILD_PROCESSES */
310
375
#ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT
1217
1282
if (sigaction(SIGILL, &sa, NULL) < 0)
1218
1283
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, "sigaction(SIGILL)");
1286
if (sigaction(SIGFPE, &sa, NULL) < 0)
1287
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, "sigaction(SIGFPE)");
1221
1290
#else /* NO_USE_SIGACTION */