[patch] wrong second parameter on sched_set/getaffinity
Robert Love
rml@tech9.net
Thu Feb 6 18:36:00 GMT 2003
On Mon, 2002-11-25 at 21:28, Roland McGrath wrote:
> I believe all the 64-bit platforms (i.e. long!=int so this might matter at
> all) have register calling conventions where this change wouldn't matter.
> But someone responsible for each of those platforms should speak up.
Ulrich, I sent this awhile back and the above is as far as I ever got.
I am no expert on arch ABI's, but the long->int change should be safe,
no?
Basically, both the sched_getaffinity and sched_setaffinity calls are
prototyped in the kernel and existing applications as:
(pid_t, unsigned int, unsigned long *)
but glibc prototypes them as
(pid_t, unsigned long, unsigned long *)
which trivially breaks the compile even on 32-bit architectures.
Is there a reason we cannot merge this fix? Thanks.
Robert Love
-------------- next part --------------
ChangeLog | 7 +++++++
sched.h | 4 ++--
generic/sched_getaffinity.c | 2 +-
generic/sched_setaffinity.c | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
Index: ChangeLog
===================================================================
RCS file: /cvs/glibc/libc/ChangeLog,v
retrieving revision 1.6935
diff -u -r1.6935 ChangeLog
--- ChangeLog 25 Nov 2002 01:53:29 -0000 1.6935
+++ ChangeLog 25 Nov 2002 04:32:44 -0000
@@ -1,3 +1,10 @@
+2002-11-24 Robert Love <rml@tech9.net>
+
+ * posix/sched.h: second parameter of sched_setaffinity and
+ sched_getaffinity is `unsigned int', not `unsigned long'
+ * sysdeps/generic/sched_setaffinity.c: Likewise
+ * sysdeps/generic/sched_getaffinity.c: Likewise
+
2002-11-24 Ulrich Drepper <drepper@redhat.com>
* elf/elf.h (EM_ST19): Fix typo.
Index: posix/sched.h
===================================================================
RCS file: /cvs/glibc/libc/posix/sched.h,v
retrieving revision 1.11
diff -u -r1.11 sched.h
--- posix/sched.h 8 Aug 2002 07:45:30 -0000 1.11
+++ posix/sched.h 25 Nov 2002 04:32:55 -0000
@@ -65,11 +65,11 @@
#ifdef __USE_GNU
/* Set the CPU affinity for a task */
-extern int sched_setaffinity (__pid_t __pid, unsigned long int __len,
+extern int sched_setaffinity (__pid_t __pid, unsigned int __len,
unsigned long int *__mask) __THROW;
/* Get the CPU affinity for a task */
-extern int sched_getaffinity (__pid_t __pid, unsigned long int __len,
+extern int sched_getaffinity (__pid_t __pid, unsigned int __len,
unsigned long int *__mask) __THROW;
#endif
Index: sysdeps/generic/sched_getaffinity.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/sched_getaffinity.c,v
retrieving revision 1.1
diff -u -r1.1 sched_getaffinity.c
--- sysdeps/generic/sched_getaffinity.c 8 Aug 2002 07:43:50 -0000 1.1
+++ sysdeps/generic/sched_getaffinity.c 25 Nov 2002 04:33:00 -0000
@@ -25,7 +25,7 @@
int
sched_getaffinity (pid, len, mask)
pid_t pid;
- unsigned long int len;
+ unsigned int len;
unsigned long int *mask;
{
__set_errno (ENOSYS);
Index: sysdeps/generic/sched_setaffinity.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/sched_setaffinity.c,v
retrieving revision 1.1
diff -u -r1.1 sched_setaffinity.c
--- sysdeps/generic/sched_setaffinity.c 8 Aug 2002 07:44:20 -0000 1.1
+++ sysdeps/generic/sched_setaffinity.c 25 Nov 2002 04:33:00 -0000
@@ -25,7 +25,7 @@
int
sched_setaffinity (pid, len, mask)
pid_t pid;
- unsigned long int len;
+ unsigned int len;
unsigned long int *mask;
{
__set_errno (ENOSYS);
More information about the Libc-alpha
mailing list