1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 4 * Author: Richard Logan 5 * Copyright (c) Linux Test Project, 2001-2022 6 */ 7 8 /*\ 9 * [Description] 10 * 11 * Verify that alarms created by alarm() are not inherited by children 12 * created via fork. 13 */ 14 15 #include <stdlib.h> 16 #include "tst_test.h" 17 verify_alarm(void)18static void verify_alarm(void) 19 { 20 pid_t pid; 21 22 TST_EXP_PASS_SILENT(alarm(100)); 23 24 pid = SAFE_FORK(); 25 if (pid == 0) { 26 TST_EXP_PASS(alarm(0), "alarm(0) in child process"); 27 exit(0); 28 } 29 30 TST_EXP_VAL(alarm(0), 100, "alarm(0) in parent process"); 31 } 32 33 static struct tst_test test = { 34 .test_all = verify_alarm, 35 .forks_child = 1, 36 }; 37