2 /* Copyright (C) 2003 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
40 sigemptyset (&sa.sa_mask);
41 sa.sa_flags = SA_RESETHAND;
42 sigaction (SIGCHLD, NULL, NULL);
43 if (sigaction (SIGCHLD, &sa, NULL) < 0)
45 printf ("sigaction set failed: %m\n");
48 if (raise (SIGCHLD) < 0)
50 printf ("first raise failed: %m\n");
53 if (raise (SIGCHLD) < 0)
55 printf ("second raise failed: %m\n");
60 printf ("signal handler not called 1 times\n");
63 if (sigaction (SIGCHLD, NULL, &sa) < 0)
65 printf ("sigaction get failed: %m\n");
68 if (sa.sa_handler != SIG_DFL)
70 printf ("sigaction retrieved sa_handler: %p\n", sa.sa_handler);
73 /* `SA_RESTORER' gets set on `glibc-2.3.4-2.25.i686'
74 but not on `glibc-2.5-7.i686'. */
76 #define SA_RESTORER 0x04000000
78 if ((sa.sa_flags & ~SA_RESTORER) != SA_RESETHAND)
80 printf ("sigaction retrieved sa_flags: 0x%x\n", sa.sa_flags);