Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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.
- Loading branch information
Ulrich Drepper
committed
Jul 29, 2007
1 parent
a14ad5a
commit 44f08a6
Showing
7 changed files
with
200 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,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)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters