Changes in uspace/lib/posix/signal.h [3f466c33:491e1ee] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/signal.h
r3f466c33 r491e1ee 37 37 38 38 #include "libc/errno.h" 39 #include "sys/types.h"40 39 41 extern void __posix_default_signal_handler(int signo); 42 extern void __posix_hold_signal_handler(int signo); 43 extern void __posix_ignore_signal_handler(int signo); 40 /* HelenOS doesn't have signals, so calls to functions of this header 41 * are just replaced with their respective failure return value. 42 * 43 * Other macros and constants are here just to satisfy the symbol resolver 44 * and have no practical value whatsoever, until HelenOS implements some 45 * equivalent of signals. Maybe something neat based on IPC will be devised 46 * in the future? 47 */ 44 48 45 49 #undef SIG_DFL 46 #define SIG_DFL ((void (*)(int)) __posix_default_signal_handler)50 #define SIG_DFL ((void (*)(int)) 0) 47 51 #undef SIG_ERR 48 #define SIG_ERR ((void (*)(int)) NULL) 49 #undef SIG_HOLD 50 #define SIG_HOLD ((void (*)(int)) __posix_hold_signal_handler) 52 #define SIG_ERR ((void (*)(int)) 0) 51 53 #undef SIG_IGN 52 #define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler) 54 #define SIG_IGN ((void (*)(int)) 0) 55 56 #define signal(sig,func) (errno = ENOTSUP, SIG_ERR) 57 #define raise(sig) ((int) -1) 53 58 54 59 typedef int posix_sig_atomic_t; 55 typedef uint32_t posix_sigset_t;56 typedef struct posix_mcontext {57 // FIXME: should not be empty to avoid compiler warnings (-pedantic)58 int dummy;59 } posix_mcontext_t;60 61 union posix_sigval {62 int sival_int;63 void *sival_ptr;64 };65 66 struct posix_sigevent {67 int sigev_notify; /* Notification type. */68 int sigev_signo; /* Signal number. */69 union posix_sigval sigev_value; /* Signal value. */70 void (*sigev_notify_function)(union posix_sigval); /* Notification function. */71 posix_thread_attr_t *sigev_notify_attributes; /* Notification attributes. */72 };73 74 typedef struct {75 int si_signo;76 int si_code;77 78 int si_errno;79 80 posix_pid_t si_pid;81 posix_uid_t si_uid;82 void *si_addr;83 int si_status;84 85 long si_band;86 87 union posix_sigval si_value;88 } posix_siginfo_t;89 90 struct posix_sigaction {91 void (*sa_handler)(int);92 posix_sigset_t sa_mask;93 int sa_flags;94 void (*sa_sigaction)(int, posix_siginfo_t *, void *);95 };96 97 typedef struct {98 void *ss_sp;99 size_t ss_size;100 int ss_flags;101 } posix_stack_t;102 103 typedef struct posix_ucontext {104 struct posix_ucontext *uc_link;105 posix_sigset_t uc_sigmask;106 posix_stack_t uc_stack;107 posix_mcontext_t uc_mcontext;108 } posix_ucontext_t;109 110 111 /* Values of posix_sigevent::sigev_notify */112 #undef SIGEV_NONE113 #undef SIGEV_SIGNAL114 #undef SIGEV_THREAD115 #define SIGEV_NONE 0116 #define SIGEV_SIGNAL 0117 #define SIGEV_THREAD 0118 119 #undef SIGRT_MIN120 #undef SIGRT_MAX121 #define SIGRT_MIN 0122 #define SIGRT_MAX 0123 124 #undef SIG_BLOCK125 #undef SIG_UNBLOCK126 #undef SIG_SETMASK127 #define SIG_BLOCK 0128 #define SIG_UNBLOCK 1129 #define SIG_SETMASK 2130 131 #undef SA_NOCLDSTOP132 #undef SA_ONSTACK133 #undef SA_RESETHAND134 #undef SA_RESTART135 #undef SA_SIGINFO136 #undef SA_NOCLDWAIT137 #undef SA_NODEFER138 #define SA_NOCLDSTOP (1 << 0)139 #define SA_ONSTACK (1 << 1)140 #define SA_RESETHAND (1 << 2)141 #define SA_RESTART (1 << 3)142 #define SA_SIGINFO (1 << 4)143 #define SA_NOCLDWAIT (1 << 5)144 #define SA_NODEFER (1 << 6)145 146 #undef SS_ONSTACK147 #undef SS_DISABLE148 #define SS_ONSTACK 0149 #define SS_DISABLE 0150 151 #undef MINSIGSTKSZ152 #undef SIGSTKSZ153 #define MINSIGSTKSZ 0154 #define SIGSTKSZ 0155 60 156 61 /* full POSIX set */ 157 62 enum { 158 /* Termination Signals */159 63 SIGABRT, 64 SIGALRM, 65 SIGBUS, 66 SIGCHLD, 67 SIGCONT, 68 SIGFPE, 69 SIGHUP, 70 SIGILL, 71 SIGINT, 72 SIGKILL, 73 SIGPIPE, 160 74 SIGQUIT, 161 SIGINT, 75 SIGSEGV, 76 SIGSTOP, 162 77 SIGTERM, 163 164 /* Child Signal */165 SIGCHLD,166 167 /* User signals */168 SIGUSR1,169 SIGUSR2,170 171 /* Timer */172 SIGALRM,173 SIGVTALRM,174 SIGPROF, /* obsolete */175 176 _TOP_CATCHABLE_SIGNAL = SIGPROF,177 178 /* Process Scheduler Interaction - not supported */179 SIGSTOP,180 SIGCONT,181 182 /* Process Termination - can't be caught */183 SIGKILL,184 185 _TOP_SENDABLE_SIGNAL = SIGKILL,186 187 /* Hardware Exceptions - can't be caught or sent */188 SIGFPE,189 SIGBUS,190 SIGILL,191 SIGSEGV,192 193 /* Other Exceptions - not supported */194 SIGSYS,195 SIGXCPU,196 SIGXFSZ,197 198 /* Debugging - not supported */199 SIGTRAP,200 201 /* Communication Signals - not supported */202 SIGHUP,203 SIGPIPE,204 SIGPOLL, /* obsolete */205 SIGURG,206 207 /* Terminal Signals - not supported */208 78 SIGTSTP, 209 79 SIGTTIN, 210 80 SIGTTOU, 211 212 _TOP_SIGNAL = SIGTTOU 81 SIGUSR1, 82 SIGUSR2, 83 SIGPOLL, 84 SIGPROF, 85 SIGSYS, 86 SIGTRAP, 87 SIGURG, 88 SIGVTALRM, 89 SIGXCPU, 90 SIGXFSZ 213 91 }; 214 215 /* Values for sigaction field si_code. */216 217 enum {218 SI_USER,219 SI_QUEUE,220 SI_TIMER,221 SI_ASYNCIO,222 SI_MESGQ,223 ILL_ILLOPC,224 ILL_ILLOPN,225 ILL_ILLADR,226 ILL_ILLTRP,227 ILL_PRVOPC,228 ILL_PRVREG,229 ILL_COPROC,230 ILL_BADSTK,231 FPE_INTDIV,232 FPE_INTOVF,233 FPE_FLTDIV,234 FPE_FLTOVF,235 FPE_FLTUND,236 FPE_FLTRES,237 FPE_FLTINV,238 FPE_FLTSUB,239 SEGV_MAPERR,240 SEGV_ACCERR,241 BUS_ADRALN,242 BUS_ADRERR,243 BUS_OBJERR,244 TRAP_BRKPT,245 TRAP_TRACE,246 CLD_EXITED,247 CLD_KILLED,248 CLD_DUMPED,249 CLD_TRAPPED,250 CLD_STOPPED,251 CLD_CONTINUED,252 POLL_IN,253 POLL_OUT,254 POLL_MSG,255 POLL_ERR,256 POLL_PRI,257 POLL_HUP258 };259 260 extern int posix_sigaction(int sig, const struct posix_sigaction *restrict act,261 struct posix_sigaction *restrict oact);262 263 extern void (*posix_signal(int sig, void (*func)(int)))(int);264 extern int posix_raise(int sig);265 extern int posix_kill(posix_pid_t pid, int sig);266 extern int posix_killpg(posix_pid_t pid, int sig);267 268 extern void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message);269 extern void posix_psignal(int signum, const char *message);270 271 extern int posix_sigemptyset(posix_sigset_t *set);272 extern int posix_sigfillset(posix_sigset_t *set);273 extern int posix_sigaddset(posix_sigset_t *set, int signo);274 extern int posix_sigdelset(posix_sigset_t *set, int signo);275 extern int posix_sigismember(const posix_sigset_t *set, int signo);276 277 extern int posix_thread_sigmask(int how, const posix_sigset_t *restrict set,278 posix_sigset_t *restrict oset);279 extern int posix_sigprocmask(int how, const posix_sigset_t *restrict set,280 posix_sigset_t *restrict oset);281 92 282 93 #ifndef LIBPOSIX_INTERNAL 283 94 #define sig_atomic_t posix_sig_atomic_t 284 #define sigset_t posix_sigset_t285 #define sigval posix_sigval286 #ifndef sigevent287 #define sigevent posix_sigevent288 #endif289 #define sigaction posix_sigaction290 #define mcontext_t posix_mcontext_t291 #define ucontext_t posix_ucontext_t292 #define stack_t posix_stack_t293 #define siginfo_t posix_siginfo_t294 295 #define signal posix_signal296 #define raise posix_raise297 #define kill posix_kill298 #define killpg posix_killpg299 300 #define psiginfo posix_psiginfo301 #define psignal posix_psignal302 303 #define sigemptyset posix_sigemptyset304 #define sigfillset posix_sigfillset305 #define sigaddset posix_sigaddset306 #define sigdelset posix_sigdelset307 #define sigismember posix_sigismember308 309 #define pthread_sigmask posix_thread_sigmask310 #define sigprocmask posix_sigprocmask311 95 #endif 312 96
Note:
See TracChangeset
for help on using the changeset viewer.