New BSD compatible signal function
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@212 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
40
lib/roken/signal.c
Normal file
40
lib/roken/signal.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "bsd_locl.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
/*
|
||||
* Bugs:
|
||||
*
|
||||
* Do we need any extra hacks for SIGCLD and/or SIGCHLD?
|
||||
*/
|
||||
|
||||
typedef RETSIGTYPE (*SigAction)(/* int??? */);
|
||||
|
||||
|
||||
SigAction
|
||||
signal(int iSig, SigAction pAction)
|
||||
{
|
||||
struct sigaction saNew, saOld;
|
||||
|
||||
saNew.sa_handler = pAction;
|
||||
sigemptyset(&saNew.sa_mask);
|
||||
saNew.sa_flags = 0;
|
||||
|
||||
if (iSig == SIGALRM)
|
||||
{
|
||||
#ifdef SA_INTERRUPT
|
||||
saNew.sa_flags |= SA_INTERRUPT;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef SA_RESTART
|
||||
saNew.sa_flags |= SA_RESTART;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sigaction(iSig, &saNew, &saOld) < 0)
|
||||
return(SIG_ERR);
|
||||
|
||||
return(saOld.sa_handler);
|
||||
}
|
Reference in New Issue
Block a user