[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r2980 - in /fsf/trunk/libc: ./ io/ nptl/sysdeps/unix/sysv/linux/i386/ posix/ sysdeps/unix/sysv/linux/bits/



Author: eglibc
Date: Mon Jul 30 00:03:55 2007
New Revision: 2980

Log:
Import glibc-mainline for 2007-07-30

Added:
    fsf/trunk/libc/posix/sched_cpualloc.c
    fsf/trunk/libc/posix/sched_cpufree.c
    fsf/trunk/libc/posix/tst-cpuset.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/io/Makefile
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/posix/Versions
    fsf/trunk/libc/posix/sched.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Jul 30 00:03:55 2007
@@ -1,3 +1,23 @@
+2007-07-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4860]
+	* io/Makefile (headers): Add bits/fcntl2.h.
+
+	* sysdeps/unix/sysv/linux/bits/sched.h (__CPU_ZERO_S): Optimize
+	using gcc builtin.
+	(__CPU_EQUAL_S): Likewise.
+
+	* posix/Makefile (routines): Add sched_cpualloc and sched_cpufree.
+	(tests): Add tst-cpuset.
+	* posix/sched_cpualloc.c: New file.
+	* posix/sched_cpufree.c: New file.
+	* posix/tst-cpuset.c: New file.
+	* posix/Versions: Export __sched_cpualloc and __sched_cpufree for
+	GLIBC_2.7.
+	* sysdeps/unix/sysv/linux/bits/sched.h: Define __CPU_*_S macros.
+	* posix/sched.h: Define old CPU_* macros in temers of __CPU_*_S
+	macros.  Define CPU_*_S macros.
+
 2007-07-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* posix/getconf.c (vars): Add missing _SC_LEVEL4_CACHE_LINESIZE

Modified: fsf/trunk/libc/io/Makefile
==============================================================================
--- fsf/trunk/libc/io/Makefile (original)
+++ fsf/trunk/libc/io/Makefile Mon Jul 30 00:03:55 2007
@@ -23,7 +23,7 @@
 
 headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
 	   sys/statvfs.h bits/statvfs.h fcntl.h sys/fcntl.h bits/fcntl.h \
-	   poll.h sys/poll.h bits/poll.h \
+	   poll.h sys/poll.h bits/poll.h bits/fcntl2.h \
 	   utime.h ftw.h fts.h sys/sendfile.h
 
 routines :=								\

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h Mon Jul 30 00:03:55 2007
@@ -48,6 +48,33 @@
    reversed before passing to the system call.  */
 #define LLL_PRIVATE	0
 #define LLL_SHARED	FUTEX_PRIVATE_FLAG
+
+
+#if !defined NOT_IN_libc || defined IS_IN_rtld
+/* In libc.so or ld.so all futexes are private.  */
+# ifdef __ASSUME_PRIVATE_FUTEX
+#  define __lll_private_flag(fl, private) \
+  ((fl) | FUTEX_PRIVATE_FLAG)
+# else
+#  define __lll_private_flag(fl, private) \
+  ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
+# endif
+#else
+# ifdef __ASSUME_PRIVATE_FUTEX
+#  define __lll_private_flag(fl, private) \
+  (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
+# else
+#  define __lll_private_flag(fl, private) \
+  (__builtin_constant_p (private)					      \
+   ? ((private) == 0							      \
+      ? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))	      \
+      : (fl))								      \
+   : ({ unsigned int __fl = ((private) ^ FUTEX_PRIVATE_FLAG);		      \
+	asm ("andl %%fs:%P1, %0" : "+r" (__fl)				      \
+	     : "i" (offsetof (struct pthread, header.private_futex)));	      \
+	__fl | (fl); }))
+# endif	      
+#endif
 
 
 /* Initializer for compatibility lock.  */
@@ -167,8 +194,8 @@
 		      LLL_EBX_LOAD					      \
 		      : "=a" (__status)					      \
 		      : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout),  \
