summaryrefslogtreecommitdiffstats
path: root/lib/cpuset.c
Commit message (Collapse)AuthorAgeFilesLines
* lib,cpuset: fix compiler warning [-Wuninitialized]Karel Zak2011-09-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* chcpu,cpuset: reduce code duplication for cpu list parsingHeiko Carstens2011-09-101-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>
* lib,cpuset: enforce stricter parsing of cpu listsHeiko Carstens2011-09-101-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>
* lib,cpuset: fix stride handling in cpulist_parse()Heiko Carstens2011-09-101-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>
* lib,cpuset: fix odd placed braces in cpulist_parse()Heiko Carstens2011-09-101-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>
* lib,cpuset: fix comments for cpu mask/list functionsHeiko Carstens2011-09-101-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>
* cpuset: add option to allow cpulist_parse() to failHeiko Carstens2011-08-151-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>
* lib: [cpuset.c] fix compiler warnings [-Wsign-compare]Karel Zak2011-08-011-9/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* move struct option to .rodataKarel Zak2011-03-031-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>
* tests: [cpuset] call free() for rangeKarel Zak2011-02-171-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>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-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>
* remove duplicate includesKarel Zak2011-01-041-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move NR_CPUS determination to lib/cpuset.cKarel Zak2010-06-011-1/+40
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add fallback for libc (uClibc) without CPU_ALLOCKarel Zak2010-06-011-0/+33
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: use libc based cpu_set_tKarel Zak2010-06-011-109/+106Star
| | | | | | | 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>
* tests: add cpuset regression testKarel Zak2010-06-011-0/+70
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* taskset: move bitmap routines to lib/cpuset.cKarel Zak2010-06-011-0/+241
Signed-off-by: Karel Zak <kzak@redhat.com>