about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog14
-rw-r--r--linuxthreads/attr.c2
-rw-r--r--linuxthreads/manager.c6
-rw-r--r--linuxthreads/mutex.c12
4 files changed, 26 insertions, 8 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index ef0634d459..4a0cf33aa1 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,17 @@
+1998-07-16 10:52  Ulrich Drepper  <drepper@cygnus.com>
+
+	* manager.c (pthread_handle_create): Check whether sched_setscheduler
+	call can succeed here.
+
+	* mutex.c: Define __pthread_mutexattr_settype and make
+	__pthread_mutexattr_setkind_np an alias.
+	Likewise for __pthread_mutexattr_gettype.
+
+1998-07-15 11:00 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>
+
+	* attr.c (pthread_attr_setschedpolicy): Don't check whether caller
+	is root.
+
 1998-07-14 19:38  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/pthread/bits/libc-lock.h: Define __libc_cleanup_end.
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index b5610030b5..7a099857aa 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -96,8 +96,6 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
 {
   if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
     return EINVAL;
-  if (policy != SCHED_OTHER && geteuid() != 0)
-    return ENOTSUP;
   attr->schedpolicy = policy;
   return 0;
 }
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 7d48489f76..d14a57ccd7 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -217,6 +217,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   void *guardaddr = NULL;
   size_t guardsize = 0;
 
+  /* First check whether we have to change the policy and if yes, whether
+     we can  do this.  Normally this should be done by examining the
+     return value of the __sched_setscheduler call in pthread_start_thread
+     but this is hard to implement.  FIXME  */
+  if (attr != NULL && attr->schedpolicy != SCHED_OTHER && geteuid () != 0)
+    return EPERM;
   /* Find a free stack segment for the current stack */
   for (sseg = 1; ; sseg++)
     {
diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c
index a337bad758..74b0922210 100644
--- a/linuxthreads/mutex.c
+++ b/linuxthreads/mutex.c
@@ -144,7 +144,7 @@ int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 }
 weak_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy)
 
-int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
+int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
 {
   if (kind != PTHREAD_MUTEX_FAST_NP
       && kind != PTHREAD_MUTEX_RECURSIVE_NP
@@ -153,18 +153,18 @@ int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
   attr->mutexkind = kind;
   return 0;
 }
-weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
-strong_alias (__pthread_mutexattr_setkind_np, __pthread_mutexattr_settype)
 weak_alias (__pthread_mutexattr_settype, pthread_mutexattr_settype)
+strong_alias ( __pthread_mutexattr_settype, __pthread_mutexattr_setkind_np)
+weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
 
-int __pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind)
+int __pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
 {
   *kind = attr->mutexkind;
   return 0;
 }
-weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np)
-strong_alias (__pthread_mutexattr_getkind_np, __pthread_mutexattr_gettype)
 weak_alias (__pthread_mutexattr_gettype, pthread_mutexattr_gettype)
+strong_alias (__pthread_mutexattr_gettype, __pthread_mutexattr_getkind_np)
+weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np)
 
 /* Once-only execution */