-			"c" (FUTEX_WAIT), "d" (_val),			      \
-			"i" (offsetof (tcbhead_t, sysinfo))		      \
+			"c" (__lll_private_flag (FUTEX_WAIT, private)),	      \
+			"d" (_val), "i" (offsetof (tcbhead_t, sysinfo))	      \
 		      : "memory");					      \
     __status;								      \
   })
@@ -183,81 +210,11 @@
 		      LLL_EBX_LOAD					      \
 		      : "=a" (__ignore)					      \
 		      : "0" (SYS_futex), LLL_EBX_REG (futex),		      \
-			"c" (FUTEX_WAKE), "d" (_nr),			      \
+			"c" (__lll_private_flag (FUTEX_WAKE, private)),	      \
+			"d" (_nr),					      \
 			"i" (0) /* phony, to align next arg's number */,      \
 			"i" (offsetof (tcbhead_t, sysinfo)));		      \
   } while (0)
-
-
-#define lll_private_futex_wait(futex, val) \
-  lll_private_futex_timed_wait (futex, val, NULL)
-
-
-#ifdef __ASSUME_PRIVATE_FUTEX
-# define lll_private_futex_timed_wait(futex, val, timeout) \
-  ({									      \
-    int __status;							      \
-    register __typeof (val) _val asm ("edx") = (val);			      \
-    __asm __volatile (LLL_EBX_LOAD					      \
-		      LLL_ENTER_KERNEL					      \
-		      LLL_EBX_LOAD					      \
-		      : "=a" (__status)					      \
-		      : "0" (SYS_futex), LLL_EBX_REG (futex), "S" (timeout),  \
-			"c" (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)), "d" (_val),   \
-			"i" (offsetof (tcbhead_t, sysinfo))		      \
-		      : "memory");					      \
-    __status;								      \
-  })
-
-
-# define lll_private_futex_wake(futex, nr) \
-  do {									      \
-    int __ignore;							      \
-    register __typeof (nr) _nr asm ("edx") = (nr);			      \
-    __asm __volatile (LLL_EBX_LOAD					      \
-		      LLL_ENTER_KERNEL					      \
-		      LLL_EBX_LOAD					      \
-		      : "=a" (__ignore)					      \
-		      : "0" (SYS_futex), LLL_EBX_REG (futex),		      \
-			"c" (FUTEX_WAKE | FUTEX_PRIVATE_FLAG), "d" (_nr),     \
-			"i" (0) /* phony, to align next arg's number */,      \
-			"i" (offsetof (tcbhead_t, sysinfo)));		      \
-  } while (0)
-#else
-# define lll_private_futex_timed_wait(futex, val, timeout) \
-  ({									      \
-    int __status;							      \
-    int __ignore;							      \
-    register __typeof (val) _val asm ("edx") = (val);			      \
-    __asm __volatile ("movl %%gs:%P7, %%ecx\n\t"			      \
-		      LLL_EBX_LOAD					      \
-		      LLL_ENTER_KERNEL					      \
-		      LLL_EBX_LOAD					      \
-		      : "=a" (__status), "=c" (__ignore)		      \
-		      : LLL_EBX_REG (futex), "0" (SYS_futex), "S" (timeout),  \
-			"d" (_val), "i" (offsetof (tcbhead_t, sysinfo)),      \
-			"i" (PRIVATE_FUTEX)				      \
-		      : "memory");					      \
-    __status;								      \
-  })
-
-
-# define lll_private_futex_wake(futex, nr) \
-  do {									      \
-    int __ignore;							      \
-    int __ignore2;							      \
-    register __typeof (nr) _nr asm ("edx") = (nr);			      \
-    __asm __volatile ("orl %%gs:%P7, %%ecx\n\t"				      \
-		      LLL_EBX_LOAD					      \
-		      LLL_ENTER_KERNEL					      \
-		      LLL_EBX_LOAD					      \
-		      : "=a" (__ignore), "=c" (__ignore2)		      \
-		      : LLL_EBX_REG (futex), "0" (SYS_futex),		      \
-			"1" (FUTEX_WAKE), "d" (_nr),			      \
-			"i" (offsetof (tcbhead_t, sysinfo)),		      \
-			"i" (PRIVATE_FUTEX));				      \
-  } while (0)
-#endif
 
 
 /* Does not preserve %eax and %ecx.  */

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Mon Jul 30 00:03:55 2007
@@ -66,7 +66,7 @@
 	spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
 	spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
 	posix_madvise							      \
