diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2020-03-20 17:13:52 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2020-03-20 17:13:52 +0000 |
commit | 90cc01466d053a8dded828b201fb818c3d6f51b7 (patch) | |
tree | 829b9e835f9a216024cb18e25dfe3ea39bab214f /sys | |
parent | a7580582449de60f9e9dc9e4933e661bfe9b22a7 (diff) |
__thrsleep(2): ensure timeout is set when calling tsleep_nsec(9)
tsleep_nsec(9) will not set a timeout if the nsecs parameter is
equal to INFSLP (UINT64_MAX). We need to limit the duration to
MAXTSLP (UINT64_MAX - 1) to ensure a timeout is set.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_synch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 81f6c14c50e..efb012278b1 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_synch.c,v 1.165 2020/03/20 04:49:17 cheloha Exp $ */ +/* $OpenBSD: kern_synch.c,v 1.166 2020/03/20 17:13:51 cheloha Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* @@ -696,7 +696,7 @@ thrsleep(struct proc *p, struct sys___thrsleep_args *v) } timespecsub(tsp, &now, tsp); - nsecs = TIMESPEC_TO_NSEC(tsp); + nsecs = MIN(TIMESPEC_TO_NSEC(tsp), MAXTSLP); } if (ident == -1) { |