Module Name:    src
Committed By:   skrll
Date:           Sun Jul 17 13:49:43 UTC 2016

Modified Files:
        src/lib/libpthread: pthread_mutex.c pthread_types.h

Log Message:
Use anonymous union for ptm_ceiling and old __pthread_spin_t field to
maintain backward compatibility and fix hppa build.  hppa has an non-
integer type __pthread_spin_t


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/lib/libpthread/pthread_mutex.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libpthread/pthread_types.h

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_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.61 src/lib/libpthread/pthread_mutex.c:1.62
--- src/lib/libpthread/pthread_mutex.c:1.61	Sat Jul 16 12:58:11 2016
+++ src/lib/libpthread/pthread_mutex.c	Sun Jul 17 13:49:43 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.61 2016/07/16 12:58:11 skrll Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.62 2016/07/17 13:49:43 skrll 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.61 2016/07/16 12:58:11 skrll Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.62 2016/07/17 13:49:43 skrll Exp $");
 
 #include <sys/types.h>
 #include <sys/lwpctl.h>
@@ -796,7 +796,7 @@ pthread__mutex_deferwake(pthread_t self,
 int
 pthread_mutex_getprioceiling(const pthread_mutex_t *ptm, int *ceil) 
 {
-	*ceil = (unsigned int)ptm->ptm_ceiling;
+	*ceil = ptm->ptm_ceiling;
 	return 0;
 }
 
@@ -807,9 +807,9 @@ pthread_mutex_setprioceiling(pthread_mut
 
 	error = pthread_mutex_lock(ptm);
 	if (error == 0) {
-		*old_ceil = (unsigned int)ptm->ptm_ceiling;
+		*old_ceil = ptm->ptm_ceiling;
 		/*check range*/
-		ptm->ptm_ceiling = (unsigned char)ceil;
+		ptm->ptm_ceiling = ceil;
 		pthread_mutex_unlock(ptm);
 	}
 	return error;

Index: src/lib/libpthread/pthread_types.h
diff -u src/lib/libpthread/pthread_types.h:1.18 src/lib/libpthread/pthread_types.h:1.19
--- src/lib/libpthread/pthread_types.h:1.18	Sun Jul  3 14:24:58 2016
+++ src/lib/libpthread/pthread_types.h	Sun Jul 17 13:49:43 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_types.h,v 1.18 2016/07/03 14:24:58 christos Exp $	*/
+/*	$NetBSD: pthread_types.h,v 1.19 2016/07/17 13:49:43 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -115,7 +115,10 @@ struct	__pthread_mutex_st {
 #ifdef __CPU_SIMPLE_LOCK_PAD
 	uint8_t		ptm_pad1[3];
 #endif
-	__pthread_spin_t ptm_ceiling;
+	union {
+		unsigned char ptm_ceiling;
+		__pthread_spin_t ptm_unused;
+	};
 #ifdef __CPU_SIMPLE_LOCK_PAD
 	uint8_t		ptm_pad2[3];
 #endif
@@ -131,13 +134,13 @@ struct	__pthread_mutex_st {
 #ifdef __CPU_SIMPLE_LOCK_PAD
 #define _PTHREAD_MUTEX_INITIALIZER { _PT_MUTEX_MAGIC, 			\
 				    __SIMPLELOCK_UNLOCKED, { 0, 0, 0 },	\
-				    __SIMPLELOCK_UNLOCKED, { 0, 0, 0 },	\
+				    { 0 }, { 0, 0, 0 },			\
 				    NULL, NULL, 0, NULL			\
 				  }
 #else
 #define _PTHREAD_MUTEX_INITIALIZER { _PT_MUTEX_MAGIC, 			\
 				    __SIMPLELOCK_UNLOCKED,		\
-				    __SIMPLELOCK_UNLOCKED,		\
+				    { 0 } ,				\
 				    NULL, NULL, 0, NULL			\
 				  }
 #endif /* __CPU_SIMPLE_LOCK_PAD */

Reply via email to