Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/atf/dist/atf-run - make all the ifdefs match



details:   https://anonhg.NetBSD.org/src/rev/412807f5db9d
branches:  trunk
changeset: 772135:412807f5db9d
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 19 22:25:45 2011 +0000

description:
- make all the ifdefs match
- make it compile, and test

diffstat:

 external/bsd/atf/dist/atf-run/timer.cpp |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (58 lines):

diff -r ba7f045d37c2 -r 412807f5db9d external/bsd/atf/dist/atf-run/timer.cpp
--- a/external/bsd/atf/dist/atf-run/timer.cpp   Mon Dec 19 21:59:46 2011 +0000
+++ b/external/bsd/atf/dist/atf-run/timer.cpp   Mon Dec 19 22:25:45 2011 +0000
@@ -57,10 +57,10 @@
 handler(int signo, siginfo_t *si, void *uc)
 {
     impl::timer *timer = static_cast<impl::timer *>(
-#ifndef HAVE_POSIX_TIMER
+#ifdef HAVE_POSIX_TIMER
+       si->si_value.sival_ptr
+#else
        handle
-#else
-       si->si_value.sival_ptr
 #endif
     );
 
@@ -82,7 +82,7 @@
         throw system_error(IMPL_NAME "::timer::timer",
                            "Failed to set signal handler", errno);
        
-#ifndef HAVE_POSIX_TIMER
+#ifdef HAVE_POSIX_TIMER
     ::sigevent se;
     se.sigev_notify = SIGEV_SIGNAL;
     se.sigev_signo = SIGALRM;
@@ -112,12 +112,13 @@
     it.it_interval.tv_usec = 0;
     it.it_value.tv_sec = seconds;
     it.it_value.tv_usec = 0;
-    if (::setitimer(ITIMER_REAL, &it, &oit) == -1)
+    if (::setitimer(ITIMER_REAL, &it, &oit) == -1) {
        ::sigaction(SIGALRM, &m_old_sa, NULL);
         throw system_error(IMPL_NAME "::timer::timer",
                            "Failed to program timer", errno);
     }
-    TIMEVAL_TO_TIMESPEC(&m_old_it, &oit);
+    TIMEVAL_TO_TIMESPEC(&oit.it_interval, &m_old_it.it_interval);
+    TIMEVAL_TO_TIMESPEC(&oit.it_value, &m_old_it.it_value);
     handle = static_cast<void *>(this);
 #endif
 }
@@ -126,11 +127,12 @@
 {
     int ret;
 #ifdef HAVE_POSIX_TIMER
+    ret = ::timer_delete(m_timer);
+#else
     ::itimerval oit;
-    TIMESPEC_TO_TIMEVAL(&oit, &m_old_it);
+    TIMESPEC_TO_TIMEVAL(&oit.it_interval, &m_old_it.it_interval);
+    TIMESPEC_TO_TIMEVAL(&oit.it_value, &m_old_it.it_value);
     ret = ::setitimer(ITIMER_REAL, &oit, NULL);
-#else
-    ret = ::timer_delete(m_timer);
 #endif
     INV(ret != -1);
     ret = ::sigaction(SIGALRM, &m_old_sa, NULL);



Home | Main Index | Thread Index | Old Index