update it
This commit is contained in:
parent
5557c9b948
commit
ad44d2ab58
|
@ -19,6 +19,13 @@ extern "C" {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Terminate a process.
|
||||
* @param proc The process to terminate.
|
||||
* @param sig How to kill the process.
|
||||
*/
|
||||
CORE_DECLARE(status_t) core_kill(pid_t pid, int sig);
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
|
||||
#if defined(DARWIN) && !defined(__cplusplus) && !defined(_ANSI_SOURCE)
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
#include "core.h"
|
||||
#include "core_signal.h"
|
||||
|
||||
CORE_DECLARE(status_t) core_kill(pid_t pid, int signum)
|
||||
{
|
||||
#ifdef OS2
|
||||
/* SIGTERM's don't work too well in OS/2 (only affects other EMX
|
||||
* programs). CGIs may not be, esp. REXX scripts, so use a native
|
||||
* call instead
|
||||
*/
|
||||
if (signum == SIGTERM) {
|
||||
return APR_FROM_OS_ERROR(DosSendSignalException(pid,
|
||||
XCPT_SIGNAL_BREAK));
|
||||
}
|
||||
#endif /* OS2 */
|
||||
|
||||
if (kill(pid, signum) == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
|
||||
#if defined(__NetBSD__) || defined(DARWIN)
|
||||
static void avoid_zombies(int signo)
|
||||
{
|
||||
|
@ -53,6 +75,8 @@ core_sigfunc_t *core_signal(int signo, core_sigfunc_t *func)
|
|||
return oact.sa_handler;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void remove_sync_sigs(sigset_t *sig_mask)
|
||||
{
|
||||
#ifdef SIGABRT
|
||||
|
@ -219,7 +243,7 @@ status_t signal_init(void)
|
|||
|
||||
status_t signal_block(int signum)
|
||||
{
|
||||
#if APR_HAVE_SIGACTION
|
||||
#if HAVE_SIGACTION
|
||||
sigset_t sig_mask;
|
||||
int rv;
|
||||
|
||||
|
@ -246,7 +270,7 @@ status_t signal_block(int signum)
|
|||
|
||||
status_t signal_unblock(int signum)
|
||||
{
|
||||
#if APR_HAVE_SIGACTION
|
||||
#if HAVE_SIGACTION
|
||||
sigset_t sig_mask;
|
||||
int rv;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "freeDiameter/libfdcore.h"
|
||||
#include "freeDiameter/extension.h"
|
||||
|
||||
static pid_t s6a_fd_hss_pid;
|
||||
|
||||
static void s6a_gnutls_log_func(int level, const char *str);
|
||||
static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
||||
|
||||
|
@ -73,12 +75,11 @@ status_t s6a_fd_init()
|
|||
{
|
||||
status_t rv;
|
||||
|
||||
pid_t pid;
|
||||
pid = fork();
|
||||
s6a_fd_hss_pid = fork();
|
||||
|
||||
d_assert(pid != -1, _exit(EXIT_FAILURE), "fork() failed");
|
||||
d_assert(s6a_fd_hss_pid >= 0, _exit(EXIT_FAILURE), "fork() failed");
|
||||
|
||||
if (pid == 0)
|
||||
if (s6a_fd_hss_pid == 0)
|
||||
{
|
||||
/* Child */
|
||||
rv = s6a_fd_init_internal(s6a_fd_hss_config());
|
||||
|
@ -102,6 +103,8 @@ void s6a_fd_final()
|
|||
CHECK_FCT_DO( fd_core_shutdown(), d_error("fd_core_shutdown() failed") );
|
||||
CHECK_FCT_DO( fd_core_wait_shutdown_complete(),
|
||||
d_error("fd_core_wait_shutdown_complete() failed"));
|
||||
|
||||
core_kill(s6a_fd_hss_pid, SIGTERM);
|
||||
}
|
||||
|
||||
static void s6a_gnutls_log_func(int level, const char *str)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "core.h"
|
||||
#include "core_debug.h"
|
||||
#include "core_signal.h"
|
||||
|
||||
#include "cellwire.h"
|
||||
#include "context.h"
|
||||
|
@ -50,6 +51,7 @@ void test_terminate(void)
|
|||
void test_initialize(void)
|
||||
{
|
||||
core_initialize();
|
||||
signal_init();
|
||||
cellwire_initialize(NULL);
|
||||
|
||||
threads_start();
|
||||
|
|
Loading…
Reference in New Issue