about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-11-26 13:48:49 +0000
committerJakub Jelinek <jakub@redhat.com>2004-11-26 13:48:49 +0000
commitf94203900a978cda33df395c36827a17d171f98e (patch)
treef60c591eb4acb7c1ca6977b86b1b86e3fecd8532 /nptl
parent945a6124b6aa3047e3d144da4fb47cbbf5da70ee (diff)
downloadglibc-f94203900a978cda33df395c36827a17d171f98e.tar.gz
glibc-f94203900a978cda33df395c36827a17d171f98e.tar.xz
glibc-f94203900a978cda33df395c36827a17d171f98e.zip
Updated to fedora-glibc-20041126T1318 cvs/fedora-glibc-2_3_3-85
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog9
-rw-r--r--nptl/Makefile1
-rw-r--r--nptl/Versions2
-rw-r--r--nptl/allocatestack.c2
-rw-r--r--nptl/pthread_setschedprio.c66
-rw-r--r--nptl/sysdeps/pthread/pthread.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h16
-rw-r--r--nptl/sysdeps/x86_64/Makefile9
11 files changed, 155 insertions, 2 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d95330d2b3..a0ece15297 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,12 @@
+2004-11-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/x86_64/Makefile [nptl]: Define CFLAGS-pthread_create.c.
+
+	* Makefile (libpthread-routines): Add pthread_setschedprio.
+	* Versions [libpthread, GLIBC_2.3.4]: Add pthread_setschedprio.
+	* sysdeps/pthread/pthread.h: Declare pthread_setschedprio.
+	* pthread_setschedprio.c: New file.
+
 2004-11-20  Jakub Jelinek  <jakub@redhat.com>
 
 	* pthread_create.c (pthread_cancel): Add PTHREAD_STATIC_FN_REQUIRE.
diff --git a/nptl/Makefile b/nptl/Makefile
index 50156895bc..7152144609 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -36,6 +36,7 @@ libpthread-routines = init vars events version \
 		      pthread_self pthread_equal pthread_yield \
 		      pthread_getconcurrency pthread_setconcurrency \
 		      pthread_getschedparam pthread_setschedparam \
+		      pthread_setschedprio \
 		      pthread_attr_init pthread_attr_destroy \
 		      pthread_attr_getdetachstate pthread_attr_setdetachstate \
 		      pthread_attr_getguardsize pthread_attr_setguardsize \
diff --git a/nptl/Versions b/nptl/Versions
index 7e8ac9e271..79bf190c3a 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -228,6 +228,8 @@ libpthread {
     # New affinity interfaces.
     pthread_getaffinity_np; pthread_setaffinity_np;
     pthread_attr_getaffinity_np; pthread_attr_setaffinity_np;
+
+    pthread_setschedprio;
   }
 
   GLIBC_PRIVATE {
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 89a034e0ec..8875209a11 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -417,7 +417,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       pd = get_cached_stack (&size, &mem);
       if (pd == NULL)
 	{
-	  /* To avoid aliasing effects on a larger scale then pages we
+	  /* To avoid aliasing effects on a larger scale than pages we
 	     adjust the allocated stack size if necessary.  This way
 	     allocations directly following each other will not have
 	     aliasing problems.  */
diff --git a/nptl/pthread_setschedprio.c b/nptl/pthread_setschedprio.c
new file mode 100644
index 0000000000..063f5232f5
--- /dev/null
+++ b/nptl/pthread_setschedprio.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sched.h>
+#include <string.h>
+#include <sched.h>
+#include "pthreadP.h"
+#include <lowlevellock.h>
+
+
+int
+pthread_setschedprio (threadid, prio)
+     pthread_t threadid;
+     int prio;
+{
+  struct pthread *pd = (struct pthread *) threadid;
+
+  /* Make sure the descriptor is valid.  */
+  if (INVALID_TD_P (pd))
+    /* Not a valid thread handle.  */
+    return ESRCH;
+
+  int result = 0;
+  struct sched_param param;
+  param.sched_priority = prio;
+
+  /* We have to handle cancellation in the following code since we are
+     locking another threads desriptor.  */
+  pthread_cleanup_push ((void (*) (void *)) lll_unlock_wake_cb, &pd->lock);
+
+  lll_lock (pd->lock);
+
+  /* Try to set the scheduler information.  */
+  if (__builtin_expect (sched_setparam (pd->tid, &param) == -1, 0))
+    result = errno;
+  else
+    {
+      /* We succeeded changing the kernel information.  Reflect this
+	 change in the thread descriptor.  */
+      memcpy (&pd->schedparam, &param, sizeof (struct sched_param));
+      pd->flags |= ATTR_FLAG_SCHED_SET;
+    }
+
+  lll_unlock (pd->lock);
+
+  pthread_cleanup_pop (0);
+
+  return result;
+}
diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h
index 27666483d9..5046a6976b 100644
--- a/nptl/sysdeps/pthread/pthread.h
+++ b/nptl/sysdeps/pthread/pthread.h
@@ -373,6 +373,10 @@ extern int pthread_getschedparam (pthread_t __target_thread,
 				  struct sched_param *__restrict __param)
      __THROW;
 
+/* Set the scheduling priority for TARGET_THREAD.  */
+extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
+     __THROW;
+
 
 #ifdef __USE_UNIX98
 /* Determine level of concurrency.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
index b0a117a200..5d84a25486 100644
--- a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
+++ b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
@@ -138,4 +138,20 @@
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION	200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
 #endif /* posix_opt.h */
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
index 6c138f3ae5..e0f02b0544 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
@@ -144,4 +144,20 @@
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION	200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
 #endif /* posix_opt.h */
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h
index 2b5a3e6db8..07753c3535 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h
@@ -144,4 +144,20 @@
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION	200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
 #endif /* posix_opt.h */
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h
index 2b5a3e6db8..07753c3535 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h
@@ -144,4 +144,20 @@
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION	200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
 #endif /* posix_opt.h */
diff --git a/nptl/sysdeps/x86_64/Makefile b/nptl/sysdeps/x86_64/Makefile
index 24990a2b7e..6e24a26cde 100644
--- a/nptl/sysdeps/x86_64/Makefile
+++ b/nptl/sysdeps/x86_64/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -19,3 +19,10 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
+
+ifeq ($(subdir),nptl)
+# P4s have problems with 4M aliasing.  We disturb the allocation of stacks
+# just enough so the subsequent allocations do not use stack address
+# (mod 4M) == 0.
+CFLAGS-pthread_create.c += -DMULTI_PAGE_ALIASING=65536
+endif