1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* 3f08c3bdfSopenharmony_ci * Copyright (c) International Business Machines Corp., 2001 4f08c3bdfSopenharmony_ci * 07/2001 Ported by Wayne Boyer 5f08c3bdfSopenharmony_ci * Copyright (c) 2023 SUSE LLC Avinesh Kumar <avinesh.kumar@suse.com> 6f08c3bdfSopenharmony_ci */ 7f08c3bdfSopenharmony_ci 8f08c3bdfSopenharmony_ci/*\ 9f08c3bdfSopenharmony_ci * [Description] 10f08c3bdfSopenharmony_ci * 11f08c3bdfSopenharmony_ci * Verify that getpgid(2) fails with errno ESRCH when 12f08c3bdfSopenharmony_ci * pid does not match any process. 13f08c3bdfSopenharmony_ci */ 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_ci#include "tst_test.h" 16f08c3bdfSopenharmony_ci 17f08c3bdfSopenharmony_cistatic pid_t unused_pid; 18f08c3bdfSopenharmony_cistatic pid_t neg_pid = -99; 19f08c3bdfSopenharmony_ci 20f08c3bdfSopenharmony_cistatic void setup(void) 21f08c3bdfSopenharmony_ci{ 22f08c3bdfSopenharmony_ci unused_pid = tst_get_unused_pid(); 23f08c3bdfSopenharmony_ci} 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_cistatic void run(void) 26f08c3bdfSopenharmony_ci{ 27f08c3bdfSopenharmony_ci TST_EXP_FAIL2(getpgid(neg_pid), ESRCH, "getpgid(%d)", neg_pid); 28f08c3bdfSopenharmony_ci TST_EXP_FAIL2(getpgid(unused_pid), ESRCH, "getpgid(%d)", unused_pid); 29f08c3bdfSopenharmony_ci} 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_cistatic struct tst_test test = { 32f08c3bdfSopenharmony_ci .setup = setup, 33f08c3bdfSopenharmony_ci .test_all = run 34f08c3bdfSopenharmony_ci}; 35