1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */ 3f08c3bdfSopenharmony_ci 4f08c3bdfSopenharmony_ci#include "libsigwait.h" 5f08c3bdfSopenharmony_ci 6f08c3bdfSopenharmony_cistatic int my_sigwait(const sigset_t * set, 7f08c3bdfSopenharmony_ci siginfo_t * info LTP_ATTRIBUTE_UNUSED, 8f08c3bdfSopenharmony_ci void *timeout LTP_ATTRIBUTE_UNUSED) 9f08c3bdfSopenharmony_ci{ 10f08c3bdfSopenharmony_ci int ret; 11f08c3bdfSopenharmony_ci int err = sigwait(set, &ret); 12f08c3bdfSopenharmony_ci 13f08c3bdfSopenharmony_ci if (err == 0) 14f08c3bdfSopenharmony_ci return ret; 15f08c3bdfSopenharmony_ci errno = err; 16f08c3bdfSopenharmony_ci return -1; 17f08c3bdfSopenharmony_ci} 18f08c3bdfSopenharmony_ci 19f08c3bdfSopenharmony_cistruct sigwait_test_desc tests[] = { 20f08c3bdfSopenharmony_ci { test_unmasked_matching_noinfo, SIGUSR1}, 21f08c3bdfSopenharmony_ci { test_masked_matching_noinfo, SIGUSR1}, 22f08c3bdfSopenharmony_ci}; 23f08c3bdfSopenharmony_ci 24f08c3bdfSopenharmony_cistatic void run(unsigned int i) 25f08c3bdfSopenharmony_ci{ 26f08c3bdfSopenharmony_ci struct sigwait_test_desc *tc = &tests[i]; 27f08c3bdfSopenharmony_ci 28f08c3bdfSopenharmony_ci tc->tf(my_sigwait, tc->signo, TST_LIBC_TIMESPEC); 29f08c3bdfSopenharmony_ci} 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_cistatic struct tst_test test = { 32f08c3bdfSopenharmony_ci .test= run, 33f08c3bdfSopenharmony_ci .tcnt = ARRAY_SIZE(tests), 34f08c3bdfSopenharmony_ci .setup = sigwait_setup, 35f08c3bdfSopenharmony_ci .forks_child = 1, 36f08c3bdfSopenharmony_ci}; 37