xref: /haiku/src/system/libroot/posix/signal/set_signal_mask.cpp (revision 4466b89c65970de4c7236ac87faa2bee4589f413)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de.
4  * All rights reserved.
5  * Distributed under the terms of the MIT License.
6  */
7 
8 
9 #include <signal.h>
10 
11 #include <errno.h>
12 
13 #include <syscall_utils.h>
14 
15 #include <symbol_versioning.h>
16 #include <syscalls.h>
17 
18 #include <signal_private.h>
19 
20 
21 int
22 __sigprocmask_beos(int how, const sigset_t_beos* beosSet,
23 	sigset_t_beos* beosOldSet)
24 {
25 	RETURN_AND_SET_ERRNO(__pthread_sigmask_beos(how, beosSet, beosOldSet));
26 }
27 
28 
29 int
30 __pthread_sigmask_beos(int how, const sigset_t_beos* beosSet,
31 	sigset_t_beos* beosOldSet)
32 {
33 	// convert new signal set
34 	sigset_t set;
35 	if (beosSet != NULL)
36 		set = from_beos_sigset(*beosSet);
37 
38 	// set the mask
39 	sigset_t oldSet;
40 	status_t error = _kern_set_signal_mask(how, beosSet != NULL ? &set : NULL,
41 		beosOldSet != NULL ? &oldSet : NULL);
42 	if (error != B_OK)
43 		return error;
44 
45 	// convert old signal set back
46 	if (beosOldSet != NULL)
47 		*beosOldSet = to_beos_sigset(oldSet);
48 
49 	return 0;
50 }
51 
52 
53 int
54 __sigprocmask(int how, const sigset_t* set, sigset_t* oldSet)
55 {
56 	RETURN_AND_SET_ERRNO(_kern_set_signal_mask(how, set, oldSet));
57 }
58 
59 
60 int
61 __pthread_sigmask(int how, const sigset_t* set, sigset_t* oldSet)
62 {
63 	return _kern_set_signal_mask(how, set, oldSet);
64 }
65 
66 
67 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigprocmask_beos",
68 	"sigprocmask@", "BASE");
69 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pthread_sigmask_beos",
70 	"pthread_sigmask@", "BASE");
71 
72 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigprocmask", "sigprocmask@@",
73 	"1_ALPHA4");
74 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pthread_sigmask", "pthread_sigmask@@",
75 	"1_ALPHA4");
76