From f3721ab2dce137e67579959d8992a251d35dcdb7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 6 Dec 2008 06:05:54 +0000 Subject: [PATCH] * posix/globtest.sh: Use mktemp to create temporary file and directory. --- ChangeLog | 3 +++ posix/globtest.sh | 9 +++------ sysdeps/unix/sysv/linux/bits/sched.h | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index d02615b78e..4e18b54de5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-12-05 Ulrich Drepper + * posix/globtest.sh: Use mktemp to create temporary file and + directory. + * sysdeps/unix/sysv/linux/bits/sched.h (__CPU_SET_S): Handle large sets correctly. (__CPU_CLR_S): Likewise. diff --git a/posix/globtest.sh b/posix/globtest.sh index ad47508a66..aadac87796 100755 --- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash common_objpfx=$1; shift elf_objpfx=$1; shift @@ -28,14 +28,11 @@ export LANG # Create the arena : ${TMPDIR=/tmp} -testdir=$TMPDIR/globtest-dir -testout=$TMPDIR/globtest-out +testdir=$(mktemp -d $TMPDIR/globtest-dir.XXXXXX) +testout=$(mktemp $TMPDIR/globtest-out.XXXXXX) trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 -test -d $testdir/noread && chmod 777 $testdir/noread -rm -fr $testdir 2>/dev/null -mkdir $testdir echo 1 > $testdir/file1 echo 2 > $testdir/file2 echo 3 > $testdir/-file3 diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h index 696b8ddf0a..95d05b4ab2 100644 --- a/sysdeps/unix/sysv/linux/bits/sched.h +++ b/sysdeps/unix/sysv/linux/bits/sched.h @@ -131,30 +131,30 @@ typedef struct do { \ size_t __i; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ - cpu_set_t *__arr = (cpusetp); \ + __cpu_mask *__bits = (cpusetp)->__bits; \ for (__i = 0; __i < __imax; ++__i) \ - __arr->__bits[__i] = 0; \ + __bits[__i] = 0; \ } while (0) # endif # define __CPU_SET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ - ? (((cpu_set_t *) (cpusetp))->__bits[__CPUELT (__cpu)] \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |= __CPUMASK (__cpu)) \ : 0; })) # define __CPU_CLR_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ - ? (((cpu_set_t *) (cpusetp))->__bits[__CPUELT (__cpu)] \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ &= ~__CPUMASK (__cpu)) \ : 0; })) # define __CPU_ISSET_S(cpu, setsize, cpusetp) \ (__extension__ \ ({ size_t __cpu = (cpu); \ __cpu < 8 * (setsize) \ - ? ((((cpu_set_t *) (cpusetp))->__bits[__CPUELT (__cpu)] \ + ? ((((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ & __CPUMASK (__cpu))) != 0 \ : 0; })) @@ -167,12 +167,12 @@ typedef struct # else # define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ (__extension__ \ - ({ cpu_set_t *__arr1 = (cpusetp1); \ - cpu_set_t *__arr2 = (cpusetp2); \ + ({ __cpu_mask *__arr1 = (cpusetp1)->__bits; \ + __cpu_mask *__arr2 = (cpusetp2)->__bits; \ size_t __imax = (setsize) / sizeof (__cpu_mask); \ size_t __i; \ for (__i = 0; __i < __imax; ++__i) \ - if (__arr1->__bits[__i] != __arr2->__bits[__i]) \ + if (__bits[__i] != __bits[__i]) \ break; \ __i == __imax; })) # endif @@ -180,12 +180,12 @@ typedef struct # define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ (__extension__ \ ({ cpu_set_t *__dest = (destset); \ - cpu_set_t *__arr1 = (srcset1); \ - cpu_set_t *__arr2 = (srcset2); \ + __cpu_mask *__arr1 = (srcset1)->__bits; \ + __cpu_mask *__arr2 = (srcset2)->__bits; \ 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]; \ + ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ __dest; })) # define __CPU_ALLOC_SIZE(count) \