summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-03-22 01:11:48 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-03-22 01:11:48 +0000
commitfed1f899d0cef05aa0cc7a96d5e12ba1a53ee484 (patch)
treeff465d2d0c8271c5eb155624fa7d134489c86e6f
parent5e512e21e744a8ded6342b83ce1efafb3dae1598 (diff)
closefrom() should be a cancellation point
-rw-r--r--lib/librthread/rthread_cancel.c18
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