diff options
Diffstat (limited to 'include/c.h')
-rw-r--r-- | include/c.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h index e343778b4..110728797 100644 --- a/include/c.h +++ b/include/c.h @@ -241,6 +241,21 @@ static inline size_t get_hostname_max(void) return 64; } +#ifndef HAVE_USLEEP +/* + * This function is marked obsolete in POSIX.1-2001 and removed in + * POSIX.1-2008. It is replaced with nanosleep(). + */ +static inline usleep(useconds_t usec) +{ + struct timespec waittime = { + .tv_sec = usec / 1000000L, + .tv_nsec = (usec % 1000000L) * 1000 + } + nanosleep(&waittime, NULL); +} +#endif + /* * Constant strings for usage() functions. For more info see * Documentation/howto-usage-function.txt and sys-utils/arch.c |