diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2007-04-10 17:39:22 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2007-04-10 17:39:22 +0000 |
commit | 3b1e074fc83378f28653b59731c5a50a5b3d8bf3 (patch) | |
tree | f5e06a202fc0a6b5f5074dbbc6d980912210574a | |
parent | 7346140fde9186be60f72f2e5e03cb17e3651a0f (diff) |
when kevent fails, the errno is a lot more interesting to print than -1
-rw-r--r-- | lib/librthread/rthread_reaper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/librthread/rthread_reaper.c b/lib/librthread/rthread_reaper.c index 601c0c3da82..14a37f192b9 100644 --- a/lib/librthread/rthread_reaper.c +++ b/lib/librthread/rthread_reaper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_reaper.c,v 1.2 2007/04/10 17:25:08 tedu Exp $ */ +/* $OpenBSD: rthread_reaper.c,v 1.3 2007/04/10 17:39:21 tedu Exp $ */ /* * Copyright (c) 2006 Otto Moerbeek <otto@drijf.net> * @@ -18,6 +18,8 @@ #include <sys/types.h> #include <sys/event.h> +#include <errno.h> + #include <machine/spinlock.h> #include <pthread.h> @@ -34,8 +36,8 @@ _rthread_add_to_reaper(pid_t t, struct stack *s) _rthread_debug(1, "Adding %d to reaper\n", t); EV_SET(&kc, t, EVFILT_PROC, EV_ADD|EV_CLEAR, NOTE_EXIT, 0, s); n = kevent(_rthread_kq, &kc, 1, NULL, 0, NULL); - if (n) - _rthread_debug(0, "_rthread_add_to_reaper(): kevent %d\n", n); + if (n == -1) + _rthread_debug(0, "_rthread_add_to_reaper(): kevent %d\n", errno); } /* ARGSUSED */ @@ -51,8 +53,8 @@ _rthread_reaper(void) for (;;) { n = kevent(_rthread_kq, NULL, 0, &ke, 1, &t); - if (n < 0) - _rthread_debug(0, "_rthread_reaper(): kevent %d\n", n); + if (n == -1) + _rthread_debug(0, "_rthread_reaper(): kevent %d\n", errno); else if (n == 0) break; else { |