home *** CD-ROM | disk | FTP | other *** search
- /* sys/signal.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
-
- #include <sys/emx.h>
- #include <os2emx.h>
- #include <signal.h>
- #include <errno.h>
- #include "syscalls.h"
- #include "syssig.h"
-
- void (*__signal (int sig, void (*handler)()))(int sig)
- {
- void (*prev)();
- int pend;
-
- if (sig < 1 || sig >= NSIG || sig == SIGKILL)
- {
- errno = EINVAL;
- return (SIG_ERR);
- }
- prev = _sys_sig_handlers[sig];
- if (handler == SIG_ACK)
- {
- _sys_sig_ack_req[sig] = 0;
- pend = _sys_sig_pending[sig];
- _sys_sig_pending[sig] = 0;
- if (sig == SIGINT)
- DosAcknowledgeSignalException (XCPT_SIGNAL_INTR);
- else if (sig == SIGBREAK)
- DosAcknowledgeSignalException (XCPT_SIGNAL_BREAK);
- if (pend && __raise (sig) != 0)
- return (SIG_ERR);
- }
- else
- _sys_sig_handlers[sig] = handler;
- return (prev);
- }
-