diff options
author | 2012-03-22 01:11:47 +0000 | |
---|---|---|
committer | 2012-03-22 01:11:47 +0000 | |
commit | 68da0286c37250db045665337f48192a42ad369c (patch) | |
tree | b49fe97b8d1bdbdefd6425dcb2d09a488dc0d590 /lib | |
parent | tfork_thread has been moved to libc (diff) | |
download | wireguard-openbsd-68da0286c37250db045665337f48192a42ad369c.tar.xz wireguard-openbsd-68da0286c37250db045665337f48192a42ad369c.zip |
closefrom() should be a cancellation point
Diffstat (limited to 'lib')
-rw-r--r-- | lib/librthread/rthread_cancel.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/librthread/rthread_cancel.c b/lib/librthread/rthread_cancel.c index 1db785a9a9e..16b0b22517d 100644 --- a/lib/librthread/rthread_cancel.c +++ b/lib/librthread/rthread_cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthread_cancel.c,v 1.4 2012/01/17 02:34:18 guenther Exp $ */ +/* $OpenBSD: rthread_cancel.c,v 1.5 2012/03/22 01:11:47 guenther Exp $ */ /* $snafu: libc_tag.c,v 1.4 2004/11/30 07:00:06 marc Exp $ */ /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ @@ -31,6 +31,7 @@ int _thread_sys_accept(int, struct sockaddr *, socklen_t *); int _thread_sys_close(int); +int _thread_sys_closefrom(int); int _thread_sys_connect(int, const struct sockaddr *, socklen_t); int _thread_sys_fcntl(int, int, ...); int _thread_sys_fsync(int); @@ -133,6 +134,19 @@ close(int fd) return (rv); } + +int +closefrom(int fd) +{ + pthread_t self = pthread_self(); + int rv; + + _enter_cancel(self); + rv = _thread_sys_closefrom(fd); + _leave_cancel(self); + return (rv); +} + int connect(int fd, const struct sockaddr *addr, socklen_t addrlen) { @@ -442,7 +456,7 @@ select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, } #if 0 -sem_timedwait() /* don't have yet */ +sem_timedwait() /* in rthread_sem.c */ sem_wait() /* in rthread_sem.c */ send() /* built on sendto() */ #endif |