sched/signal/sig_nanosleep.c and libc/time/lib_nanosleep.c: Implement clock_nanosleep(). nanosleep() is now reduced to a libc wrapper around clock_nanosleep().

This commit is contained in:
Gregory Nutt
2017-11-11 17:44:59 -06:00
parent 2ae1d62e67
commit 35ee844590
11 changed files with 223 additions and 64 deletions
+1 -1
View File
@@ -227,7 +227,7 @@
# define SYS_sigsuspend (__SYS_signals+5)
# define SYS_sigtimedwait (__SYS_signals+6)
# define SYS_sigwaitinfo (__SYS_signals+7)
# define SYS_nanosleep (__SYS_signals+8)
# define SYS_clock_nanosleep (__SYS_signals+8)
# define __SYS_clock (__SYS_signals+9)
#else
# define __SYS_clock __SYS_signals
+9 -4
View File
@@ -1,7 +1,7 @@
/********************************************************************************
* include/time.h
*
* Copyright (C) 2007-2011, 2013-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011, 2013-2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -90,15 +90,17 @@
# define CLOCK_MONOTONIC 1
#endif
/* This is a flag that may be passed to the timer_settime() function */
/* This is a flag that may be passed to the timer_settime() and
* clock_nanosleep() functions.
*/
#define TIMER_ABSTIME 1
#ifndef CONFIG_LIBC_LOCALTIME
/* Local time is the same as gmtime in this implementation */
# define localtime(c) gmtime(c)
# define localtime_r(c,r) gmtime_r(c,r)
# define localtime(c) gmtime(c)
# define localtime_r(c,r) gmtime_r(c,r)
#endif
/********************************************************************************
@@ -231,6 +233,9 @@ int timer_settime(timer_t timerid, int flags,
int timer_gettime(timer_t timerid, FAR struct itimerspec *value);
int timer_getoverrun(timer_t timerid);
int clock_nanosleep(clockid_t clockid, int flags,
FAR const struct timespec *rqtp,
FAR struct timespec *rmtp);
int nanosleep(FAR const struct timespec *rqtp, FAR struct timespec *rmtp);
#ifdef CONFIG_LIBC_LOCALTIME