1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 4 * Copyright (c) Linux Test Project, 2003-2023 5 * 6 * Author: William Roske 7 * CO-PILOT: Dave Fenner 8 */ 9 10 /*\ 11 * [Description] 12 * 13 * Check the basic functionality of the setgroups() system call. 14 */ 15 16 #include "tst_test.h" 17 #include "compat_tst_16.h" 18 19 static int len = NGROUPS; 20 21 static GID_T list[NGROUPS]; 22 verify_setgroups(void)23static void verify_setgroups(void) 24 { 25 TST_EXP_POSITIVE(SETGROUPS(1, list), "setgroups()"); 26 } 27 setup(void)28static void setup(void) 29 { 30 len = GETGROUPS(NGROUPS, list); 31 if (len < 0) 32 tst_brk(TBROK | TERRNO, "getgroups() Failed"); 33 } 34 35 static struct tst_test test = { 36 .test_all = verify_setgroups, 37 .setup = setup, 38 .needs_root = 1, 39 }; 40