vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / signal / set_signal_mask.cpp
blob6f3e1e796929c49980e92fff5cf0f52e0a3b26e5
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 */
9 #include <signal.h>
11 #include <errno.h>
13 #include <syscall_utils.h>
15 #include <symbol_versioning.h>
16 #include <syscalls.h>
18 #include <errno_private.h>
19 #include <signal_private.h>
22 int
23 __sigprocmask_beos(int how, const sigset_t_beos* beosSet,
24 sigset_t_beos* beosOldSet)
26 RETURN_AND_SET_ERRNO(__pthread_sigmask_beos(how, beosSet, beosOldSet));
30 int
31 __pthread_sigmask_beos(int how, const sigset_t_beos* beosSet,
32 sigset_t_beos* beosOldSet)
34 // convert new signal set
35 sigset_t set;
36 if (beosSet != NULL)
37 set = from_beos_sigset(*beosSet);
39 // set the mask
40 sigset_t oldSet;
41 status_t error = _kern_set_signal_mask(how, beosSet != NULL ? &set : NULL,
42 beosOldSet != NULL ? &oldSet : NULL);
43 if (error != B_OK)
44 return error;
46 // convert old signal set back
47 if (beosOldSet != NULL)
48 *beosOldSet = to_beos_sigset(oldSet);
50 return 0;
54 int
55 __sigprocmask(int how, const sigset_t* set, sigset_t* oldSet)
57 RETURN_AND_SET_ERRNO(_kern_set_signal_mask(how, set, oldSet));
61 int
62 __pthread_sigmask(int how, const sigset_t* set, sigset_t* oldSet)
64 return _kern_set_signal_mask(how, set, oldSet);
68 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigprocmask_beos",
69 "sigprocmask@", "BASE");
70 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pthread_sigmask_beos",
71 "pthread_sigmask@", "BASE");
73 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigprocmask", "sigprocmask@@",
74 "1_ALPHA4");
75 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__pthread_sigmask", "pthread_sigmask@@",
76 "1_ALPHA4");