This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Robert Love has written the appended patch to add the affinity calls
from Linux 2.5 to glibc. Should we add this to CVS?
Andreas
diff -urN glibc-2.2.5/ChangeLog glibc/ChangeLog
--- glibc-2.2.5/ChangeLog Sun Jan 20 19:20:18 2002
+++ glibc/ChangeLog Fri May 24 09:44:09 2002
@@ -1,3 +1,12 @@
+2002-05-24 Robert Love <rml@tech9.net>
+ * include/sched.h: Add sched_getaffinity and sched_setaffinity support
+ * conform/data/sched.h-data: Likewise
+ * posix/annexc.c: Likewise
+ * posix/sched.h: Likewise
+ * sysdeps/generic/sched_geta.c: Likewise
+ * sysdeps/generic/sched_seta.c: Likewise
+ * sysdeps/unix/sysv/linux/syscalls.list: Likewise
+
2002-01-18 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/configure.in
diff -urN glibc-2.2.5/INTERFACE glibc/INTERFACE
--- glibc-2.2.5/INTERFACE Sun Oct 31 09:02:25 1999
+++ glibc/INTERFACE Fri May 24 09:40:38 2002
@@ -1049,6 +1049,8 @@
scandir scandir
> scandir64 NEW: LFS
scanf scanf
+sched_getaffinity sched_getaffinity
+sched_setaffinity sched_setaffinity
sched_get_priority_max sched_get_priority_max
sched_get_priority_min sched_get_priority_min
sched_getparam sched_getparam
diff -urN glibc-2.2.5/conform/data/sched.h-data glibc/conform/data/sched.h-data
--- glibc-2.2.5/conform/data/sched.h-data Fri Jan 26 21:29:25 2001
+++ glibc/conform/data/sched.h-data Fri May 24 09:13:46 2002
@@ -18,6 +18,8 @@
function int sched_rr_get_interval (pid_t, struct timespec*)
function int sched_setparam (pid_t, const struct sched_param*)
function int sched_setscheduler (pid_t, int, const struct sched_param*)
+function int sched_setaffinity (pid_t, unsigned long, unsigned long*)
+function int sched_getaffinity (pid_t, unsigned long, unsigned long*)
function int sched_yield (void)
allow-header time.h
diff -urN glibc-2.2.5/include/sched.h glibc/include/sched.h
--- glibc-2.2.5/include/sched.h Thu Jul 27 15:00:03 2000
+++ glibc/include/sched.h Fri May 24 09:04:14 2002
@@ -12,6 +12,10 @@
extern int __sched_get_priority_max (int __algorithm);
extern int __sched_get_priority_min (int __algorithm);
extern int __sched_rr_get_interval (__pid_t __pid, struct timespec *__t);
+extern int __sched_setaffinity (__pid_t __pid, unsigned long __len,
+ unsigned long * __mask);
+extern int __sched_getaffinity (__pid_t __pid, unsigned long __len,
+ unsigned long * __mask);
/* These are Linux specific. */
extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
diff -urN glibc-2.2.5/manual/dir-add.info glibc/manual/dir-add.info
--- glibc-2.2.5/manual/dir-add.info Tue Jan 8 14:20:46 2002
+++ glibc/manual/dir-add.info Fri May 24 09:45:02 2002
@@ -1358,6 +1358,8 @@
* scandir64: (libc)Scanning Directory Content.
* scandir: (libc)Scanning Directory Content.
* scanf: (libc)Formatted Input Functions.
+* sched_getaffinity: (libc)Basic Scheduling Functions.
+* sched_setaffinity: (libc)Basic Scheduling Functions.
* sched_get_priority_max: (libc)Basic Scheduling Functions.
* sched_get_priority_min: (libc)Basic Scheduling Functions.
* sched_getparam: (libc)Basic Scheduling Functions.
diff -urN glibc-2.2.5/posix/Makefile glibc/posix/Makefile
--- glibc-2.2.5/posix/Makefile Wed Sep 12 11:47:22 2001
+++ glibc/posix/Makefile Fri May 24 09:38:27 2002
@@ -50,7 +50,7 @@
confstr \
getopt getopt1 getopt_init \
sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
- sched_primin sched_rr_gi \
+ sched_primin sched_rr_gi sched_seta sched_geta \
getaddrinfo gai_strerror wordexp \
pread pwrite pread64 pwrite64 \
spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
diff -urN glibc-2.2.5/posix/annexc.c glibc/posix/annexc.c
--- glibc-2.2.5/posix/annexc.c Thu Jul 5 21:55:38 2001
+++ glibc/posix/annexc.c Fri May 24 09:23:19 2002
@@ -259,9 +259,9 @@
"pthread_setcancelstate", "pthread_setcanceltype", "pthread_setspecific",
"pthread_sigmask", "pthread_testcancel"
/* These come from <sched.h>. */
- "sched_get_priority_max", "sched_get_priority_min",
- "sched_get_rr_interval", "sched_getparam", "sched_getscheduler",
- "sched_setparam", "sched_setscheduler", "sched_yield",
+ "sched_get_priority_max", "sched_get_priority_min", "sched_getaffinity",
+ "sched_setaffinity", "sched_get_rr_interval", "sched_getparam",
+ "sched_getscheduler", "sched_setparam", "sched_setscheduler", "sched_yield",
/* These come from <time.h>. */
"asctime", "asctime_r", "clock", "clock_getres", "clock_gettime",
"clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r",
diff -urN glibc-2.2.5/posix/sched.h glibc/posix/sched.h
--- glibc-2.2.5/posix/sched.h Thu Jul 5 21:55:38 2001
+++ glibc/posix/sched.h Fri May 24 09:08:06 2002
@@ -62,6 +62,14 @@
/* Get the SCHED_RR interval for the named process. */
extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
+/* Set the CPU affinity for a task */
+extern int sched_setaffinity (__pid_t __pid, unsigned long __len,
+ unsigned long * __mask) __THROW;
+
+/* Get the CPU affinity for a task */
+extern int sched_getaffinity (__pid_t __pid, unsigned long __len,
+ unsigned long * __mask) __THROW;
+
__END_DECLS
#endif /* sched.h */
diff -urN glibc-2.2.5/sysdeps/generic/sched_geta.c glibc/sysdeps/generic/sched_geta.c
--- glibc-2.2.5/sysdeps/generic/sched_geta.c Wed Dec 31 16:00:00 1969
+++ glibc/sysdeps/generic/sched_geta.c Fri May 24 09:16:25 2002
@@ -0,0 +1,34 @@
+/* Copyright (C) 2002 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
+ 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 <sys/types.h>
+#include <sched.h>
+
+
+/* Retrieve the CPU affinity mask for a particular process. */
+int
+__sched_getaffinity (pid_t pid, unsigned long len, unsigned long * mask)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_getaffinity)
+
+weak_alias (__sched_getaffinity, sched_getaffinity)
+#include <stub-tag.h>
diff -urN glibc-2.2.5/sysdeps/generic/sched_seta.c glibc/sysdeps/generic/sched_seta.c
--- glibc-2.2.5/sysdeps/generic/sched_seta.c Wed Dec 31 16:00:00 1969
+++ glibc/sysdeps/generic/sched_seta.c Fri May 24 09:16:49 2002
@@ -0,0 +1,34 @@
+/* Copyright (C) 2002 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
+ 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 <sys/types.h>
+#include <sched.h>
+
+
+/* Retrieve the CPU affinity mask for a particular process. */
+int
+__sched_setaffinity (pid_t pid, unsigned long len, unsigned long * mask)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sched_setaffinity)
+
+weak_alias (__sched_setaffinity, sched_setaffinity)
+#include <stub-tag.h>
diff -urN glibc-2.2.5/sysdeps/unix/sysv/linux/syscalls.list glibc/sysdeps/unix/sysv/linux/syscalls.list
--- glibc-2.2.5/sysdeps/unix/sysv/linux/syscalls.list Thu Apr 19 16:24:46 2001
+++ glibc/sysdeps/unix/sysv/linux/syscalls.list Fri May 24 09:19:41 2002
@@ -39,11 +39,13 @@
prctl EXTRA prctl i:iiiii prctl
query_module EXTRA query_module i:sipip query_module
quotactl EXTRA quotactl i:isip quotactl
+sched_geta - sched_getaffinity i:iip __sched_getaffinity sched_getaffinity
sched_getp - sched_getparam i:ip __sched_getparam sched_getparam
sched_gets - sched_getscheduler i:i __sched_getscheduler sched_getscheduler
sched_primax - sched_get_priority_max i:i __sched_get_priority_max sched_get_priority_max
sched_primin - sched_get_priority_min i:i __sched_get_priority_min sched_get_priority_min
sched_rr_gi - sched_rr_get_interval i:ip __sched_rr_get_interval sched_rr_get_interval
+sched_seta - sched_setaffinity i:iip __sched_setaffinity sched_setaffinity
sched_setp - sched_setparam i:ip __sched_setparam sched_setparam
sched_sets - sched_setscheduler i:iip __sched_setscheduler sched_setscheduler
sched_yield - sched_yield i: __sched_yield sched_yield
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |