xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/getsid/getsid02.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *   Copyright (c) International Business Machines  Corp., 2001
4  *   Copyright (c) 2012 Cyril Hrubis <[email protected]>
5  *   Copyright (c) 2022 SUSE LLC Avinesh Kumar <[email protected]>
6  */
7 
8 /*\
9  * [Description]
10  *
11  * Verify that getsid(2) fails with ESRCH errno when there is no
12  * process found with process ID pid.
13  */
14 
15 #include "tst_test.h"
16 
run(void)17 static void run(void)
18 {
19 	pid_t unused_pid;
20 	unused_pid = tst_get_unused_pid();
21 
22 	TST_EXP_FAIL(getsid(unused_pid), ESRCH);
23 }
24 
25 static struct tst_test test = {
26 	.test_all = run
27 };
28