Home | History | Annotate | Download | only in sigprocmask
      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  Attempt to add SIGKILL and SIGSTOP to the process's signal mask and
      9  verify that:
     10  - They do not get added.
     11  - sigprocmask() does not return -1.
     12 */
     13 
     14 #include <signal.h>
     15 #include <stdio.h>
     16 #include "posixtest.h"
     17 
     18 int main(void)
     19 {
     20 	sigset_t set1, set2;
     21 	int sigprocmask_return_val = 1;
     22 
     23 	sigemptyset(&set1);
     24 	sigemptyset(&set2);
     25 	sigaddset(&set1, SIGKILL);
     26 	sigaddset(&set1, SIGSTOP);
     27 	sigprocmask_return_val = sigprocmask(SIG_SETMASK, &set1, NULL);
     28 	sigprocmask(SIG_SETMASK, NULL, &set2);
     29 
     30 	if (sigismember(&set2, SIGKILL)) {
     31 		printf("FAIL: SIGKILL was added to the signal mask\n");
     32 		return PTS_FAIL;
     33 	}
     34 	if (sigismember(&set2, SIGSTOP)) {
     35 		printf("FAIL: SIGSTOP was added to the signal mask\n");
     36 		return PTS_FAIL;
     37 	}
     38 	if (sigprocmask_return_val == -1) {
     39 		printf
     40 		    ("FAIL: sigprocmask returned -1. System should be able to enforce blocking un-ignorable signals without causing sigprocmask() to return -1.\n");
     41 		return PTS_FAIL;
     42 	}
     43 
     44 	printf("Test PASSED\n");
     45 	return PTS_PASS;
     46 }
     47