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