-	get_child_max sched_cpucount
+	get_child_max sched_cpucount sched_cpualloc sched_cpufree
 
 include ../Makeconfig
 
@@ -90,7 +90,7 @@
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
 		   tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
-		   tst-getaddrinfo3 tst-fnmatch2 tst-cpucount
+		   tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset
 xtests		:= bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs	:= globtest

Modified: fsf/trunk/libc/posix/Versions
==============================================================================
--- fsf/trunk/libc/posix/Versions (original)
+++ fsf/trunk/libc/posix/Versions Mon Jul 30 00:03:55 2007
@@ -125,6 +125,9 @@
   GLIBC_2.6 {
     __sched_cpucount;
   }
+  GLIBC_2.7 {
+    __sched_cpualloc; __sched_cpufree;
+  }
   GLIBC_PRIVATE {
     __libc_fork; __libc_pwrite;
   }

Modified: fsf/trunk/libc/posix/sched.h
==============================================================================
--- fsf/trunk/libc/posix/sched.h (original)
+++ fsf/trunk/libc/posix/sched.h Mon Jul 30 00:03:55 2007
@@ -69,11 +69,41 @@
 #ifdef __USE_GNU
 /* Access macros for `cpu_set'.  */
 # define CPU_SETSIZE __CPU_SETSIZE
-# define CPU_SET(cpu, cpusetp)	 __CPU_SET (cpu, cpusetp)
-# define CPU_CLR(cpu, cpusetp)	 __CPU_CLR (cpu, cpusetp)
-# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp)
-# define CPU_ZERO(cpusetp)	 __CPU_ZERO (cpusetp)
-# define CPU_COUNT(cpusetp)	 __CPU_COUNT (cpusetp)
+# define CPU_SET(cpu, cpusetp)	 __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
+# define CPU_CLR(cpu, cpusetp)	 __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
+# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
+						cpusetp)
+# define CPU_ZERO(cpusetp)	 __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
+# define CPU_COUNT(cpusetp)	 __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
+
+# define CPU_SET_S(cpu, setsize, cpusetp)   __CPU_SET_S (cpu, setsize, cpusetp)
+# define CPU_CLR_S(cpu, setsize, cpusetp)   __CPU_CLR_S (cpu, setsize, cpusetp)
+# define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
+							   cpusetp)
+# define CPU_ZERO_S(setsize, cpusetp)	    __CPU_ZERO_S (setsize, cpusetp)
+# define CPU_COUNT_S(setsize, cpusetp)	    __CPU_COUNT_S (setsize, cpusetp)
+
+# define CPU_EQUAL(cpusetp1, cpusetp2) \
+  __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
+# define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+  __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
+
+# define CPU_AND(destset, srcset1, srcset2) \
+  __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
+# define CPU_OR(destset, srcset1, srcset2) \
+  __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
+# define CPU_XOR(destset, srcset1, srcset2) \
+  __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
+# define CPU_AND_S(setsize, destset, srcset1, srcset2) \
+  __CPU_OP_S (setsize, destset, srcset1, srcset2, &)
+# define CPU_OR_S(setsize, destset, srcset1, srcset2) \
+  __CPU_OP_S (setsize, destset, srcset1, srcset2, |)
+# define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
+  __CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
+
+# define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
+# define CPU_ALLOC(count) __CPU_ALLOC (count)
+# define CPU_FREE(count) __CPU_FREE (count)
 
 
 /* Set the CPU affinity for a task */

