Module Name: src
Committed By: riz
Date: Mon Apr 9 18:15:28 UTC 2012
Modified Files:
src/lib/libpthread [netbsd-6]: pthread_cancelstub.c
Log Message:
Pull up following revision(s) (requested by agc in ticket #174):
lib/libpthread/pthread_cancelstub.c: revision 1.36
Add a pthread cancel stub for sigwait, following Onno van der Linden's
analysis in PR 45131. Kindly tested by Hisashi T Fujinaka (using csup
as the test case) with a successful outcome.
OK martin@
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.6.1 src/lib/libpthread/pthread_cancelstub.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.35 src/lib/libpthread/pthread_cancelstub.c:1.35.6.1
--- src/lib/libpthread/pthread_cancelstub.c:1.35 Fri Apr 22 14:18:34 2011
+++ src/lib/libpthread/pthread_cancelstub.c Mon Apr 9 18:15:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cancelstub.c,v 1.35 2011/04/22 14:18:34 joerg Exp $ */
+/* $NetBSD: pthread_cancelstub.c,v 1.35.6.1 2012/04/09 18:15:27 riz Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#undef _FORTIFY_SOURCE
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.35 2011/04/22 14:18:34 joerg Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.35.6.1 2012/04/09 18:15:27 riz Exp $");
#ifndef lint
@@ -58,6 +58,7 @@ __RCSID("$NetBSD: pthread_cancelstub.c,v
#include <sys/uio.h>
#include <sys/wait.h>
#include <aio.h>
+#include <errno.h>
#include <fcntl.h>
#include <mqueue.h>
#include <poll.h>
@@ -577,6 +578,7 @@ __sigtimedwait50(const sigset_t * __rest
pthread_t self;
int retval;
struct timespec tout, *tp;
+
if (timeout) {
tout = *timeout;
tp = &tout;
@@ -591,6 +593,28 @@ __sigtimedwait50(const sigset_t * __rest
return retval;
}
+int
+sigwait(const sigset_t * __restrict set, int * __restrict sig)
+{
+ pthread_t self;
+ int saved_errno;
+ int new_errno;
+ int retval;
+
+ self = pthread__self();
+ saved_errno = errno;
+ TESTCANCEL(self);
+ retval = ____sigtimedwait50(set, NULL, NULL);
+ TESTCANCEL(self);
+ new_errno = errno;
+ errno = saved_errno;
+ if (retval < 0) {
+ return new_errno;
+ }
+ *sig = retval;
+ return 0;
+}
+
__strong_alias(_close, close)
__strong_alias(_fcntl, fcntl)
__strong_alias(_fdatasync, fdatasync)
@@ -608,6 +632,7 @@ __strong_alias(_pread, pread)
__strong_alias(_pwrite, pwrite)
__strong_alias(_read, read)
__strong_alias(_readv, readv)
+__strong_alias(_sigwait, sigwait)
__strong_alias(_write, write)
__strong_alias(_writev, writev)