From 99a4f93b86c8682d26c5dccf7f5d1ea9f048480f Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sat, 10 Feb 2018 00:42:26 +0100
Subject: [PATCH 4/6] <pthread.h>: Add missing 'const' to four functions.

---
 include/pthread.h                              | 9 +++++----
 lib/libc_r/uthread/uthread_mattr_kind_np.c     | 2 +-
 lib/libc_r/uthread/uthread_mutex_prioceiling.c | 6 +++---
 lib/libc_r/uthread/uthread_mutex_protocol.c    | 3 +--
 lib/libpthread/pthread_mutexattr.3             | 8 ++++----
 lib/libthread_xu/thread/thr_mutex.c            | 2 +-
 lib/libthread_xu/thread/thr_mutexattr.c        | 7 ++++---
 7 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/include/pthread.h b/include/pthread.h
index dba7b30304..cd70d14678 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -201,7 +201,8 @@ int	pthread_mutexattr_init(pthread_mutexattr_t *) __nonnull(1);
 int	pthread_mutexattr_destroy(pthread_mutexattr_t *);
 int	pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *)
 				     __nonnull(2);
-int	pthread_mutexattr_gettype(pthread_mutexattr_t *, int *) __nonnull(2);
+int	pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *)
+	    __nonnull(2);
 int	pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
 int	pthread_mutexattr_settype(pthread_mutexattr_t *, int);
 int	pthread_mutex_destroy(pthread_mutex_t *);
@@ -253,13 +254,13 @@ int	pthread_setprio(pthread_t, int);
 void	pthread_yield(void);
 #endif
 
-int	pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *);
+int	pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
 int	pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
 
-int	pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *);
+int	pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
 int	pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
 
-int	pthread_mutex_getprioceiling(pthread_mutex_t *, int *);
+int	pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
 int	pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
 
 int	pthread_attr_getinheritsched(const pthread_attr_t *, int *);
diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c
index d54867c37c..7ef6a20dbb 100644
--- a/lib/libc_r/uthread/uthread_mattr_kind_np.c
+++ b/lib/libc_r/uthread/uthread_mattr_kind_np.c
@@ -77,7 +77,7 @@ _pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
 }
 
 int
-_pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type)
+_pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type)
 {
 	int	ret;
 
diff --git a/lib/libc_r/uthread/uthread_mutex_prioceiling.c b/lib/libc_r/uthread/uthread_mutex_prioceiling.c
index 86d339c2a6..83ffca868e 100644
--- a/lib/libc_r/uthread/uthread_mutex_prioceiling.c
+++ b/lib/libc_r/uthread/uthread_mutex_prioceiling.c
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc_r/uthread/uthread_mutex_prioceiling.c,v 1.3.2.1 2002/10/22 14:44:03 fjoe Exp $
- * $DragonFly: src/lib/libc_r/uthread/uthread_mutex_prioceiling.c,v 1.3 2005/05/30 20:50:53 joerg Exp $
  */
 #include <string.h>
 #include <stdlib.h>
@@ -39,7 +38,8 @@
 #include "pthread_private.h"
 
 int
-_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling)
+_pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *mattr,
+    int *prioceiling)
 {
 	int ret = 0;
 
@@ -69,7 +69,7 @@ _pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling)
 }
 
 int
-_pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
+_pthread_mutex_getprioceiling(const pthread_mutex_t *mutex,
 			      int *prioceiling)
 {
 	int ret;
diff --git a/lib/libc_r/uthread/uthread_mutex_protocol.c b/lib/libc_r/uthread/uthread_mutex_protocol.c
index 4bd1cb9f26..03542d1980 100644
--- a/lib/libc_r/uthread/uthread_mutex_protocol.c
+++ b/lib/libc_r/uthread/uthread_mutex_protocol.c
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/lib/libc_r/uthread/uthread_mutex_protocol.c,v 1.3.2.1 2002/10/22 14:44:03 fjoe Exp $
- * $DragonFly: src/lib/libc_r/uthread/uthread_mutex_protocol.c,v 1.3 2005/05/30 20:50:53 joerg Exp $
  */
 #include <string.h>
 #include <stdlib.h>
@@ -39,7 +38,7 @@
 #include "pthread_private.h"
 
 int
-_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol)
+_pthread_mutexattr_getprotocol(const pthread_mutexattr_t *mattr, int *protocol)
 {
 	int ret = 0;
 
diff --git a/lib/libpthread/pthread_mutexattr.3 b/lib/libpthread/pthread_mutexattr.3
index dc9722b27c..1cd9ba1504 100644
--- a/lib/libpthread/pthread_mutexattr.3
+++ b/lib/libpthread/pthread_mutexattr.3
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man3/pthread_mutexattr.3,v 1.13 2007/10/22 10:08:00 ru Exp $
 .\"
-.Dd July 10, 2009
+.Dd February 10, 2018
 .Dt PTHREAD_MUTEXATTR 3
 .Os
 .Sh NAME
@@ -53,15 +53,15 @@
 .Ft int
 .Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int prioceiling"
 .Ft int
-.Fn pthread_mutexattr_getprioceiling "pthread_mutexattr_t *attr" "int *prioceiling"
+.Fn pthread_mutexattr_getprioceiling "const pthread_mutexattr_t *attr" "int *prioceiling"
 .Ft int
 .Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol"
 .Ft int
-.Fn pthread_mutexattr_getprotocol "pthread_mutexattr_t *attr" "int *protocol"
+.Fn pthread_mutexattr_getprotocol "const pthread_mutexattr_t *attr" "int *protocol"
 .Ft int
 .Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
 .Ft int
-.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
+.Fn pthread_mutexattr_gettype "const pthread_mutexattr_t *attr" "int *type"
 .Ft int
 .Fn pthread_mutexattr_setpshared "pthread_mutexattr_t *attr" "int pshared"
 .Ft int
diff --git a/lib/libthread_xu/thread/thr_mutex.c b/lib/libthread_xu/thread/thr_mutex.c
index 5fc54e12ee..6832dbafc8 100644
--- a/lib/libthread_xu/thread/thr_mutex.c
+++ b/lib/libthread_xu/thread/thr_mutex.c
@@ -680,7 +680,7 @@ mutex_unlock_common(pthread_mutex_t *mutex)
 }
 
 int
-_pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
+_pthread_mutex_getprioceiling(const pthread_mutex_t *mutex,
 			      int *prioceiling)
 {
 	if ((mutex == NULL) || (*mutex == NULL))
diff --git a/lib/libthread_xu/thread/thr_mutexattr.c b/lib/libthread_xu/thread/thr_mutexattr.c
index 5d4b0a626b..369c30f649 100644
--- a/lib/libthread_xu/thread/thr_mutexattr.c
+++ b/lib/libthread_xu/thread/thr_mutexattr.c
@@ -101,7 +101,7 @@ _pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
 }
 
 int
-_pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type)
+_pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type)
 {
 	int	ret;
 
@@ -155,7 +155,7 @@ _pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
 }
 
 int
-_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol)
+_pthread_mutexattr_getprotocol(const pthread_mutexattr_t *mattr, int *protocol)
 {
 	int ret = 0;
 
@@ -183,7 +183,8 @@ _pthread_mutexattr_setprotocol(pthread_mutexattr_t *mattr, int protocol)
 }
 
 int
-_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling)
+_pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *mattr,
+    int *prioceiling)
 {
 	int ret = 0;
 
-- 
2.15.1

