xref: /haiku/src/system/libroot/posix/signal/sigsuspend.cpp (revision c80809a3ab0b0a2ce53ea861a2b00ace24ff452d)
1 /*
2  * Copyright 2005-2011, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Author(s):
6  *		Jérôme Duval
7  *		Ingo Weinhold, ingo_weinhold@gmx.de
8  */
9 
10 
11 #include <signal.h>
12 
13 #include <errno.h>
14 #include <pthread.h>
15 
16 #include <syscall_utils.h>
17 
18 #include <symbol_versioning.h>
19 #include <syscalls.h>
20 
21 #include <signal_private.h>
22 
23 
24 int
25 __sigsuspend_beos(const sigset_t_beos* beosMask)
26 {
27 	sigset_t mask = from_beos_sigset(*beosMask);
28 	return __sigsuspend(&mask);
29 }
30 
31 
32 int
33 __sigsuspend(const sigset_t* mask)
34 {
35 	errno = _kern_sigsuspend(mask);
36 
37 	pthread_testcancel();
38 
39 	return -1;
40 }
41 
42 
43 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigsuspend_beos", "sigsuspend@",
44 	"BASE");
45 
46 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigsuspend", "sigsuspend@@",
47 	"1_ALPHA4");
48