diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-24 12:15:56 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-24 12:15:56 +0000 |
commit | b4048073e620a8d84baebf299819a4f409cbbfea (patch) | |
tree | 09b2f43272aee98fdff4863a4fafc9554ca35b33 /src/sysdeps | |
parent | 9ef3a9f8b2704693496af12120ea3ab40389bf7b (diff) | |
download | skalibs-b4048073e620a8d84baebf299819a4f409cbbfea.tar.xz |
More strict test for SKALIBS_HASTIMER (must have struct itimerspec and struct sigevent too)
Diffstat (limited to 'src/sysdeps')
-rw-r--r-- | src/sysdeps/trytimer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sysdeps/trytimer.c b/src/sysdeps/trytimer.c index 84cea0d..9d6291b 100644 --- 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 ; } |