diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-10-24 16:26:55 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-10-24 16:26:55 +0200 |
commit | be5a505d771a77c640acc35ceaa470c80e62f954 (patch) | |
tree | c15e916dcf9ea7809794e36440c066f5b2f79598 /libbb | |
parent | 7427406580e78666fad3634b4bfaf1922d4bb457 (diff) | |
download | busybox-w32-be5a505d771a77c640acc35ceaa470c80e62f954.tar.gz busybox-w32-be5a505d771a77c640acc35ceaa470c80e62f954.tar.bz2 busybox-w32-be5a505d771a77c640acc35ceaa470c80e62f954.zip |
Remove syscall wrappers around clock_gettime, closes 12091
12091 "Direct use of __NR_clock_gettime is not time64-safe".
function old new delta
runsv_main 1698 1712 +14
startservice 378 383 +5
get_mono 31 25 -6
date_main 932 926 -6
gettimeofday_ns 17 - -17
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/time.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/libbb/time.c b/libbb/time.c index b6fcae28b..e66a9cba8 100644 --- a/libbb/time.c +++ b/libbb/time.c | |||
@@ -253,18 +253,9 @@ char* FAST_FUNC strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) | |||
253 | #define CLOCK_MONOTONIC 1 | 253 | #define CLOCK_MONOTONIC 1 |
254 | #endif | 254 | #endif |
255 | 255 | ||
256 | /* libc has incredibly messy way of doing this, | ||
257 | * typically requiring -lrt. We just skip all this mess */ | ||
258 | static void get_mono(struct timespec *ts) | 256 | static void get_mono(struct timespec *ts) |
259 | { | 257 | { |
260 | #if defined(__NR_clock_gettime) | 258 | if (clock_gettime(CLOCK_MONOTONIC, ts)) |
261 | if (syscall(__NR_clock_gettime, CLOCK_MONOTONIC, ts)) | ||
262 | #elif __TIMESIZE == 64 | ||
263 | if (syscall(__NR_clock_gettime64, CLOCK_MONOTONIC, ts)) | ||
264 | #else | ||
265 | # error "We currently don't support architectures without " \ | ||
266 | "the __NR_clock_gettime syscall and 32-bit time_t" | ||
267 | #endif | ||
268 | bb_simple_error_msg_and_die("clock_gettime(MONOTONIC) failed"); | 259 | bb_simple_error_msg_and_die("clock_gettime(MONOTONIC) failed"); |
269 | } | 260 | } |
270 | unsigned long long FAST_FUNC monotonic_ns(void) | 261 | unsigned long long FAST_FUNC monotonic_ns(void) |