Added: fsf/trunk/libc/posix/sched_cpualloc.c
==============================================================================
--- fsf/trunk/libc/posix/sched_cpualloc.c (added)
+++ fsf/trunk/libc/posix/sched_cpualloc.c Mon Jul 30 00:03:55 2007
@@ -1,0 +1,27 @@
+/* Copyright (C) 2007 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 <sched.h>
+#include <stdlib.h>
+
+
+cpu_set_t *
+__sched_cpualloc (size_t count)
+{
+  return malloc (CPU_ALLOC_SIZE (count));
+}

Added: fsf/trunk/libc/posix/sched_cpufree.c
==============================================================================
--- fsf/trunk/libc/posix/sched_cpufree.c (added)
+++ fsf/trunk/libc/posix/sched_cpufree.c Mon Jul 30 00:03:55 2007
@@ -1,0 +1,27 @@
+/* Copyright (C) 2007 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 <sched.h>
+#include <stdlib.h>
+
+
+void
+__sched_cpufree (cpu_set_t *set)
+{
+  free (set);
+}

Added: fsf/trunk/libc/posix/tst-cpuset.c
==============================================================================
--- fsf/trunk/libc/posix/tst-cpuset.c (added)
+++ fsf/trunk/libc/posix/tst-cpuset.c Mon Jul 30 00:03:55 2007
@@ -1,0 +1,82 @@
+#include <sched.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+  int result = 0;
+
+  cpu_set_t s1;
+  cpu_set_t s2;
+  cpu_set_t s3;
+
+  CPU_ZERO (&s1);
+  CPU_SET (0, &s1);
+
+  CPU_ZERO (&s2);
+  CPU_SET (0, &s2);
+  CPU_SET (1, &s2);
+
+  CPU_AND (&s3, &s1, &s2);
+  if (! CPU_EQUAL (&s3, &s1))
+    {
+      puts ("result of CPU_AND wrong");
+      result = 1;
+    }
+
+  CPU_OR (&s3, &s1, &s2);
+  if (! CPU_EQUAL (&s3, &s2))
+    {
+      puts ("result of CPU_OR wrong");
+      result = 1;
+    }
+
+  CPU_XOR (&s3, &s1, &s2);
+  if (CPU_COUNT (&s3) != 1)
+    {
+      puts ("result of CPU_XOR wrong");
+      result = 1;
+    }
+
+  cpu_set_t *vs1 = CPU_ALLOC (2048);
+  cpu_set_t *vs2 = CPU_ALLOC (2048);
+  cpu_set_t *vs3 = CPU_ALLOC (2048);
+  size_t vssize = CPU_ALLOC_SIZE (2048);
+
+  CPU_ZERO_S (vssize, vs1);
+  CPU_SET_S (0, vssize, vs1);
+
+  CPU_ZERO_S (vssize, vs2);
+  CPU_SET_S (0, vssize, vs2);
+  CPU_SET_S (2047, vssize, vs2);
+
+  CPU_AND_S (vssize, vs3, vs1, vs2);
+  if (! CPU_EQUAL_S (vssize, vs3, vs1))
+    {
+      puts ("result of CPU_AND_S wrong");
+      result = 1;
+    }
+
+  CPU_OR_S (vssize, vs3, vs1, vs2);
+  if (! CPU_EQUAL_S (vssize, vs3, vs2))
+    {
+      puts ("result of CPU_OR_S wrong");
+      result = 1;
+    }
+
+  CPU_XOR_S (vssize, vs3, vs1, vs2);
+  if (CPU_COUNT_S (vssize, vs3) != 1)
+    {
+      puts ("result of CPU_XOR_S wrong");
+      result = 1;
+    }
+
+  CPU_FREE (vs1);
+  CPU_FREE (vs2);
+  CPU_FREE (vs3);
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h Mon Jul 30 00:03:55 2007
@@ -104,7 +104,7 @@
 # define __CPU_SETSIZE	1024
 # define __NCPUBITS	(8 * sizeof (__cpu_mask))
 
-/* Type for array elements in 'cpu_set'.  */
+/* Type for array elements in 'cpu_set_t'.  */
 typedef unsigned long int __cpu_mask;
 
 /* Basic access functions.  */
