-/*
- * Copyright (C) 2007 Andre Noll <maan@systemlinux.org>
+/* Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
+
+/** \file signal.h exported symbols from signal.c */
+
+/**
+ * Task for signal handling.
+ */
+struct signal_task {
+ /** The signal pipe. */
+ int fd;
+ /** The associated task structure. */
+ struct task *task;
+};
+
+/**
+ * Monitor the signal fd for reading.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * \param s The scheduler instance.
+ * \param context Signal task pointer.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This convenience helper is called from several programs which need to handle
+ * signals, including para_server and para_audiod. These programs set up a
+ * signal pipe and a signal task structure, and use this function to tell the
+ * scheduler to monitor the read end of the pipe.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Although the second parameter must be in fact a pointer to a signal_task
+ * structure, the parameter is specified as void * here to match the signature
+ * declared in struct \ref task_info.
*/
+_static_inline_ void signal_pre_monitor(struct sched *s, void *context)
+{
+ struct signal_task *st = context;
+ sched_monitor_readfd(st->fd, s);
+}
-/** \file signal.h exported symbols from signal.c */
-
-int para_signal_init(void);
-int para_install_sighandler(int);
-void para_reap_children(void);
-pid_t para_reap_child(void);
+struct signal_task *signal_init_or_die(void);
+void para_sigaction(int sig, void (*handler)(int));
+void para_install_sighandler(int);
+int para_reap_child(pid_t *pid);
int para_next_signal(void);
+void signal_shutdown(struct signal_task *st);
+void para_block_signal(int sig);
+void para_unblock_signal(int sig);