Module Name:    src
Committed By:   kre
Date:           Fri Dec  8 09:24:31 UTC 2017

Modified Files:
        src/lib/libpthread: pthread.c pthread_compat.c pthread_mutex.c

Log Message:
Deal with more lwp_park() timestamp unconsting


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libpthread/pthread_compat.c
cvs rdiff -u -r1.63 -r1.64 src/lib/libpthread/pthread_mutex.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.c
diff -u src/lib/libpthread/pthread.c:1.150 src/lib/libpthread/pthread.c:1.151
--- src/lib/libpthread/pthread.c:1.150	Tue Jul 11 15:21:35 2017
+++ src/lib/libpthread/pthread.c	Fri Dec  8 09:24:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.150 2017/07/11 15:21:35 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.151 2017/12/08 09:24:31 kre Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.150 2017/07/11 15:21:35 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.151 2017/12/08 09:24:31 kre Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1202,8 +1202,8 @@ pthread__park(pthread_t self, pthread_mu
 		 * If we deferred unparking a thread, arrange to
 		 * have _lwp_park() restart it before blocking.
 		 */
-		error = _lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, abstime,
-		    self->pt_unpark, hint, hint);
+		error = _lwp_park(CLOCK_REALTIME, TIMER_ABSTIME,
+		    __UNCONST(abstime), self->pt_unpark, hint, hint);
 		self->pt_unpark = 0;
 		if (error != 0) {
 			switch (rv = errno) {

Index: src/lib/libpthread/pthread_compat.c
diff -u src/lib/libpthread/pthread_compat.c:1.3 src/lib/libpthread/pthread_compat.c:1.4
--- src/lib/libpthread/pthread_compat.c:1.3	Fri Jan 31 20:44:01 2014
+++ src/lib/libpthread/pthread_compat.c	Fri Dec  8 09:24:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_compat.c,v 1.3 2014/01/31 20:44:01 christos Exp $	*/
+/*	$NetBSD: pthread_compat.c,v 1.4 2017/12/08 09:24:31 kre Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_compat.c,v 1.3 2014/01/31 20:44:01 christos Exp $");
+__RCSID("$NetBSD: pthread_compat.c,v 1.4 2017/12/08 09:24:31 kre Exp $");
 
 #include <sys/param.h>
 #include <sys/syscall.h>
@@ -89,7 +89,9 @@ _lwp_park(clockid_t a, int b, const stru
     const void *e, const void *f)
 {
 
-	return syscall(SYS____lwp_park60, a, b, c, d, e, f);
+	struct timespec t = *c;
+
+	return syscall(SYS____lwp_park60, a, b, &t, d, e, f);
 }
 
 int

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.63 src/lib/libpthread/pthread_mutex.c:1.64
--- src/lib/libpthread/pthread_mutex.c:1.63	Mon Oct 31 23:53:12 2016
+++ src/lib/libpthread/pthread_mutex.c	Fri Dec  8 09:24:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.63 2016/10/31 23:53:12 christos Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.64 2017/12/08 09:24:31 kre Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_mutex.c,v 1.63 2016/10/31 23:53:12 christos Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.64 2017/12/08 09:24:31 kre Exp $");
 
 #include <sys/types.h>
 #include <sys/lwpctl.h>
@@ -394,8 +394,9 @@ pthread__mutex_lock_slow(pthread_mutex_t
 		 */
 		while (self->pt_mutexwait) {
 			self->pt_blocking++;
-			error = _lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, ts,
-			    self->pt_unpark, __UNVOLATILE(&ptm->ptm_waiters),
+			error = _lwp_park(CLOCK_REALTIME, TIMER_ABSTIME,
+			    __UNCONST(ts), self->pt_unpark,
+			    __UNVOLATILE(&ptm->ptm_waiters),
 			    __UNVOLATILE(&ptm->ptm_waiters));
 			self->pt_unpark = 0;
 			self->pt_blocking--;

Reply via email to