Merge topic branch t/ff-compat into master
[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 * Monitor the signal fd for reading.
17 *
18 * \param s The scheduler instance.
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 set up a
23 * signal pipe and a signal task structure, and use this function to tell the
24 * scheduler to monitor the read end of the pipe.
25 *
26 * Although the second parameter must be in fact a pointer to a signal_task
27 * structure, the parameter is specified as void * here to match the signature
28 * declared in struct \ref task_info.
29 */
30 _static_inline_ void signal_pre_monitor(struct sched *s, void *context)
31 {
32 struct signal_task *st = context;
33 sched_monitor_readfd(st->fd, s);
34 }
35
36 struct signal_task *signal_init_or_die(void);
37 void para_sigaction(int sig, void (*handler)(int));
38 void para_install_sighandler(int);
39 int para_reap_child(pid_t *pid);
40 int para_next_signal(void);
41 void signal_shutdown(struct signal_task *st);
42 void para_block_signal(int sig);
43 void para_unblock_signal(int sig);