From: Karel Zak Date: Fri, 2 Nov 2012 11:07:36 +0000 (+0100) Subject: build-sys: cleanup cpu_set_t usage X-Git-Tag: v2.23-rc1~569 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e21e6d265d3803e51db2be6a332a601280fce7a8;p=thirdparty%2Futil-linux.git build-sys: cleanup cpu_set_t usage - make taskset depend on cpu_set_t - make cpuset.c optional for libcommon and lib/path.c Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index fd5bc2e8de..727113a530 100644 --- a/configure.ac +++ b/configure.ac @@ -1184,6 +1184,7 @@ AM_CONDITIONAL(BUILD_IONICE, test "x$build_ionice" = xyes) UL_BUILD_INIT([taskset], [check]) UL_REQUIRES_BUILD([taskset], [schedutils]) +UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type]) UL_REQUIRES_SYSCALL_CHECK([taskset], [UL_CHECK_SYSCALL([sched_getaffinity])], [sched_getaffinity]) diff --git a/include/path.h b/include/path.h index 8e79a85604..3dfd517942 100644 --- a/include/path.h +++ b/include/path.h @@ -1,3 +1,6 @@ +#ifndef UTIL_LINUX_PATH_H +#define UTIL_LINUX_PATH_H + #include extern FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...) @@ -10,8 +13,15 @@ extern int path_getnum(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); extern int path_exist(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); + +#ifdef HAVE_CPU_SET_T +# include "cpuset.h" + extern cpu_set_t *path_cpuset(int, const char *path, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern cpu_set_t *path_cpulist(int, const char *path, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void path_setprefix(const char *); +#endif /* HAVE_CPU_SET_T */ + +#endif /* UTIL_LINUX_PATH_H */ diff --git a/lib/Makemodule.am b/lib/Makemodule.am index 3c89fb8f93..91f857ad37 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -6,7 +6,6 @@ libcommon_la_SOURCES = \ lib/blkdev.c \ lib/canonicalize.c \ lib/colors.c \ - lib/cpuset.c \ lib/crc32.c \ lib/env.c \ lib/fileutils.c \ @@ -36,6 +35,10 @@ if !HAVE_LANGINFO libcommon_la_SOURCES += lib/langinfo.c endif +if HAVE_CPU_SET_T +libcommon_la_SOURCES += lib/cpuset.c +endif + check_PROGRAMS += \ test_at \ test_blkdev \ diff --git a/lib/path.c b/lib/path.c index 8437c0220f..404eeeb240 100644 --- a/lib/path.c +++ b/lib/path.c @@ -28,7 +28,6 @@ #include #include "all-io.h" -#include "cpuset.h" #include "path.h" #include "nls.h" #include "c.h" @@ -151,6 +150,8 @@ path_exist(const char *path, ...) return access(p, F_OK) == 0; } +#ifdef HAVE_CPU_SET_T + static cpu_set_t * path_cpuparse(int maxcpus, int islist, const char *path, va_list ap) { @@ -209,6 +210,8 @@ path_cpulist(int maxcpus, const char *path, ...) return set; } +#endif /* HAVE_CPU_SET_T */ + void path_setprefix(const char *prefix) {