diff options
author | Zack Weinberg <zackw@panix.com> | 2019-08-16 15:03:16 -0400 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-10-30 17:05:14 -0300 |
commit | 12cbde1dae6fa4a9a792b64564c7e0debf7544cc (patch) | |
tree | fac04463cae1c6384358e3823d80e3ed051f72b1 /time/stime.c | |
parent | 4a39c34c4f85de57fb4e648cfa1e774437d69680 (diff) | |
download | glibc-12cbde1dae6fa4a9a792b64564c7e0debf7544cc.tar glibc-12cbde1dae6fa4a9a792b64564c7e0debf7544cc.tar.gz glibc-12cbde1dae6fa4a9a792b64564c7e0debf7544cc.tar.bz2 glibc-12cbde1dae6fa4a9a792b64564c7e0debf7544cc.zip |
Use clock_settime to implement stime; withdraw stime.
Unconditionally, on all ports, use clock_settime to implement stime,
not settimeofday or a direct syscall. Then convert stime into a
compatibility symbol and remove its prototype from time.h.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'time/stime.c')
-rw-r--r-- | time/stime.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/time/stime.c b/time/stime.c index a53c0e86ae..6ea3b6dcc1 100644 --- a/time/stime.c +++ b/time/stime.c @@ -15,23 +15,24 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <errno.h> +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31) + #include <time.h> -#include <stddef.h> /* Set the system clock to *WHEN. */ int -stime (const time_t *when) +attribute_compat_text_section +__stime (const time_t *when) { - if (when == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; + struct timespec ts; + ts.tv_sec = *when; + ts.tv_nsec = 0; + + return __clock_settime (CLOCK_REALTIME, &ts); } -stub_warning (stime) +compat_symbol (libc, __stime, stime, GLIBC_2_0); +#endif |