@@ -118,27 +118,72 @@
 } cpu_set_t;
 
 /* Access functions for CPU masks.  */
-# define __CPU_ZERO(cpusetp) \
+# if __GNUC_PREREQ (2, 91)
+#  define __CPU_ZERO_S(setsize, cpusetp) \
+  do __builtin_memset (cpusetp, '\0', setsize); while (0)
+# else
+#  define __CPU_ZERO_S(setsize, cpusetp) \
   do {									      \
-    unsigned int __i;							      \
+    size_t __i;								      \
+    size_t __imax = (setsize) / sizeof (__cpu_mask);			      \
     cpu_set_t *__arr = (cpusetp);					      \
-    for (__i = 0; __i < sizeof (cpu_set_t) / sizeof (__cpu_mask); ++__i)      \
+    for (__i = 0; __i < __imax; ++__i)					      \
       __arr->__bits[__i] = 0;						      \
   } while (0)
-# define __CPU_SET(cpu, cpusetp) \
-  ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu))
-# define __CPU_CLR(cpu, cpusetp) \
-  ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu))
-# define __CPU_ISSET(cpu, cpusetp) \
-  (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0)
+# endif
+# define __CPU_SET_S(cpu, setsize, cpusetp) \
+  ({ size_t __cpu = (cpu);						      \
+     __cpu < 8 * (setsize)						      \
+     ? ((cpusetp)->__bits[__CPUELT (__cpu)] |= __CPUMASK (__cpu)) : 0; })
+# define __CPU_CLR_S(cpu, setsize, cpusetp) \
+  ({ size_t __cpu = (cpu);						      \
+     __cpu < 8 * (setsize)						      \
+     ? ((cpusetp)->__bits[__CPUELT (__cpu)] &= ~__CPUMASK (__cpu)) : 0; })
+# define __CPU_ISSET_S(cpu, setsize, cpusetp) \
+  ({ size_t __cpu = (cpu);						      \
+     __cpu < 8 * (setsize)						      \
+     ? (((cpusetp)->__bits[__CPUELT (__cpu)] & __CPUMASK (__cpu))) != 0 : 0; })
+
+# define __CPU_COUNT_S(setsize, cpusetp) \
+  __sched_cpucount (setsize, cpusetp)
+
+# if __GNUC_PREREQ (2, 91)
+#  define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+  (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
+# else
+#  define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+  ({ cpu_set_t *__arr1 = (cpusetp1);					      \
+     cpu_set_t *__arr2 = (cpusetp2);					      \
+     size_t __imax = (setsize) / sizeof (__cpu_mask);			      \
+     size_t __i;							      \
+     for (__i = 0; __i < __imax; ++__i)					      \
+       if (__arr1->__bits[__i] != __arr2->__bits[__i])			      \
+	 break;								      \
+     __i == __imax; })
+# endif
+
+# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
+  ({ cpu_set_t *__dest = (destset);					      \
+     cpu_set_t *__arr1 = (srcset1);					      \
+     cpu_set_t *__arr2 = (srcset2);					      \
+     size_t __imax = (setsize) / sizeof (__cpu_mask);			      \
+     size_t __i;							      \
+     for (__i = 0; __i < __imax; ++__i)					      \
+       __dest->__bits[__i] = __arr1->__bits[__i] op __arr2->__bits[__i];      \
+     __dest; })
+
+# define __CPU_ALLOC_SIZE(count) \
+  ((((count) + __NCPUBITS - 1) / __NCPUBITS) * 8)
+# define __CPU_ALLOC(count) __sched_cpualloc (count)
+# define __CPU_FREE(cpuset) __sched_cpufree (cpuset)
 
 __BEGIN_DECLS
 
 extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
   __THROW;
+extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
+extern void __sched_cpufree (cpu_set_t *__set) __THROW;
 
 __END_DECLS
 
-# define __CPU_COUNT(cpusetp) \
-  __sched_cpucount (sizeof (cpu_set_t), cpusetp)
 #endif