xref: /haiku/headers/private/kernel/ksignal.h (revision cbed190f71b8aff814bf95539c39a1bcfb953ed8)
1 /*
2  * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _KERNEL_SIGNAL_H
6 #define _KERNEL_SIGNAL_H
7 
8 
9 #include <KernelExport.h>
10 #include <signal.h>
11 
12 
13 namespace BKernel {
14 	struct Thread;
15 }
16 
17 using BKernel::Thread;
18 
19 
20 #define KILL_SIGNALS	((1L << (SIGKILL - 1)) | (1L << (SIGKILLTHR - 1)))
21 
22 #define SIGNAL_TO_MASK(signal)	(1LL << (signal - 1))
23 
24 // additional send_signal_etc() flag
25 #define SIGNAL_FLAG_TEAMS_LOCKED			(0x10000)
26 	// interrupts are disabled and team lock is held
27 #define SIGNAL_FLAG_DONT_RESTART_SYSCALL	(0x20000)
28 
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 extern bool handle_signals(Thread *thread);
35 extern bool is_kill_signal_pending(void);
36 extern int has_signals_pending(void *_thread);
37 extern bool is_signal_blocked(int signal);
38 
39 extern void update_current_thread_signals_flag();
40 
41 extern int sigaction_etc(thread_id threadID, int signal,
42 	const struct sigaction *newAction, struct sigaction *oldAction);
43 
44 extern status_t _user_send_signal(pid_t tid, uint sig);
45 extern status_t _user_sigprocmask(int how, const sigset_t *set,
46 	sigset_t *oldSet);
47 extern status_t _user_sigaction(int sig, const struct sigaction *newAction,
48 	struct sigaction *oldAction);
49 extern bigtime_t _user_set_alarm(bigtime_t time, uint32 mode);
50 extern status_t _user_sigwait(const sigset_t *set, int *_signal);
51 extern status_t _user_sigsuspend(const sigset_t *mask);
52 extern status_t _user_sigpending(sigset_t *set);
53 extern status_t _user_set_signal_stack(const stack_t *newUserStack,
54 	stack_t *oldUserStack);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif	/* _KERNEL_SIGNAL_H */
61