xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/wait/wait01.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 2014 Fujitsu Ltd.
4*49cdfc7eSAndroid Build Coastguard Worker  * Author: Zeng Linggang <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker  */
6*49cdfc7eSAndroid Build Coastguard Worker /*\
7*49cdfc7eSAndroid Build Coastguard Worker  * [Description]
8*49cdfc7eSAndroid Build Coastguard Worker  *
9*49cdfc7eSAndroid Build Coastguard Worker  * Check that if the calling process does not have any unwaited-for children
10*49cdfc7eSAndroid Build Coastguard Worker  * wait() will return ECHILD.
11*49cdfc7eSAndroid Build Coastguard Worker  */
12*49cdfc7eSAndroid Build Coastguard Worker 
13*49cdfc7eSAndroid Build Coastguard Worker #include <sys/wait.h>
14*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h>
15*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
16*49cdfc7eSAndroid Build Coastguard Worker 
verify_wait(void)17*49cdfc7eSAndroid Build Coastguard Worker static void verify_wait(void)
18*49cdfc7eSAndroid Build Coastguard Worker {
19*49cdfc7eSAndroid Build Coastguard Worker 	TST_EXP_FAIL2(wait(NULL), ECHILD);
20*49cdfc7eSAndroid Build Coastguard Worker }
21*49cdfc7eSAndroid Build Coastguard Worker 
22*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
23*49cdfc7eSAndroid Build Coastguard Worker 	.test_all = verify_wait,
24*49cdfc7eSAndroid Build Coastguard Worker };
25