Lines Matching +full:signal +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <signal.h>
88 diff = end.tv_usec - start.tv_usec; in check_diff()
89 diff += (end.tv_sec - start.tv_sec) * USEC_PER_SEC; in check_diff()
91 if (llabs(diff - DELAY * USEC_PER_SEC) > USEC_PER_SEC / 2) { in check_diff()
93 return -1; in check_diff()
109 signal(SIGVTALRM, sig_handler); in check_itimer()
111 signal(SIGPROF, sig_handler); in check_itimer()
113 signal(SIGALRM, sig_handler); in check_itimer()
140 timer_t id; in check_timer_create() local
144 if (timer_create(which, NULL, &id) < 0) in check_timer_create()
147 if (signal(SIGALRM, sig_handler) == SIG_ERR) in check_timer_create()
148 fatal_error(name, "signal()"); in check_timer_create()
153 if (timer_settime(id, 0, &val, NULL) < 0) in check_timer_create()
172 ctd_count--; in ctd_sighandler()
183 timer_t id; in ctd_thread_func() local
189 if (timer_create(CLOCK_PROCESS_CPUTIME_ID, NULL, &id)) in ctd_thread_func()
191 if (timer_settime(id, 0, &val, NULL)) in ctd_thread_func()
196 if (timer_delete(id)) in ctd_thread_func()
203 * Test that only the running thread receives the timer signal.
207 if (signal(SIGALRM, ctd_sighandler) == SIG_ERR) in check_timer_distribution()
208 fatal_error(NULL, "signal()"); in check_timer_distribution()
217 ksft_test_result_pass("check signal distribution\n"); in check_timer_distribution()
219 ksft_test_result_fail("check signal distribution\n"); in check_timer_distribution()
221 ksft_test_result_skip("check signal distribution (old kernel)\n"); in check_timer_distribution()
231 struct tmrsig *tsig = si ? si->si_ptr : NULL; in siginfo_handler()
234 tsig->signals++; in siginfo_handler()
235 tsig->overruns += si->si_overrun; in siginfo_handler()
280 /* Block the signal */ in check_sig_ign()
307 /* Set the signal to be ignored */ in check_sig_ign()
308 if (signal(SIGUSR1, SIG_IGN) == SIG_ERR) in check_sig_ign()
309 fatal_error(NULL, "signal(SIG_IGN)"); in check_sig_ign()
314 /* Stop the thread first. No signal should be delivered to it */ in check_sig_ign()
327 /* Unblock it, which should deliver the signal in the !thread case*/ in check_sig_ign()
358 /* Block the signal */ in check_rearm()
389 /* Unblock it, which should not deliver a signal */ in check_rearm()
414 /* Block the signal */ in check_delete()
440 /* Unblock it, which should not deliver a signal */ in check_delete()
451 diff = NSEC_PER_SEC * (int64_t)((int) t1.tv_sec - (int) t2.tv_sec); in calcdiff_ns()
452 diff += ((int) t1.tv_nsec - (int) t2.tv_nsec); in calcdiff_ns()
503 /* Block the signal */ in check_gettime()
563 /* Block the signal */ in check_overrun()
592 /* Unblock it, which should deliver a signal */ in check_overrun()
605 static int do_timer_create(int *id) in do_timer_create() argument
607 return syscall(__NR_timer_create, CLOCK_MONOTONIC, NULL, id); in do_timer_create()
610 static int do_timer_delete(int id) in do_timer_delete() argument
612 return syscall(__NR_timer_delete, id); in do_timer_delete()
624 int id; in check_timer_create_exact() local
640 id = 8; in check_timer_create_exact()
641 if (do_timer_create(&id) < 0) in check_timer_create_exact()
644 if (do_timer_delete(id)) in check_timer_create_exact()
653 if (id != 8) { in check_timer_create_exact()
654 ksft_test_result_fail("check timer create exact %d != 8\n", id); in check_timer_create_exact()
658 /* Validate that it went back to normal mode and allocates ID 9 */ in check_timer_create_exact()
659 if (do_timer_create(&id) < 0) in check_timer_create_exact()
662 if (do_timer_delete(id)) in check_timer_create_exact()
665 if (id == 9) in check_timer_create_exact()