1 /*
2 * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
4 * Distributed under the terms of the MIT License.
5 */
6
7
8 #include <signal.h>
9
10 #include <pthread.h>
11
12 #include <symbol_versioning.h>
13
14 #include <syscalls.h>
15
16 #include <signal_private.h>
17
18
19 int
__sigwait_beos(const sigset_t_beos * beosSet,int * _signal)20 __sigwait_beos(const sigset_t_beos* beosSet, int* _signal)
21 {
22 // convert the given signal set and call the current version
23 sigset_t set = from_beos_sigset(*beosSet);
24 int error = __sigwait(&set, _signal);
25 if (error != 0)
26 return error;
27
28 // translate SIGBUS to SIGSEGV
29 if (*_signal == SIGBUS)
30 *_signal = SIGSEGV;
31
32 return 0;
33 }
34
35
36 int
__sigwait(const sigset_t * set,int * _signal)37 __sigwait(const sigset_t* set, int* _signal)
38 {
39 siginfo_t info;
40 status_t error = _kern_sigwait(set, &info, 0, 0);
41
42 pthread_testcancel();
43
44 if (error != B_OK)
45 return error;
46
47 *_signal = info.si_signo;
48 return 0;
49 }
50
51
52 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigwait_beos", "sigwait@", "BASE");
53
54 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigwait", "sigwait@@", "1_ALPHA4");
55