1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* 3f08c3bdfSopenharmony_ci * Copyright (c) 2016 Linux Test Project 4f08c3bdfSopenharmony_ci * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz> 5f08c3bdfSopenharmony_ci * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com> 6f08c3bdfSopenharmony_ci */ 7f08c3bdfSopenharmony_ci 8f08c3bdfSopenharmony_ci/*\ 9f08c3bdfSopenharmony_ci * [Description] 10f08c3bdfSopenharmony_ci * 11f08c3bdfSopenharmony_ci * This test checks if select() timeout is not updated when personality with 12f08c3bdfSopenharmony_ci * STICKY_TIMEOUTS is used. 13f08c3bdfSopenharmony_ci */ 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_ci#include "tst_test.h" 16f08c3bdfSopenharmony_ci#include "lapi/personality.h" 17f08c3bdfSopenharmony_ci#include <sys/select.h> 18f08c3bdfSopenharmony_ci 19f08c3bdfSopenharmony_ci#define USEC 10 20f08c3bdfSopenharmony_ci 21f08c3bdfSopenharmony_cistatic void run(void) 22f08c3bdfSopenharmony_ci{ 23f08c3bdfSopenharmony_ci struct timeval tv = { .tv_sec = 0, .tv_usec = USEC }; 24f08c3bdfSopenharmony_ci fd_set rfds; 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_ci FD_ZERO(&rfds); 27f08c3bdfSopenharmony_ci FD_SET(1, &rfds); 28f08c3bdfSopenharmony_ci 29f08c3bdfSopenharmony_ci SAFE_PERSONALITY(PER_LINUX | STICKY_TIMEOUTS); 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_ci TEST(select(2, &rfds, NULL, NULL, &tv)); 32f08c3bdfSopenharmony_ci if (TST_RET == -1) 33f08c3bdfSopenharmony_ci tst_brk(TBROK | TERRNO, "select() error"); 34f08c3bdfSopenharmony_ci 35f08c3bdfSopenharmony_ci SAFE_PERSONALITY(PER_LINUX); 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ci TST_EXP_EQ_LI(tv.tv_usec, USEC); 38f08c3bdfSopenharmony_ci} 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_cistatic struct tst_test test = { 41f08c3bdfSopenharmony_ci .test_all = run, 42f08c3bdfSopenharmony_ci}; 43