Module Name: src
Committed By: enami
Date: Wed Aug 12 23:51:23 UTC 2009
Modified Files:
src/lib/libpthread: pthread_cancelstub.c pthread_misc.c
Log Message:
Make nanosleep cancelable again.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libpthread/pthread_cancelstub.c
cvs rdiff -u -r1.13 -r1.14 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.26 src/lib/libpthread/pthread_cancelstub.c:1.27
--- src/lib/libpthread/pthread_cancelstub.c:1.26 Tue Jan 13 01:50:04 2009
+++ src/lib/libpthread/pthread_cancelstub.c Wed Aug 12 23:51:23 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cancelstub.c,v 1.26 2009/01/13 01:50:04 christos Exp $ */
+/* $NetBSD: pthread_cancelstub.c,v 1.27 2009/08/12 23:51:23 enami Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.26 2009/01/13 01:50:04 christos Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.27 2009/08/12 23:51:23 enami Exp $");
#ifndef lint
@@ -98,6 +98,8 @@
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___nanosleep50(const struct timespec *, struct timespec *);
+int __nanosleep50(const struct timespec *, struct timespec *);
int _sys_open(const char *, int, ...);
int _sys_poll(struct pollfd *, nfds_t, int);
int _sys___pollts50(struct pollfd *, nfds_t, const struct timespec *,
@@ -357,6 +359,24 @@
}
int
+__nanosleep50(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___nanosleep50(rqtp, rmtp);
+ TESTCANCEL(self);
+
+ return retval;
+}
+
+int
poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
int retval;
@@ -563,6 +583,7 @@
__strong_alias(_msgrcv, msgrcv)
__strong_alias(_msgsnd, msgsnd)
__strong_alias(___msync13, __msync13)
+__strong_alias(___nanosleep50, __nanosleep50)
__strong_alias(_open, open)
__strong_alias(_poll, poll)
__strong_alias(_pread, pread)
Index: src/lib/libpthread/pthread_misc.c
diff -u src/lib/libpthread/pthread_misc.c:1.13 src/lib/libpthread/pthread_misc.c:1.14
--- src/lib/libpthread/pthread_misc.c:1.13 Sun Jan 11 02:46:48 2009
+++ src/lib/libpthread/pthread_misc.c Wed Aug 12 23:51:23 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_misc.c,v 1.13 2009/01/11 02:46:48 christos Exp $ */
+/* $NetBSD: pthread_misc.c,v 1.14 2009/08/12 23:51:23 enami 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.13 2009/01/11 02:46:48 christos Exp $");
+__RCSID("$NetBSD: pthread_misc.c,v 1.14 2009/08/12 23:51:23 enami Exp $");
#include <errno.h>
#include <string.h>
@@ -50,9 +50,7 @@
int pthread__sched_yield(void);
int _sys___sigprocmask14(int, const sigset_t *, sigset_t *);
-int _sys___nanosleep50(const struct timespec *, struct timespec *);
int _sys_sched_yield(void);
-int __nanosleep50(const struct timespec *, struct timespec *);
__strong_alias(__libc_thr_sigsetmask,pthread_sigmask)
__strong_alias(__sigprocmask14,pthread_sigmask)
@@ -150,19 +148,6 @@
return 0;
}
-#ifndef lint
-int
-__nanosleep50(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___nanosleep50(rqtp, rmtp);
-}
-#endif
-
int
pthread__sched_yield(void)
{