Merge branch 'refs/heads/t/duration-keyword' into pu
[paraslash.git] / signal.h
1 /* Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
2
3 /** \file signal.h exported symbols from signal.c */
4
5 /**
6 * Task for signal handling.
7 */
8 struct signal_task {
9 /** The signal pipe. */
10 int fd;
11 /** The associated task structure. */
12 struct task *task;
13 };
14
15 /**
16 * A generic pre-select method for signal tasks.
17 *
18 * \param s Passed to para_fd_set().
19 * \param context Signal task pointer.
20 *
21 * This convenience helper is called from several programs which need to handle
22 * signals, including para_server and para_audiod. These programs define a
23 * signal task structure and set its ->pre_select method to this function which
24 * adds the file descriptor of the signal task to the set of descriptors to be
25 * watched in the next select() call.
26 *
27 * Although the second parameter must be in fact a pointer to a signal_task
28 * structure, the parameter is specified as void * here to match the
29 * ->pre_select method of struct task.
30 */
31 _static_inline_ void signal_pre_select(struct sched *s, void *context)
32 {
33 struct signal_task *st = context;
34 para_fd_set(st->fd, &s->rfds, &s->max_fileno);
35 }
36
37 struct signal_task *signal_init_or_die(void);
38 void para_sigaction(int sig, void (*handler)(int));
39 void para_install_sighandler(int);
40 int para_reap_child(pid_t *pid);
41 int para_next_signal(fd_set *rfds);
42 void signal_shutdown(struct signal_task *st);
43 void para_block_signal(int sig);
44 void para_unblock_signal(int sig);