diff options
| author | Patrick Mooney <pmooney@pfmooney.com> | 2017-03-15 16:12:45 +0000 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2020-02-27 15:05:30 -0500 |
| commit | 2c2b5e89f6b9617f543c1b581759525f4730690e (patch) | |
| tree | 4d8c6bdd8bd7e5f7e686a820dbb35707c53b026b /usr/src/cmd/sgs/rtld | |
| parent | 3e8c7f16168b2700c28b981ab66ca8ff755c5a5d (diff) | |
| download | illumos-joyent-2c2b5e89f6b9617f543c1b581759525f4730690e.tar.gz | |
11275 gettimeofday should use comm page
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Andrew Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <gdamore@racktopsystems.com>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/cmd/sgs/rtld')
| -rw-r--r-- | usr/src/cmd/sgs/rtld/common/external.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c index aca6522360..caade06cf1 100644 --- a/usr/src/cmd/sgs/rtld/common/external.c +++ b/usr/src/cmd/sgs/rtld/common/external.c @@ -22,7 +22,7 @@ /* * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2014 Garrett D'Amore <garrett@damore.org> - * Copyright 2016 Joyent, Inc. + * Copyright (c) 2017, Joyent, Inc. */ /* @@ -722,9 +722,9 @@ isalnum(int c) #if defined(__i386) || defined(__amd64) /* - * Instead of utilizing the comm page for clock_gettime, rtld uses the raw - * syscall instead. Doing so decreases the surface of symbols needed from libc - * for a modest performance cost. + * Instead of utilizing the comm page for clock_gettime and gettimeofday, rtld + * uses the raw syscall instead. Doing so decreases the surface of symbols + * needed from libc for a modest performance cost. */ extern int __clock_gettime_sys(clockid_t, struct timespec *); @@ -733,6 +733,22 @@ __clock_gettime(clockid_t clock_id, struct timespec *tp) { return (__clock_gettime_sys(clock_id, tp)); } + +int +gettimeofday(struct timeval *tv, void *tz) +{ + if (tv != NULL) { + /* + * Perform the same logic as the libc gettimeofday() when it + * lacks comm page support: Make the clock_gettime syscall and + * divide out the tv_usec field as required. + */ + __clock_gettime_sys(CLOCK_REALTIME, (timespec_t *)tv); + tv->tv_usec /= 1000; + } + + return (0); +} #endif /* defined(__i386) || defined(__amd64) */ /* |
