diff options
author | blueness <basile@opensource.dyc.edu> | 2012-12-31 20:24:27 -0800 |
---|---|---|
committer | blueness <basile@opensource.dyc.edu> | 2012-12-31 20:24:27 -0800 |
commit | 74852a5aeb2ca4c0414aaf69c7246c8cf2d8b6cf (patch) | |
tree | 2d3e6071ae217754eabc07ce279fd5d155479d89 | |
parent | 9e4b735b05840d472c6bd350e1c5b2d48836f1c1 (diff) | |
parent | bdd4de160c6b1252396db4b6531aa8c71e5b0698 (diff) |
Merge pull request #37 from lu-zero/master
configure.ac: require C99 and drop excess checks
src/libudev/cgroup-util.c: refacotirze cgroup_path
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
-rw-r--r-- | configure.ac | 32 | ||||
-rw-r--r-- | src/libudev/cgroup-util.c | 14 |
2 files changed, 18 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac index b1f6363283..bc863b3cd1 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,11 @@ AC_PROG_SED AC_PROG_GREP AC_PROG_AWK -AC_PROG_CC +AC_PROG_CC_C99 +AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [ + AC_MSG_ERROR([no C99 compiler found, $PACKAGE requires a C99 compiler.]) +]) + AC_PROG_CXX AC_PROG_CPP AC_PROG_INSTALL @@ -41,8 +45,8 @@ PKG_CHECK_MODULES(BLKID,[blkid >= 2.20]) # Checks for header files. AC_CHECK_HEADERS( - [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h malloc.h \ - netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/mount.h \ + [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \ + netinet/in.h sys/ioctl.h sys/mount.h \ sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h \ termios.h unistd.h], [], @@ -50,21 +54,11 @@ AC_CHECK_HEADERS( ) # Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL AC_TYPE_UID_T AC_C_INLINE -AC_TYPE_INT32_T -AC_TYPE_INT64_T AC_TYPE_MODE_T -AC_TYPE_OFF_T AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T -AC_TYPE_UINT8_T AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, accept4], [], [], [[#include <sys/types.h> #include <unistd.h> #include <sys/mount.h> @@ -73,25 +67,19 @@ AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, accept4], [], [], [[#incl # Checks for library functions. -AC_FUNC_ALLOCA AC_FUNC_CHOWN AC_FUNC_FORK AC_FUNC_FSEEKO AC_FUNC_GETGROUPS AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_HEADER_MAJOR -AC_FUNC_MALLOC AC_FUNC_MKTIME AC_FUNC_MMAP -AC_FUNC_REALLOC -AC_FUNC_STRNLEN -AC_FUNC_STRTOD AC_CHECK_FUNCS( - [alarm dup2 ftruncate localtime_r memchr memmove mempcpy memset \ - mkdir munmap nl_langinfo rmdir setlocale socket stpcpy strcasecmp \ - strchr strcspn strdup strerror strndup strpbrk strrchr strspn \ - strstr strtol strtoul strtoull uname], + [alarm dup2 ftruncate localtime_r mempcpy \ + mkdir munmap nl_langinfo rmdir setlocale socket stpcpy \ + uname], [], [AC_MSG_ERROR([*** POSIX function not found])] ) diff --git a/src/libudev/cgroup-util.c b/src/libudev/cgroup-util.c index b0d378de5a..19f9889c8a 100644 --- a/src/libudev/cgroup-util.c +++ b/src/libudev/cgroup-util.c @@ -37,6 +37,8 @@ #include "path-util.h" #include "strv.h" +static const char cgroup_path[] = "/sys/fs/cgroup/"; + int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) { char *fs; int r; @@ -522,13 +524,13 @@ static int join_path(const char *controller, const char *path, const char *suffi if (controller) { if (path && suffix) - t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL); + t = strjoin(cgroup_path, controller, "/", path, "/", suffix, NULL); else if (path) - t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL); + t = strjoin(cgroup_path, controller, "/", path, NULL); else if (suffix) - t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL); + t = strjoin(cgroup_path, controller, "/", suffix, NULL); else - t = strjoin("/sys/fs/cgroup/", controller, NULL); + t = strjoin(cgroup_path, controller, NULL); } else { if (path && suffix) t = strjoin(path, "/", suffix, NULL); @@ -572,8 +574,8 @@ static int check(const char *p) { assert(p); /* Check if this controller actually really exists */ - cc = alloca(sizeof("/sys/fs/cgroup/") + strlen(p)); - strcpy(stpcpy(cc, "/sys/fs/cgroup/"), p); + cc = alloca(sizeof(cgroup_path) + strlen(p)); + strcpy(stpcpy(cc, cgroup_path), p); if (access(cc, F_OK) < 0) return -errno; |