summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/timers.c
diff options
context:
space:
mode:
authorvb160487 <none@none>2007-01-02 04:32:36 -0800
committervb160487 <none@none>2007-01-02 04:32:36 -0800
commitb2a1c4433264b668a6d431670aa823ba41aea68c (patch)
treed1a0490e2b7c9426f3567c0b265e81c62fc9ecf9 /usr/src/uts/common/os/timers.c
parent8489c77cb9814bd11aa62863c3b4e5c69ec9ab0d (diff)
downloadillumos-joyent-b2a1c4433264b668a6d431670aa823ba41aea68c.tar.gz
5068627 sleep(INT_MAX) returns prematurely on 32-bit machines
6359463 mdb hangs with message: [ sleeping for 1024 bytes of free memory ... ]
Diffstat (limited to 'usr/src/uts/common/os/timers.c')
-rw-r--r--usr/src/uts/common/os/timers.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr/src/uts/common/os/timers.c b/usr/src/uts/common/os/timers.c
index f86c050f52..9cb07a948e 100644
--- a/usr/src/uts/common/os/timers.c
+++ b/usr/src/uts/common/os/timers.c
@@ -1221,13 +1221,13 @@ nanosleep(timespec_t *rqtp, timespec_t *rmtp)
*/
rmtime.tv_sec = rmtime.tv_nsec = 0;
if (ret == 0) {
+ timespec_t delta = rqtime;
+
gethrestime(&now);
- if ((now.tv_sec < rqtime.tv_sec) ||
- ((now.tv_sec == rqtime.tv_sec) &&
- (now.tv_nsec < rqtime.tv_nsec))) {
- rmtime = rqtime;
- timespecsub(&rmtime, &now);
- }
+ timespecsub(&delta, &now);
+ if (delta.tv_sec > 0 || (delta.tv_sec == 0 &&
+ delta.tv_nsec > 0))
+ rmtime = delta;
}
if (datamodel == DATAMODEL_NATIVE) {