diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-16 11:55:10 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:39 +0200 |
commit | 1b11d19b60208e1dc932244aba6756eafa1e67ce (patch) | |
tree | c9e1f4a9893f09b65b82118eea67df39b239c6aa /libc/sysdeps/linux/common/stime.c | |
parent | a30f4f75a3e4e128594a35e7d6b7e001eee54cb7 (diff) |
provide stime and settimeofday functions if at least one of the syscalls is available
Add hidden stime for possible use in settimeofday.
Add stubs for both functions if none of the syscalls is present.
Avoid circular dependency.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/stime.c')
-rw-r--r-- | libc/sysdeps/linux/common/stime.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libc/sysdeps/linux/common/stime.c b/libc/sysdeps/linux/common/stime.c index cb7e8040c..b30884dd7 100644 --- a/libc/sysdeps/linux/common/stime.c +++ b/libc/sysdeps/linux/common/stime.c @@ -8,15 +8,17 @@ */ #include <sys/syscall.h> -#include <time.h> -#include <sys/time.h> #ifdef __USE_SVID -#ifdef __NR_stime +# include <time.h> +# ifdef __NR_stime _syscall1(int, stime, const time_t *, t) -#else - -int stime(const time_t * when) +# elif defined __USE_BSD && defined __NR_settimeofday +# define __need_NULL +# include <stddef.h> +# include <errno.h> +# include <sys/time.h> +int stime(const time_t *when) { struct timeval tv; @@ -28,5 +30,8 @@ int stime(const time_t * when) tv.tv_usec = 0; return settimeofday(&tv, (struct timezone *) 0); } -#endif +# endif +# if defined __NR_stime || (defined __USE_BSD && defined __NR_settimeofday) +libc_hidden_def(stime) +# endif #endif |