xref: /haiku/src/system/libroot/posix/signal/sigignore.cpp (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /*
2  * Copyright 2007, Vasilis Kaoutsis, kaoutsis@sch.gr
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <signal.h>
8 
9 
10 int
11 sigignore(int signal)
12 {
13 	struct sigaction ignoreSignalAction;
14 		// create an action to ignore the signal
15 
16 	// request that the signal will be ignored
17 	// by the handler of the action
18 	ignoreSignalAction.sa_handler = SIG_IGN;
19 	ignoreSignalAction.sa_flags = 0;
20 
21 	// In case of SIGCHLD the specification requires SA_NOCLDWAIT behavior.
22 	if (signal == SIGCHLD)
23 		ignoreSignalAction.sa_flags |= SA_NOCLDWAIT;
24 
25 	return sigaction(signal, &ignoreSignalAction, NULL);
26 }
27