diff options
author | Eric Wong <e@80x24.org> | 2015-03-09 20:40:25 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-03-09 20:40:25 +0000 |
commit | 58cec82abb8b1e6feea090c72806bd9d8f693a37 (patch) | |
tree | fa7405b365689dc7db4183b814fdc57e03331c43 | |
parent | c659acbb8d7a6b0c8098646981124a47f15cceae (diff) | |
download | cmogstored-58cec82abb8b1e6feea090c72806bd9d8f693a37.tar.gz |
While glibc supports ppoll, ppoll is not standardized and apparently is not a cancellation point in some versions FreeBSD based on Mykola Golub's bug report in <20150309151851.GC2195@gmail.com> Reported-by: Mykola Golub <trociny@FreeBSD.org>
-rw-r--r-- | sig.c | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -27,27 +27,14 @@ void mog_intr_enable(void) CHECK(int, 0, pthread_sigmask(SIG_SETMASK, &mog_emptyset, NULL)); } -/* - * favor ppoll if available since this is our only pselect user and - * would increase the size of the executable - */ -#ifdef HAVE_PPOLL -static int sleeper(struct timespec *tsp, const sigset_t *sigmask) -{ - int err = 0; - - if (ppoll(NULL, 0, tsp, sigmask) < 0) { - err = errno; - assert((err == EINTR || err == ENOMEM) && - "BUG in ppoll usage"); - } - return err; -} -#else /* PSELECT */ static int sleeper(struct timespec *tsp, const sigset_t *sigmask) { int err = 0; + /* + * pselect is a cancellation point, + * ppoll is not POSIX and is only a cancellation point on glibc. + */ if (pselect(0, NULL, NULL, NULL, tsp, sigmask) < 0) { err = errno; assert((err == EINTR || err == ENOMEM) && @@ -55,7 +42,6 @@ static int sleeper(struct timespec *tsp, const sigset_t *sigmask) } return err; } -#endif /* PSELECT */ /* thread-safe, interruptible sleep, negative seconds -> sleep forever */ int mog_sleep(long seconds) |