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) International Business Machines Corp., 2001 4*49cdfc7eSAndroid Build Coastguard Worker * 07/2001 Ported by Wayne Boyer 5*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2023 SUSE LLC Avinesh Kumar <[email protected]> 6*49cdfc7eSAndroid Build Coastguard Worker */ 7*49cdfc7eSAndroid Build Coastguard Worker 8*49cdfc7eSAndroid Build Coastguard Worker /*\ 9*49cdfc7eSAndroid Build Coastguard Worker * [Description] 10*49cdfc7eSAndroid Build Coastguard Worker * 11*49cdfc7eSAndroid Build Coastguard Worker * Verify that getpgid(2) fails with errno ESRCH when 12*49cdfc7eSAndroid Build Coastguard Worker * pid does not match any process. 13*49cdfc7eSAndroid Build Coastguard Worker */ 14*49cdfc7eSAndroid Build Coastguard Worker 15*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h" 16*49cdfc7eSAndroid Build Coastguard Worker 17*49cdfc7eSAndroid Build Coastguard Worker static pid_t unused_pid; 18*49cdfc7eSAndroid Build Coastguard Worker static pid_t neg_pid = -99; 19*49cdfc7eSAndroid Build Coastguard Worker setup(void)20*49cdfc7eSAndroid Build Coastguard Workerstatic void setup(void) 21*49cdfc7eSAndroid Build Coastguard Worker { 22*49cdfc7eSAndroid Build Coastguard Worker unused_pid = tst_get_unused_pid(); 23*49cdfc7eSAndroid Build Coastguard Worker } 24*49cdfc7eSAndroid Build Coastguard Worker run(void)25*49cdfc7eSAndroid Build Coastguard Workerstatic void run(void) 26*49cdfc7eSAndroid Build Coastguard Worker { 27*49cdfc7eSAndroid Build Coastguard Worker TST_EXP_FAIL2(getpgid(neg_pid), ESRCH, "getpgid(%d)", neg_pid); 28*49cdfc7eSAndroid Build Coastguard Worker TST_EXP_FAIL2(getpgid(unused_pid), ESRCH, "getpgid(%d)", unused_pid); 29*49cdfc7eSAndroid Build Coastguard Worker } 30*49cdfc7eSAndroid Build Coastguard Worker 31*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = { 32*49cdfc7eSAndroid Build Coastguard Worker .setup = setup, 33*49cdfc7eSAndroid Build Coastguard Worker .test_all = run 34*49cdfc7eSAndroid Build Coastguard Worker }; 35