summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--hwclock/kd.c1
-rw-r--r--include/Makefile.am1
-rw-r--r--include/usleep.h18
-rw-r--r--login-utils/shutdown.c1
-rw-r--r--mount/fstab.c1
-rw-r--r--sys-utils/rtcwake.c1
-rw-r--r--text-utils/tailf.c1
8 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8999826a..7e13a61e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,7 @@ AC_CHECK_FUNCS(
fsync \
getdomainname \
get_current_dir_name \
+ usleep \
nanosleep \
personality \
updwtmp \
diff --git a/hwclock/kd.c b/hwclock/kd.c
index b0e55d1c..3da87caf 100644
--- a/hwclock/kd.c
+++ b/hwclock/kd.c
@@ -17,6 +17,7 @@ probe_for_kd_clock() {
#include <sys/ioctl.h>
#include "nls.h"
+#include "usleep.h"
static int con_fd = -1; /* opened by probe_for_kd_clock() */
/* never closed */
diff --git a/include/Makefile.am b/include/Makefile.am
index f959659a..5669421b 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -16,6 +16,7 @@ dist_noinst_HEADERS = \
pttype.h \
setproctitle.h \
swapheader.h \
+ usleep.h \
wholedisk.h \
widechar.h \
xstrncpy.h
diff --git a/include/usleep.h b/include/usleep.h
new file mode 100644
index 00000000..f64477c9
--- /dev/null
+++ b/include/usleep.h
@@ -0,0 +1,18 @@
+#ifndef UTIL_LINUX_USLEEP_H
+#define UTIL_LINUX_USLEEP_H
+
+#ifndef HAVE_USLEEP
+/*
+ * This function is marked obsolete in POSIX.1-2001 and removed in
+ * POSIX.1-2008. It is replaced with nanosleep().
+ */
+# define usleep(x) \
+ do { \
+ struct timespec xsleep; \
+ xsleep.tv_sec = x / 1000 / 1000; \
+ xsleep.tv_nsec = (x - xsleep.tv_sec * 1000 * 1000) * 1000; \
+ nanosleep(&xsleep, NULL); \
+ } while (0)
+#endif
+
+#endif /* UTIL_LINUX_USLEEP_H */
diff --git a/login-utils/shutdown.c b/login-utils/shutdown.c
index 58600b9d..f7bc0005 100644
--- a/login-utils/shutdown.c
+++ b/login-utils/shutdown.c
@@ -76,6 +76,7 @@
#include "pathnames.h"
#include "xstrncpy.h"
#include "nls.h"
+#include "usleep.h"
static void usage(void), int_handler(int), write_user(struct utmp *);
static void wall(void), write_wtmp(void), unmount_disks(void);
diff --git a/mount/fstab.c b/mount/fstab.c
index 82e90f3a..8cd35d64 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -19,6 +19,7 @@
#include "fsprobe.h"
#include "pathnames.h"
#include "nls.h"
+#include "usleep.h"
#define streq(s, t) (strcmp ((s), (t)) == 0)
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 4b843736..d75a69f3 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -36,6 +36,7 @@
#include <linux/rtc.h>
#include "nls.h"
+#include "usleep.h"
/* constants from legacy PC/AT hardware */
#define RTC_PF 0x40
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index 6a76ef45..ec6e1c46 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -41,6 +41,7 @@
#include <sys/inotify.h>
#endif
#include "nls.h"
+#include "usleep.h"
#define DEFAULT_LINES 10