1 /* 2 * Copyright 2002-2011, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Author: 6 * Daniel Reinhold, danielre@users.sf.net 7 * Ingo Weinhold, ingo_weinhold@gmx.de 8 */ 9 10 11 #include <signal.h> 12 13 #include <errno.h> 14 15 #include <signal_defs.h> 16 #include <syscalls.h> 17 18 #include <symbol_versioning.h> 19 20 #include <signal_private.h> 21 22 23 // #pragma - backward compatibility implementations 24 25 26 int 27 __sigemptyset_beos(sigset_t_beos* set) 28 { 29 *set = (sigset_t_beos)0; 30 return 0; 31 } 32 33 34 int 35 __sigfillset_beos(sigset_t_beos* set) 36 { 37 *set = ~(sigset_t_beos)0; 38 return 0; 39 } 40 41 42 int 43 __sigismember_beos(const sigset_t_beos* set, int signal) 44 { 45 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) { 46 errno = EINVAL; 47 return -1; 48 } 49 50 return (*set & SIGNAL_TO_MASK(signal)) != 0 ? 1 : 0; 51 } 52 53 54 int 55 __sigaddset_beos(sigset_t_beos* set, int signal) 56 { 57 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) { 58 errno = EINVAL; 59 return -1; 60 } 61 62 *set |= SIGNAL_TO_MASK(signal); 63 return 0; 64 } 65 66 67 int 68 __sigdelset_beos(sigset_t_beos* set, int signal) 69 { 70 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER_BEOS) { 71 errno = EINVAL; 72 return -1; 73 } 74 75 *set &= ~SIGNAL_TO_MASK(signal); 76 return 0; 77 } 78 79 80 // #pragma - current implementations 81 82 83 int 84 __sigemptyset(sigset_t* set) 85 { 86 *set = (sigset_t)0; 87 return 0; 88 } 89 90 91 int 92 __sigfillset(sigset_t* set) 93 { 94 *set = ~(sigset_t)0; 95 return 0; 96 } 97 98 99 int 100 __sigismember(const sigset_t* set, int signal) 101 { 102 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) { 103 errno = EINVAL; 104 return -1; 105 } 106 107 return (*set & SIGNAL_TO_MASK(signal)) != 0 ? 1 : 0; 108 } 109 110 111 int 112 __sigaddset(sigset_t* set, int signal) 113 { 114 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) { 115 errno = EINVAL; 116 return -1; 117 } 118 119 *set |= SIGNAL_TO_MASK(signal); 120 return 0; 121 } 122 123 124 int 125 __sigdelset(sigset_t* set, int signal) 126 { 127 if (signal <= 0 || signal > MAX_SIGNAL_NUMBER) { 128 errno = EINVAL; 129 return -1; 130 } 131 132 *set &= ~SIGNAL_TO_MASK(signal); 133 return 0; 134 } 135 136 137 // #pragma - versioned symbols 138 139 140 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigemptyset_beos", "sigemptyset@", 141 "BASE"); 142 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigfillset_beos", "sigfillset@", 143 "BASE"); 144 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigismember_beos", "sigismember@", 145 "BASE"); 146 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigaddset_beos", "sigaddset@", "BASE"); 147 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigdelset_beos", "sigdelset@", "BASE"); 148 149 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigemptyset", "sigemptyset@@", 150 "1_ALPHA4"); 151 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigfillset", "sigfillset@@", 152 "1_ALPHA4"); 153 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigismember", "sigismember@@", 154 "1_ALPHA4"); 155 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigaddset", "sigaddset@@", "1_ALPHA4"); 156 DEFINE_LIBROOT_KERNEL_SYMBOL_VERSION("__sigdelset", "sigdelset@@", "1_ALPHA4"); 157