summaryrefslogtreecommitdiff
path: root/src/atimer.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-10-03 17:10:47 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-10-03 17:10:47 -0700
commit2b794d6940aa7dc58e297b3649b7799190d71f64 (patch)
treed0ec1a7864e6198e0c7ea764e8477cd0e48d12c7 /src/atimer.c
parenta1a9f411ab644cb191442ea1de4bc1370341cc88 (diff)
downloademacs-2b794d6940aa7dc58e297b3649b7799190d71f64.tar.gz
Port timers to OpenBSD, plus check for timer failures.
OpenBSD problem reported by Han Boetes. * profiler.c (setup_cpu_timer): Check for failure of timer_settime and/or setitimer. (Fprofiler_cpu_stop): Don't assume HAVE_SETITIMER. * syssignal.h (HAVE_ITIMERSPEC): New macro. This is for platforms like OpenBSD, which has timer_settime but does not declare it. OpenBSD does not define SIGEV_SIGNAL, so use that when deciding whether to use itimerspec-related primitives. All uses of HAVE_TIMER_SETTIME replaced with HAVE_ITIMERSPEC.
Diffstat (limited to 'src/atimer.c')
-rw-r--r--src/atimer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/atimer.c b/src/atimer.c
index 048c62798ef..5752192be76 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -42,7 +42,7 @@ static struct atimer *atimers;
/* The alarm timer and whether it was properly initialized, if
POSIX timers are available. */
-#ifdef HAVE_TIMER_SETTIME
+#ifdef HAVE_ITIMERSPEC
static timer_t alarm_timer;
static bool alarm_timer_ok;
#endif
@@ -296,7 +296,7 @@ set_alarm (void)
#endif
EMACS_TIME now, interval;
-#ifdef HAVE_TIMER_SETTIME
+#ifdef HAVE_ITIMERSPEC
if (alarm_timer_ok)
{
struct itimerspec ispec;
@@ -416,7 +416,7 @@ void
init_atimer (void)
{
struct sigaction action;
-#ifdef HAVE_TIMER_SETTIME
+#ifdef HAVE_ITIMERSPEC
struct sigevent sigev;
sigev.sigev_notify = SIGEV_SIGNAL;
sigev.sigev_signo = SIGALRM;