Patch by Vasilis Kaoutsis: Implemented sigignore(). Small changes by myself.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22789 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-11-01 18:03:36 +00:00
parent d284de3249
commit 74fa73bac6
3 changed files with 39 additions and 0 deletions

View File

@ -163,6 +163,7 @@ int sigfillset(sigset_t *set);
int sigaddset(sigset_t *set, int signo);
int sigdelset(sigset_t *set, int signo);
int sigismember(const sigset_t *set, int signo);
int sigignore(int signo);
const char *strsignal(int sig);

View File

@ -10,6 +10,7 @@ MergeObject posix_signal.o :
set_signal_stack.c
sigaction.c
sigaltstack.c
sigignore.cpp
signal.c
sigpending.c
sigprocmask.c

View File

@ -0,0 +1,37 @@
/*
* Copyright 2007, Vasilis Kaoutsis, kaoutsis@sch.gr
* Distributed under the terms of the MIT License.
*/
#include <errno.h>
#include <signal.h>
#include <syscalls.h>
int
sigignore(int signal)
{
// check for invalid signals or for signals
// that can not be ignored (SIGKILL, SIGSTOP)
if (signal <= 0 || signal >= NSIG || signal == SIGKILL
|| signal == SIGSTOP) {
errno = EINVAL;
return -1;
}
struct sigaction ignoreSignalAction;
// create an action to ignore the signal
// request that the signal will be ignored
// by the handler of the action
ignoreSignalAction.sa_handler = SIG_IGN;
ignoreSignalAction.sa_flags = 0;
// In case of SIGCHLD the specification requires SA_NOCLDWAIT behavior.
if (signal == SIGCHLD)
ignoreSignalAction.sa_flags |= SA_NOCLDWAIT;
return sigaction(signal, &ignoreSignalAction, NULL);
}