2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 * Copyright (C) 2008 John Crispin <blogic@openwrt.org>
24 #include <sys/types.h>
29 void handler_INT(int signo)
31 log_printf("away we go\n");
35 void handler_CHLD(int signo)
37 while(waitpid(-1, NULL, WNOHANG) > 0);
40 void setup_signals(void)
42 struct sigaction s1, s2, s3;
43 s1.sa_handler = handler_INT;
45 sigaction(SIGINT, &s1, NULL);
46 s2.sa_handler = handler_INT;
48 sigaction(SIGTERM, &s2, NULL);
49 s3.sa_handler = handler_CHLD;
50 s3.sa_flags = SA_RESTART;
51 sigaction(SIGCHLD, &s3, NULL);