1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) Crackerjack Project., 2007 4 * Copyright (c) Manas Kumar Nayak maknayak@in.ibm.com> 5 * Copyright (C) 2021 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com> 6 */ 7 8/*\ 9 * [Description] 10 * 11 * Test that waitid() fails with ECHILD with process that is not child of the 12 * current process. We fork() one child just to be sure that there are unwaited 13 * for children available while the test runs. 14 */ 15 16#include <stdlib.h> 17#include <sys/wait.h> 18#include "tst_test.h" 19 20static siginfo_t *infop; 21 22static void run(void) 23{ 24 if (!SAFE_FORK()) 25 exit(0); 26 27 TST_EXP_FAIL(waitid(P_PID, 1, infop, WEXITED), ECHILD); 28} 29 30static struct tst_test test = { 31 .test_all = run, 32 .forks_child = 1, 33 .bufs = (struct tst_buffers[]) { 34 {&infop, .size = sizeof(*infop)}, 35 {} 36 } 37}; 38