robbiew | 0dc0765 | 2005-06-03 16:29:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2003, Intel Corporation. All rights reserved. |
| 3 | * Created by: salwan.searty REMOVE-THIS AT intel DOT com |
| 4 | * This file is licensed under the GPL license. For the full content |
| 5 | * of this license, see the COPYING file at the top level of this |
| 6 | * source tree. |
| 7 | |
| 8 | This program tests the assertion that if signal has been blocked, then |
| 9 | sigset shall return SIG_HOLD |
| 10 | |
| 11 | */ |
| 12 | |
| 13 | #define _XOPEN_SOURCE 600 |
| 14 | |
| 15 | #include <signal.h> |
| 16 | #include <stdio.h> |
| 17 | #include <stdlib.h> |
Rishikesh K Rajak | 95a376d | 2010-03-22 12:07:05 +0530 | [diff] [blame^] | 18 | #include <errno.h> |
| 19 | #include <string.h> |
robbiew | 0dc0765 | 2005-06-03 16:29:48 +0000 | [diff] [blame] | 20 | #include "posixtest.h" |
| 21 | |
Rishikesh K Rajak | 95a376d | 2010-03-22 12:07:05 +0530 | [diff] [blame^] | 22 | int main(void) |
robbiew | 0dc0765 | 2005-06-03 16:29:48 +0000 | [diff] [blame] | 23 | { |
Rishikesh K Rajak | 95a376d | 2010-03-22 12:07:05 +0530 | [diff] [blame^] | 24 | sigset_t st; |
| 25 | sigemptyset(&st); |
| 26 | sigaddset(&st, SIGCHLD); |
robbiew | 0dc0765 | 2005-06-03 16:29:48 +0000 | [diff] [blame] | 27 | |
Rishikesh K Rajak | 95a376d | 2010-03-22 12:07:05 +0530 | [diff] [blame^] | 28 | if (sigprocmask(SIG_BLOCK, &st, NULL) < 0) { |
| 29 | printf("Test FAILED: sigprocmask(): %s\n", strerror(errno)); |
| 30 | return PTS_FAIL; |
| 31 | } |
| 32 | |
| 33 | if (sigset(SIGCHLD, SIG_HOLD) != SIG_HOLD) { |
robbiew | 0dc0765 | 2005-06-03 16:29:48 +0000 | [diff] [blame] | 34 | printf("Test FAILED: sigset() didn't return SIG_HOLD\n"); |
| 35 | return PTS_FAIL; |
| 36 | } |
| 37 | |
| 38 | return PTS_PASS; |
| 39 | } |