summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-10-24 12:15:56 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-10-24 12:15:56 +0000
commitb4048073e620a8d84baebf299819a4f409cbbfea (patch)
tree09b2f43272aee98fdff4863a4fafc9554ca35b33
parent9ef3a9f8b2704693496af12120ea3ab40389bf7b (diff)
downloadskalibs-b4048073e620a8d84baebf299819a4f409cbbfea.tar.xz
More strict test for SKALIBS_HASTIMER (must have struct itimerspec and struct sigevent too)
-rw-r--r--src/sysdeps/trytimer.c6
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 ;
}