OSDN Git Service

Make run-test.sh POSIXly-portable
[yash/yash.git] / sig.h
1 /* Yash: yet another shell */
2 /* sig.h: signal handling */
3 /* (C) 2007-2016 magicant */
4
5 /* This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18
19 #ifndef YASH_SIG_H
20 #define YASH_SIG_H
21
22 #include <stddef.h>
23 #include <sys/types.h>
24 #include "xgetopt.h"
25
26
27 extern _Bool process_exists(pid_t pid);
28 extern const wchar_t *get_signal_name(int signum)
29     __attribute__((const));
30 extern int get_signal_number(const wchar_t *name)
31     __attribute__((nonnull,pure));
32 extern int get_signal_number_toupper(wchar_t *name)
33     __attribute__((nonnull));
34
35 extern _Bool any_trap_set;
36
37 extern void init_signal(void);
38 extern void set_signals(void);
39 extern void restore_signals(_Bool leave);
40 extern void reset_job_signals(void);
41 extern void set_interruptible_by_sigint(_Bool onoff);
42 extern void ignore_sigquit_and_sigint(void);
43 extern void ignore_sigtstp(void);
44 extern void stop_myself(void);
45
46 extern void handle_signals(void);
47 extern int wait_for_sigchld(_Bool interruptible, _Bool return_on_trap);
48
49 enum wait_for_input_T {
50     W_READY, W_TIMED_OUT, W_INTERRUPTED, W_ERROR,
51 };
52
53 extern enum wait_for_input_T wait_for_input(int fd, _Bool trap, int timeout);
54
55 extern int handle_traps(void);
56 extern void execute_exit_trap(void);
57 extern void clear_exit_trap(void);
58 extern void phantomize_traps(void);
59 extern _Bool is_interrupted(void);
60 extern void set_laststatus_if_interrupted(void);
61 extern void set_interrupted(void);
62 #if YASH_ENABLE_LINEEDIT
63 extern void reset_sigwinch(void);
64 #endif
65
66 extern int trap_builtin(int argc, void **argv)
67     __attribute__((nonnull));
68 #if YASH_ENABLE_HELP
69 extern const char trap_help[], trap_syntax[];
70 #endif
71 extern const struct xgetopt_T trap_options[];
72
73 extern int kill_builtin(int argc, void **argv)
74     __attribute__((nonnull));
75 #if YASH_ENABLE_HELP
76 extern const char kill_help[], kill_syntax[];
77 #endif
78
79 #if HAVE_STRSIGNAL && !defined(strsignal)
80 extern char *strsignal(int signum);
81 #endif
82
83
84 #endif /* YASH_SIG_H */
85
86
87 /* vim: set ts=8 sts=4 sw=4 noet tw=80: */