Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread Add cancellation stubs for accept() and conne...



details:   https://anonhg.NetBSD.org/src/rev/7ff684236844
branches:  trunk
changeset: 542391:7ff684236844
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Mon Jan 27 20:57:41 2003 +0000

description:
Add cancellation stubs for accept() and connect().

diffstat:

 lib/libpthread/pthread_cancelstub.c |  33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diffs (66 lines):

diff -r c8c0b09f06b4 -r 7ff684236844 lib/libpthread/pthread_cancelstub.c
--- a/lib/libpthread/pthread_cancelstub.c       Mon Jan 27 20:56:45 2003 +0000
+++ b/lib/libpthread/pthread_cancelstub.c       Mon Jan 27 20:57:41 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_cancelstub.c,v 1.2 2003/01/18 10:34:15 thorpej Exp $   */
+/*     $NetBSD: pthread_cancelstub.c,v 1.3 2003/01/27 20:57:41 nathanw Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -56,11 +56,14 @@
 #define __LIBC12_SOURCE__
 #include <signal.h>
 #include <sys/mman.h>
+#include <sys/socket.h>
 
 #include "pthread.h"
 #include "pthread_int.h"
 
+int    _sys_accept(int, struct sockaddr *, socklen_t *);
 int    _sys_close(int);
+int    _sys_connect(int, const struct sockaddr *, socklen_t);
 int    _sys_fcntl(int, int, ...);
 int    _sys_fsync(int);
 ssize_t        _sys_msgrcv(int, void *, size_t, long, int);
@@ -80,6 +83,20 @@
 
 
 int
+accept(int s, struct sockaddr *addr, socklen_t *addrlen)
+{
+       int retval;
+       pthread_t self;
+
+       self = pthread__self();
+       pthread__testcancel(self);
+       retval = _sys_accept(s, addr, addrlen);
+       pthread__testcancel(self);
+       
+       return retval;
+}
+
+int
 close(int d)
 {
        int retval;
@@ -94,6 +111,20 @@
 }
 
 int
+connect(int s, const struct sockaddr *addr, socklen_t namelen)
+{
+       int retval;
+       pthread_t self;
+
+       self = pthread__self();
+       pthread__testcancel(self);
+       retval = _sys_connect(s, addr, namelen);
+       pthread__testcancel(self);
+       
+       return retval;
+}
+
+int
 fcntl(int fd, int cmd, ...)
 {
        int retval;



Home | Main Index | Thread Index | Old Index