]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: cleanup cpu_set_t usage
authorKarel Zak <kzak@redhat.com>
Fri, 2 Nov 2012 11:07:36 +0000 (12:07 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 2 Nov 2012 11:07:36 +0000 (12:07 +0100)
 - make taskset depend on cpu_set_t
 - make cpuset.c optional for libcommon and lib/path.c

Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
include/path.h
lib/Makemodule.am
lib/path.c

index fd5bc2e8de6548b69cacd6c47d2d8710a57b17a0..727113a530624d35145da9f1c92fbb205cf46ee6 100644 (file)
@@ -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])
index 8e79a856044ccf43a5b2cea3212d29922fed3e49..3dfd5179423b57d400d7ca0e62a36aa6e3a5bebc 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef UTIL_LINUX_PATH_H
+#define UTIL_LINUX_PATH_H
+
 #include <stdio.h>
 
 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 */
index 3c89fb8f93132e8f834e95525e06e65f6e7b0c25..91f857ad37b8b90fefe8924f5897279de102f905 100644 (file)
@@ -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 \
index 8437c0220f54037cdea9b6a93ef888aa659f9162..404eeeb240d176c73a4cfd5e04b42c7ac451e419 100644 (file)
@@ -28,7 +28,6 @@
 #include <errno.h>
 
 #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)
 {