diff options
author | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-06 14:44:56 +0000 |
---|---|---|
committer | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-06 14:44:56 +0000 |
commit | b728e55c814bbf306f956180dc534c709f270d11 (patch) | |
tree | 87b5d13baf5c67f1a69253108fc1e9e0358d6d41 /threadproc/os2 | |
parent | 07a3ee42f8f5227b7f4503dadbc8d75fb4cad6e0 (diff) | |
download | libapr-b728e55c814bbf306f956180dc534c709f270d11.tar.gz |
Add an OS/2 apr_signal(), pretty much copied from unix/signals.c
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60483 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/os2')
-rw-r--r-- | threadproc/os2/signals.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/threadproc/os2/signals.c b/threadproc/os2/signals.c index 5d7e7aee0..6efd71d18 100644 --- a/threadproc/os2/signals.c +++ b/threadproc/os2/signals.c @@ -52,6 +52,7 @@ * <http://www.apache.org/>. */ +#define INCL_DOSEXCEPTIONS #include "threadproc.h" #include "fileio.h" #include "apr_thread_proc.h" @@ -79,3 +80,21 @@ apr_status_t apr_kill(apr_proc_t *proc, int signal) return rc; } + + +/* + * Replace standard signal() with the more reliable sigaction equivalent + * from W. Richard Stevens' "Advanced Programming in the UNIX Environment" + * (the version that does not automatically restart system calls). + */ +Sigfunc *apr_signal(int signo, Sigfunc * func) +{ + struct sigaction act, oact; + + act.sa_handler = func; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + if (sigaction(signo, &act, &oact) < 0) + return SIG_ERR; + return oact.sa_handler; +} |