summaryrefslogtreecommitdiff
path: root/lib/cpuset.c
AgeCommit message (Collapse)AuthorFilesLines
2013-01-08include: cleanup copyright headersKarel Zak1-0/+3
We use the code from include/ and lib/ on many places, so use public domain if possible or LGPL for code copied from libs. Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-13Fix non-Linux buildSamuel Thibault1-0/+2
loopdev.c, test_pager, and get_max_number_of_cpus() are linux-specific. get_linux_version will only work on Linux, let's introduce system_supports_ext4_ext2() which assumes that mounting ext2 with ext4 is not supported on non-Linux systems. [kzak@redhat.com: - use #ifdef SYS_sched_getaffinity rather than __linux__] Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-10lib,cpuset: fix compiler warning [-Wuninitialized]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-10chcpu,cpuset: reduce code duplication for cpu list parsingHeiko Carstens1-1/+6
Reduce code duplication and print better error message if an unsupported cpu number was passed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10lib,cpuset: enforce stricter parsing of cpu listsHeiko Carstens1-4/+8
The current cpulist_parse() function ignores extra non-parsable characters at the end of the to be parsed cpu list string. E.g. it would accept something like "0bla" and just set bit 0 in the cpu set. Since such a string is invalid implement stricter parsing that makes sure that everything of the string has been succesfully parsed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10lib,cpuset: fix stride handling in cpulist_parse()Heiko Carstens1-0/+2
If cpulist_parse() gets passed a cpu list with a stride value of 0 it will be stuck in an endless loop. E.g. the following cpu list will cause an endless loop: "0-2:0". Fix this by causing a parse error if the stride value is 0. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10lib,cpuset: fix odd placed braces in cpulist_parse()Heiko Carstens1-2/+2
The opening and closing braces for two following if statements within cpulist_parse() are placed in an odd manner. Just fix this to prevent broken code in the future. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10lib,cpuset: fix comments for cpu mask/list functionsHeiko Carstens1-2/+2
The comments for cpumask_parse() and cpulist_parse() each describe the wrong function. Just exchange the comments. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-15cpuset: add option to allow cpulist_parse() to failHeiko Carstens1-2/+5
This is a preparation patch for chcpu. If a cpu should be added to a cpu_set where the cpu doesn't fit into the cpu_set this got silently ignored. Since the cpu-list is user space provided it should be checked if cpus are specified that are completely out of range of the system. In order to do that add a parameter which specifies if cpulist_parse() should fail if it parses a cpu-list with "impossible" cpus. The current callers have been converted so they behave like before. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-01lib: [cpuset.c] fix compiler warnings [-Wsign-compare]Karel Zak1-9/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03move struct option to .rodataKarel Zak1-1/+1
It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-17tests: [cpuset] call free() for rangeKarel Zak1-0/+1
The free() before exit() is not so important, but let's keep the example code nice and consistent. Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-14build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen1-1/+1
Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-01-04remove duplicate includesKarel Zak1-1/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01taskset: move NR_CPUS determination to lib/cpuset.cKarel Zak1-1/+40
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01lib: add fallback for libc (uClibc) without CPU_ALLOCKarel Zak1-0/+33
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01taskset: use libc based cpu_set_tKarel Zak1-109/+106
The glibc already supports dynamically allocated CPU sets. We don't have to maintains our private non-compatible implementation. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01tests: add cpuset regression testKarel Zak1-0/+70
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01taskset: move bitmap routines to lib/cpuset.cKarel Zak1-0/+241
Signed-off-by: Karel Zak <kzak@redhat.com>