summaryrefslogtreecommitdiffstats
path: root/runtime/staprun
diff options
context:
space:
mode:
authorhunt <hunt>2007-05-08 21:56:02 +0000
committerhunt <hunt>2007-05-08 21:56:02 +0000
commitcac1d09436744c68e2fff4cf3599ad46a753b66e (patch)
tree773e7272a6eef52222746707646eab86577e39a7 /runtime/staprun
parent639948b19fdd9eb93d7fe2554a6bfed003bdc478 (diff)
downloadsystemtap-steved-cac1d09436744c68e2fff4cf3599ad46a753b66e.tar.gz
systemtap-steved-cac1d09436744c68e2fff4cf3599ad46a753b66e.tar.xz
systemtap-steved-cac1d09436744c68e2fff4cf3599ad46a753b66e.zip
2007-05-08 Martin Hunt <hunt@redhat.com>
* relay.c (ppoll): Add a compatibility function for glibc < 2.4.
Diffstat (limited to 'runtime/staprun')
-rw-r--r--runtime/staprun/ChangeLog4
-rw-r--r--runtime/staprun/relay.c24
2 files changed, 27 insertions, 1 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index 3d122759..bf9fecef 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -1,5 +1,9 @@
2007-05-08 Martin Hunt <hunt@redhat.com>
+ * relay.c (ppoll): Add a compatibility function for
+ glibc < 2.4.
+
+2007-05-08 Martin Hunt <hunt@redhat.com>
Signal handler cleanup.
* mainloop.c (fatal_handler): New. Cleanly handle
unexpected fatal signals.
diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c
index bb575d49..e7431e17 100644
--- a/runtime/staprun/relay.c
+++ b/runtime/staprun/relay.c
@@ -18,6 +18,28 @@ static int relay_fd[NR_CPUS];
static int bulkmode = 0;
static int stop_threads = 0;
+/*
+ * ppoll exists in glibc >= 2.4
+ */
+#if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 4))
+static int ppoll(struct pollfd *fds, nfds_t nfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ sigset_t origmask;
+ int ready;
+ int tim;
+ if (timeout == NULL)
+ tim = -1;
+ else
+ tim = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000;
+
+ sigprocmask(SIG_SETMASK, sigmask, &origmask);
+ ready = poll(fds, nfds, tim);
+ sigprocmask(SIG_SETMASK, &origmask, NULL);
+ return ready;
+}
+#endif
+
/**
* reader_thread - per-cpu channel buffer reader
*/
@@ -27,7 +49,7 @@ static void *reader_thread(void *data)
char buf[131072];
int rc, cpu = (int)(long)data;
struct pollfd pollfd;
- struct timespec tim = {.tv_sec=0, .tv_nsec=10000}, *timeout = &tim;
+ struct timespec tim = {.tv_sec=0, .tv_nsec=10000000}, *timeout = &tim;
sigset_t sigs;
sigemptyset(&sigs);