10dc076565f772bb1953209fb69ea150b494aaa40robbiew/*
20dc076565f772bb1953209fb69ea150b494aaa40robbiew * Copyright (c) 2003, Intel Corporation. All rights reserved.
30dc076565f772bb1953209fb69ea150b494aaa40robbiew * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
40dc076565f772bb1953209fb69ea150b494aaa40robbiew * This file is licensed under the GPL license.  For the full content
52c28215423293e443469a07ae7011135d058b671Garrett Cooper * of this license, see the COPYING file at the top level of this
60dc076565f772bb1953209fb69ea150b494aaa40robbiew * source tree.
70dc076565f772bb1953209fb69ea150b494aaa40robbiew
80dc076565f772bb1953209fb69ea150b494aaa40robbiew This program tests the assertion that if signal has been blocked, then
90dc076565f772bb1953209fb69ea150b494aaa40robbiew sigset shall return SIG_HOLD
100dc076565f772bb1953209fb69ea150b494aaa40robbiew
110dc076565f772bb1953209fb69ea150b494aaa40robbiew*/
120dc076565f772bb1953209fb69ea150b494aaa40robbiew
130dc076565f772bb1953209fb69ea150b494aaa40robbiew#define _XOPEN_SOURCE 600
140dc076565f772bb1953209fb69ea150b494aaa40robbiew
150dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <signal.h>
160dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdio.h>
170dc076565f772bb1953209fb69ea150b494aaa40robbiew#include <stdlib.h>
1895a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak#include <errno.h>
1995a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak#include <string.h>
200dc076565f772bb1953209fb69ea150b494aaa40robbiew#include "posixtest.h"
210dc076565f772bb1953209fb69ea150b494aaa40robbiew
2295a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajakint main(void)
230dc076565f772bb1953209fb69ea150b494aaa40robbiew{
2495a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak	sigset_t st;
2595a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak	sigemptyset(&st);
2695a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak	sigaddset(&st, SIGCHLD);
270dc076565f772bb1953209fb69ea150b494aaa40robbiew
2895a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak	if (sigprocmask(SIG_BLOCK, &st, NULL) < 0) {
2995a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak		printf("Test FAILED: sigprocmask(): %s\n", strerror(errno));
3095a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak		return PTS_FAIL;
3195a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak	}
3295a376d4e50acd0c90bf749060a1974338a082a9Rishikesh K Rajak
33354ebb48db8e66a853a58379a4808d5dcd1ceac3Wanlong Gao	if (sigset(SIGCHLD, SIG_HOLD) != SIG_HOLD) {
340dc076565f772bb1953209fb69ea150b494aaa40robbiew		printf("Test FAILED: sigset() didn't return SIG_HOLD\n");
350dc076565f772bb1953209fb69ea150b494aaa40robbiew		return PTS_FAIL;
360dc076565f772bb1953209fb69ea150b494aaa40robbiew	}
370dc076565f772bb1953209fb69ea150b494aaa40robbiew
380dc076565f772bb1953209fb69ea150b494aaa40robbiew	return PTS_PASS;
39ec6edca7aa42b6affd989ef91b5897f96795e40fChris Dearman}
40