[PATCH] clock_nanosleep()

  • From: Robert Millan <rmh@xxxxxxxxxxx>
  • To: rumpkernel-users@xxxxxxxxxxxxx
  • Date: Sun, 16 Aug 2015 02:35:16 +0200


Hi,

rumpuser_clock_sleep() attempts to use clock_nanosleep() (among others) inside
an EINTR
retry loop. However, EINTR condition is not detected correctly for
clock_nanosleep()
because this function has somewhat awkward semantics (it returns the error code
instead of -1).

This patch fixes up the result of clock_nanosleep() to comply with
expectations, hence
handle EINTR properly as with the rest of the functions in the routine.

--
Robert Millan
Index: rumpkernel-0~20150715/buildrump.sh/src/lib/librumpuser/rumpuser.c
===================================================================
--- rumpkernel-0~20150715.orig/buildrump.sh/src/lib/librumpuser/rumpuser.c
2015-08-16 01:31:46.358549593 +0200
+++ rumpkernel-0~20150715/buildrump.sh/src/lib/librumpuser/rumpuser.c
2015-08-16 02:27:24.291677087 +0200
@@ -138,8 +138,9 @@
case RUMPUSER_CLOCK_ABSMONO:
do {
#ifdef HAVE_CLOCK_NANOSLEEP
- rv = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
+ errno = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
&rqt, NULL);
+ rv = errno ? -1 : 0;
#else
/* le/la/der/die/das sigh. timevalspec tailspin */
struct timespec ts, tsr;

Other related posts:

  • » [PATCH] clock_nanosleep() - Robert Millan