diff options
author | 2018-04-24 16:28:42 +0000 | |
---|---|---|
committer | 2018-04-24 16:28:42 +0000 | |
commit | bda456ccd11759e253796707fd980cfc75ecc76d (patch) | |
tree | b010de26d6610adb828989702c7b32def9192bc8 /lib/libc/sys | |
parent | Push NET_LOCK down in the default ifioctl case. (diff) | |
download | wireguard-openbsd-bda456ccd11759e253796707fd980cfc75ecc76d.tar.xz wireguard-openbsd-bda456ccd11759e253796707fd980cfc75ecc76d.zip |
Validate timespec and return ECANCELED when interrupted with SA_RESTART.
Discussing with mpi@ and guenther@, we decided to first fix the existing
semaphore implementation with regards to SA_RESTART and POSIX compliant
returns in the case where we deal with restartable signals.
Currently we return EINTR everywhere which is mostly incorrect as the
user can not know if she needs to recall the syscall or not. Return
ECANCELED to signal that SA_RESTART was set and EINTR otherwise.
Regression tests pass and so does the posixsuite. Timespec validation
bits are needed to pass the later.
OK mpi@, guenther@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/__thrsleep.2 | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/sys/__thrsleep.2 b/lib/libc/sys/__thrsleep.2 index 2566d043fab..28dc4483688 100644 --- a/lib/libc/sys/__thrsleep.2 +++ b/lib/libc/sys/__thrsleep.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: __thrsleep.2,v 1.6 2016/09/03 17:02:22 akfaew Exp $ +.\" $OpenBSD: __thrsleep.2,v 1.7 2018/04/24 16:28:42 pirofti Exp $ .\" .\" Copyright (c) 2012 Philip Guenther <guenther@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 3 2016 $ +.Dd $Mdocdate: April 24 2018 $ .Dt __THRSLEEP 2 .Os .Sh NAME @@ -148,12 +148,19 @@ arguments was reached. A signal arrived or the .Fa abort argument pointed to a non-zero value. +.It Bq Er ECANCELED +A signal arrived and +.Fa SA_RESTART +was set. .It Bq Er EINVAL The .Fa clock_id argument is not a valid .Xr clock_gettime 2 -clock id. +clock id +or +.Fa abstime +specified a nanosecond value less than zero or greater than 1000 million. .El .Pp .Fn __thrwakeup @@ -167,6 +174,7 @@ with the same were found. .El .Sh SEE ALSO +.Xr sigaction 2 , .Xr pthread_cond_wait 3 , .Xr pthread_mutex_lock 3 , .Xr tsleep 9 |