[master] afcc3386f deautocrap: everybody have nanosleep(2)

Poul-Henning Kamp phk at FreeBSD.org
Fri May 3 14:15:09 UTC 2024


commit afcc3386f6c6f9af8be45e140ca637a6b1e6b964
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 3 13:17:40 2024 +0000

    deautocrap: everybody have nanosleep(2)

diff --git a/configure.ac b/configure.ac
index 2bd5b2800..23f5f3b6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,7 +221,6 @@ AC_CHECK_HEADERS([priv.h])
 AC_CHECK_HEADERS([fnmatch.h], [], [AC_MSG_ERROR([fnmatch.h is required])])
 
 # Checks for library functions.
-AC_CHECK_FUNCS([nanosleep])
 AC_CHECK_FUNCS([setppriv])
 AC_CHECK_FUNCS([fallocate])
 AC_CHECK_FUNCS([closefrom])
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index 7485acb2e..05557efab 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -409,22 +409,11 @@ VTIM_parse(const char *p)
 void
 VTIM_sleep(vtim_dur t)
 {
-#ifdef HAVE_NANOSLEEP
 	struct timespec ts;
 
 	ts = VTIM_timespec(t);
 
 	(void)nanosleep(&ts, NULL);
-#else
-	if (t >= 1.) {
-		(void)sleep(floor(t));
-		t -= floor(t);
-	}
-	/* XXX: usleep() is not mandated to be thread safe */
-	t *= 1e6;
-	if (t > 0)
-		(void)usleep(floor(t));
-#endif
 }
 
 /*


More information about the varnish-commit mailing list