skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit b4048073e620a8d84baebf299819a4f409cbbfea
parent 9ef3a9f8b2704693496af12120ea3ab40389bf7b
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Mon, 24 Oct 2016 12:15:56 +0000

 More strict test for SKALIBS_HASTIMER (must have struct itimerspec and struct sigevent too)

Diffstat:
Msrc/sysdeps/trytimer.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sysdeps/trytimer.c b/src/sysdeps/trytimer.c @@ -1,12 +1,14 @@ /* ISC license. */ -#include <sys/types.h> #include <signal.h> #include <time.h> int main (void) { timer_t blah ; - if (timer_create(CLOCK_REALTIME, 0, &blah) < 0) return 111 ; + struct itimerspec it = { .it_interval = { .tv_sec = 0, .tv_nsec = 0 }, .it_value = { .tv_sec = 1, .tv_nsec = 0 } } ; + struct sigevent se = { .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, .sigev_value = { .sival_int = 0 }, .sigev_notify_function = 0, .sigev_notify_attributes = 0 } ; + if (timer_create(CLOCK_REALTIME, &se, &blah) < 0) return 111 ; + if (timer_settime(blah, TIMER_ABSTIME, &it, 0) < 0) return 111 ; return 0 ; }