Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread make kevent(2) a cancelation point, and docum...



details:   https://anonhg.NetBSD.org/src/rev/f4249393993f
branches:  trunk
changeset: 756853:f4249393993f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Aug 06 05:25:46 2010 +0000

description:
make kevent(2) a cancelation point, and document properly all the cancelation
points we currently support.

diffstat:

 lib/libpthread/pthread_cancelstub.c |  23 +++++++++++++++++++++--
 lib/libpthread/pthread_testcancel.3 |  20 ++++++++++++--------
 2 files changed, 33 insertions(+), 10 deletions(-)

diffs (126 lines):

diff -r b081037277e7 -r f4249393993f lib/libpthread/pthread_cancelstub.c
--- a/lib/libpthread/pthread_cancelstub.c       Fri Aug 06 05:25:02 2010 +0000
+++ b/lib/libpthread/pthread_cancelstub.c       Fri Aug 06 05:25:46 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_cancelstub.c,v 1.27 2009/08/12 23:51:23 enami Exp $    */
+/*     $NetBSD: pthread_cancelstub.c,v 1.28 2010/08/06 05:25:46 christos Exp $ */
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.27 2009/08/12 23:51:23 enami Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.28 2010/08/06 05:25:46 christos Exp $");
 
 #ifndef lint
 
@@ -65,10 +65,12 @@
 #include <sys/mman.h>
 #include <sys/select.h>
 #include <sys/socket.h>
+#include <sys/event.h>
 
 #include <compat/sys/mman.h>
 #include <compat/sys/poll.h>
 #include <compat/sys/select.h>
+#include <compat/sys/event.h>
 #include <compat/sys/wait.h>
 #include <compat/include/mqueue.h>
 #include <compat/include/signal.h>
@@ -89,6 +91,8 @@
 int    _sys_fdatasync(int);
 int    _sys_fsync(int);
 int    _sys_fsync_range(int, int, off_t, off_t);
+int    _sys___kevent50(int, const struct kevent *, size_t, struct kevent *,
+           size_t, const struct timespec *);
 int    _sys_mq_send(mqd_t, const char *, size_t, unsigned);
 ssize_t        _sys_mq_receive(mqd_t, char *, size_t, unsigned *);
 int    _sys___mq_timedsend50(mqd_t, const char *, size_t, unsigned,
@@ -155,6 +159,21 @@
 }
 
 int
+__kevent50(int fd, const struct kevent *ev, size_t nev, struct kevent *rev,
+    size_t nrev, const struct timespec *ts)
+{
+       int retval;
+       pthread_t self;
+
+       self = pthread__self();
+       TESTCANCEL(self);
+       retval = _sys___kevent50(fd, ev, nev, rev, nrev, ts);
+       TESTCANCEL(self);
+
+       return retval;
+}
+
+int
 close(int d)
 {
        int retval;
diff -r b081037277e7 -r f4249393993f lib/libpthread/pthread_testcancel.3
--- a/lib/libpthread/pthread_testcancel.3       Fri Aug 06 05:25:02 2010 +0000
+++ b/lib/libpthread/pthread_testcancel.3       Fri Aug 06 05:25:46 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pthread_testcancel.3,v 1.5 2010/07/09 08:51:28 jruoho Exp $
+.\" $NetBSD: pthread_testcancel.3,v 1.6 2010/08/06 05:25:46 christos Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $FreeBSD: src/lib/libpthread/man/pthread_testcancel.3,v 1.9 2002/09/16 19:29:29 mini Exp $
-.Dd July 9, 2010
+.Dd Auguest 6, 2010
 .Dt PTHREAD_TESTCANCEL 3
 .Os
 .Sh NAME
@@ -124,21 +124,23 @@
 Cancellation points will occur when a thread is executing the following
 functions:
 .Fn accept ,
-.\".Fn aio_suspend ,
-.\".Fn clock_nanosleep ,
+.Fn aio_suspend ,
+.Fn clock_nanosleep ,
 .Fn close ,
 .Fn connect ,
 .Fn creat ,
 .Fn fcntl ,
+.Fn fdatasync ,
 .Fn fsync ,
 .Fn fsync_range ,
 .\".Fn getmsg ,
 .\".Fn getpmsg ,
+.Fn kevent ,
 .\".Fn lockf ,
-.\".Fn mq_receive ,
-.\".Fn mq_send ,
-.\".Fn mq_timedreceive ,
-.\".Fn mq_timedsend ,
+.Fn mq_receive ,
+.Fn mq_send ,
+.Fn mq_timedreceive ,
+.Fn mq_timedsend ,
 .Fn msgrcv ,
 .Fn msgsnd ,
 .Fn msync ,
@@ -146,6 +148,7 @@
 .Fn open ,
 .Fn pause ,
 .Fn poll ,
+.Fn pollts ,
 .Fn pread ,
 .Fn pselect ,
 .Fn pthread_cond_timedwait ,
@@ -176,6 +179,7 @@
 .Fn tcdrain ,
 .Fn usleep ,
 .Fn wait ,
+.Fn wait4 ,
 .Fn waitid ,
 .Fn waitpid ,
 .Fn write ,



Home | Main Index | Thread Index | Old Index