Module Name:    src
Committed By:   bouyer
Date:           Sat Sep  5 12:51:09 UTC 2009

Modified Files:
        src/lib/libpthread [netbsd-5]: pthread_cancelstub.c pthread_misc.c

Log Message:
Pull up following revision(s) (requested by enami in ticket #921):
        lib/libpthread/pthread_misc.c: revision 1.14 via patch
        lib/libpthread/pthread_cancelstub.c: revision 1.27 via patch
Make nanosleep cancelable again.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.2.1 src/lib/libpthread/pthread_cancelstub.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/lib/libpthread/pthread_misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread_cancelstub.c
diff -u src/lib/libpthread/pthread_cancelstub.c:1.22 src/lib/libpthread/pthread_cancelstub.c:1.22.2.1
--- src/lib/libpthread/pthread_cancelstub.c:1.22	Wed Oct  8 08:27:07 2008
+++ src/lib/libpthread/pthread_cancelstub.c	Sat Sep  5 12:51:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cancelstub.c,v 1.22 2008/10/08 08:27:07 ad Exp $	*/
+/*	$NetBSD: pthread_cancelstub.c,v 1.22.2.1 2009/09/05 12:51:09 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.22 2008/10/08 08:27:07 ad Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.22.2.1 2009/09/05 12:51:09 bouyer Exp $");
 
 #ifndef lint
 
@@ -91,6 +91,7 @@
 ssize_t	_sys_msgrcv(int, void *, size_t, long, int);
 int	_sys_msgsnd(int, const void *, size_t, int);
 int	_sys___msync13(void *, size_t, int);
+int	_sys_nanosleep(const struct timespec *, struct timespec *);
 int	_sys_open(const char *, int, ...);
 int	_sys_poll(struct pollfd *, nfds_t, int);
 int	_sys_pollts(struct pollfd *, nfds_t, const struct timespec *,
@@ -333,6 +334,24 @@
 }
 
 int
+nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
+{
+	int retval;
+	pthread_t self;
+
+	self = pthread__self();
+	TESTCANCEL(self);
+	/*
+	 * For now, just nanosleep.  In the future, maybe pass a ucontext_t
+	 * to _lwp_nanosleep() and allow it to recycle our kernel stack.
+	 */
+	retval = _sys_nanosleep(rqtp, rmtp);
+	TESTCANCEL(self);
+
+	return retval;
+}
+
+int
 open(const char *path, int flags, ...)
 {
 	int retval;
@@ -553,6 +572,7 @@
 __strong_alias(_msgrcv, msgrcv)
 __strong_alias(_msgsnd, msgsnd)
 __strong_alias(___msync13, __msync13)
+__strong_alias(_nanosleep, nanosleep)
 __strong_alias(_open, open)
 __strong_alias(_poll, poll)
 __weak_alias(pollts, _pollts)

Index: src/lib/libpthread/pthread_misc.c
diff -u src/lib/libpthread/pthread_misc.c:1.10 src/lib/libpthread/pthread_misc.c:1.10.4.1
--- src/lib/libpthread/pthread_misc.c:1.10	Sat Jun 28 16:50:43 2008
+++ src/lib/libpthread/pthread_misc.c	Sat Sep  5 12:51:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_misc.c,v 1.10 2008/06/28 16:50:43 ad Exp $	*/
+/*	$NetBSD: pthread_misc.c,v 1.10.4.1 2009/09/05 12:51:09 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_misc.c,v 1.10 2008/06/28 16:50:43 ad Exp $");
+__RCSID("$NetBSD: pthread_misc.c,v 1.10.4.1 2009/09/05 12:51:09 bouyer Exp $");
 
 #include <errno.h>
 #include <string.h>
@@ -50,10 +50,8 @@
 int	pthread__sched_yield(void);
 
 int	_sys___sigprocmask14(int, const sigset_t *, sigset_t *);
-int	_sys_nanosleep(const struct timespec *, struct timespec *);
 int	_sys_sched_yield(void);
 
-__strong_alias(_nanosleep, nanosleep)
 __strong_alias(__libc_thr_sigsetmask,pthread_sigmask)
 __strong_alias(__sigprocmask14,pthread_sigmask)
 __strong_alias(__libc_thr_yield,pthread__sched_yield)
@@ -150,19 +148,6 @@
 	return 0;
 }
 
-#ifndef lint
-int
-nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
-{
-
-	/*
-	 * For now, just nanosleep.  In the future, maybe pass a ucontext_t
-	 * to _lwp_nanosleep() and allow it to recycle our kernel stack.
-	 */
-	return  _sys_nanosleep(rqtp, rmtp);
-}
-#endif
-
 int
 pthread__sched_yield(void)
 {

Reply via email to