From ee104e11e303499a637c5cd8157bd12ad5cc116d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 00:42:07 +0100 Subject: user-util: move UID/GID related macros from macro.h to user-util.h --- src/basic/macro.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/macro.h b/src/basic/macro.h index f55d65e2f1..eeb57ecb8e 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -295,14 +295,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define PTR_TO_SIZE(p) ((size_t) ((uintptr_t) (p))) #define SIZE_TO_PTR(u) ((void *) ((uintptr_t) (u))) -/* The following macros add 1 when converting things, since UID 0 is a - * valid UID, while the pointer NULL is special */ -#define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1)) -#define UID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1)) - -#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1)) -#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1)) - #define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p)) #define PID_TO_PTR(p) ((void*) ((uintptr_t) p)) @@ -466,8 +458,6 @@ do { \ #endif #endif -#define UID_INVALID ((uid_t) -1) -#define GID_INVALID ((gid_t) -1) #define MODE_INVALID ((mode_t) -1) #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ -- cgit v1.2.3-54-g00ecf From ceee6d3a44a81bcf42b21b777302a226422b11a1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 00:50:14 +0100 Subject: process-util: move PID related macros from macro.h to process-util.h --- src/basic/macro.h | 3 --- src/basic/process-util.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/macro.h b/src/basic/macro.h index eeb57ecb8e..44ae1f157a 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -295,9 +295,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define PTR_TO_SIZE(p) ((size_t) ((uintptr_t) (p))) #define SIZE_TO_PTR(u) ((void *) ((uintptr_t) (u))) -#define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p)) -#define PID_TO_PTR(p) ((void*) ((uintptr_t) p)) - #define memzero(x,l) (memset((x), 0, (l))) #define zero(x) (memzero(&(x), sizeof(x))) diff --git a/src/basic/process-util.h b/src/basic/process-util.h index d17df5d81f..db32a34ef3 100644 --- a/src/basic/process-util.h +++ b/src/basic/process-util.h @@ -68,3 +68,6 @@ bool pid_is_alive(pid_t pid); bool pid_is_unwaited(pid_t pid); bool is_main_thread(void); + +#define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p)) +#define PID_TO_PTR(p) ((void*) ((uintptr_t) p)) -- cgit v1.2.3-54-g00ecf From afc5dbf37fd2399d37976388d9dd9ab470ecf446 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:02:30 +0100 Subject: io-util.h: move iovec stuff from macro.h to io-util.h --- src/basic/io-util.h | 39 ++++++++++++++++++++++++++++++++++- src/basic/log.c | 1 + src/basic/macro.h | 41 ++----------------------------------- src/core/show-status.c | 1 + src/journal/coredump.c | 1 + src/journal/journald-audit.c | 3 ++- src/journal/journald-console.c | 1 + src/journal/journald-kmsg.c | 1 + src/journal/journald-native.c | 1 + src/journal/journald-server.c | 1 + src/journal/journald-stream.c | 1 + src/journal/journald-syslog.c | 1 + src/libsystemd/sd-bus/bus-message.c | 1 + src/resolve/resolved-dns-stream.c | 1 + 14 files changed, 53 insertions(+), 41 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/io-util.h b/src/basic/io-util.h index ff7c2a9ac4..cd2aa75ad2 100644 --- a/src/basic/io-util.h +++ b/src/basic/io-util.h @@ -21,8 +21,9 @@ along with systemd; If not, see . ***/ -#include #include +#include +#include #include "time-util.h" @@ -37,3 +38,39 @@ int pipe_eof(int fd); int fd_wait_for_event(int fd, int event, usec_t timeout); ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length); + +#define IOVEC_SET_STRING(i, s) \ + do { \ + struct iovec *_i = &(i); \ + char *_s = (char *)(s); \ + _i->iov_base = _s; \ + _i->iov_len = strlen(_s); \ + } while(false) + +static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) { + unsigned j; + size_t r = 0; + + for (j = 0; j < n; j++) + r += i[j].iov_len; + + return r; +} + +static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) { + unsigned j; + + for (j = 0; j < n; j++) { + size_t sub; + + if (_unlikely_(k <= 0)) + break; + + sub = MIN(i[j].iov_len, k); + i[j].iov_len -= sub; + i[j].iov_base = (uint8_t*) i[j].iov_base + sub; + k -= sub; + } + + return k; +} diff --git a/src/basic/log.c b/src/basic/log.c index c99746f916..4583cb840f 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -33,6 +33,7 @@ #include "fd-util.h" #include "formats-util.h" +#include "io-util.h" #include "log.h" #include "macro.h" #include "missing.h" diff --git a/src/basic/macro.h b/src/basic/macro.h index 44ae1f157a..c9bbe8df4b 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -22,11 +22,10 @@ ***/ #include -#include -#include -#include #include #include +#include +#include #define _printf_(a,b) __attribute__ ((format (printf, a, b))) #define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__))) @@ -302,42 +301,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define char_array_0(x) x[sizeof(x)-1] = 0; -#define IOVEC_SET_STRING(i, s) \ - do { \ - struct iovec *_i = &(i); \ - char *_s = (char *)(s); \ - _i->iov_base = _s; \ - _i->iov_len = strlen(_s); \ - } while(false) - -static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) { - unsigned j; - size_t r = 0; - - for (j = 0; j < n; j++) - r += i[j].iov_len; - - return r; -} - -static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) { - unsigned j; - - for (j = 0; j < n; j++) { - size_t sub; - - if (_unlikely_(k <= 0)) - break; - - sub = MIN(i[j].iov_len, k); - i[j].iov_len -= sub; - i[j].iov_base = (uint8_t*) i[j].iov_base + sub; - k -= sub; - } - - return k; -} - #define VA_FORMAT_ADVANCE(format, ap) \ do { \ int _argtypes[128]; \ diff --git a/src/core/show-status.c b/src/core/show-status.c index 91f8f8e5ad..81166abf23 100644 --- a/src/core/show-status.c +++ b/src/core/show-status.c @@ -20,6 +20,7 @@ ***/ #include "fd-util.h" +#include "io-util.h" #include "parse-util.h" #include "show-status.h" #include "string-util.h" diff --git a/src/journal/coredump.c b/src/journal/coredump.c index b9ece73a81..f32e2d4a9f 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -45,6 +45,7 @@ #include "fd-util.h" #include "fileio.h" #include "fs-util.h" +#include "io-util.h" #include "journald-native.h" #include "log.h" #include "macro.h" diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c index 289f9bf78d..6a8ef7dd40 100644 --- a/src/journal/journald-audit.c +++ b/src/journal/journald-audit.c @@ -21,9 +21,10 @@ #include "audit-type.h" #include "fd-util.h" +#include "hexdecoct.h" +#include "io-util.h" #include "journald-audit.h" #include "missing.h" -#include "hexdecoct.h" #include "string-util.h" typedef struct MapField { diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c index 4a5e07ec5d..9acc324bc5 100644 --- a/src/journal/journald-console.c +++ b/src/journal/journald-console.c @@ -26,6 +26,7 @@ #include "fd-util.h" #include "fileio.h" #include "formats-util.h" +#include "io-util.h" #include "journald-console.h" #include "journald-server.h" #include "parse-util.h" diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index e680aafafe..52e1fbeb3d 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -31,6 +31,7 @@ #include "escape.h" #include "fd-util.h" #include "formats-util.h" +#include "io-util.h" #include "journald-kmsg.h" #include "journald-server.h" #include "journald-syslog.h" diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index e427f20e69..9f3b1e3b16 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -26,6 +26,7 @@ #include "fd-util.h" #include "fs-util.h" +#include "io-util.h" #include "journald-console.h" #include "journald-kmsg.h" #include "journald-native.h" diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 32d1f36821..03cc074e7a 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -44,6 +44,7 @@ #include "fs-util.h" #include "hashmap.h" #include "hostname-util.h" +#include "io-util.h" #include "journal-authenticate.h" #include "journal-file.h" #include "journal-internal.h" diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 8d9c416bc9..de4f4d97fe 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -33,6 +33,7 @@ #include "escape.h" #include "fd-util.h" #include "fileio.h" +#include "io-util.h" #include "journald-console.h" #include "journald-kmsg.h" #include "journald-server.h" diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 488cccb6d9..d0c4a41b9d 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -27,6 +27,7 @@ #include "fd-util.h" #include "formats-util.h" +#include "io-util.h" #include "journald-console.h" #include "journald-kmsg.h" #include "journald-server.h" diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 447e25db8a..d5a6ad581f 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -32,6 +32,7 @@ #include "bus-type.h" #include "bus-util.h" #include "fd-util.h" +#include "io-util.h" #include "memfd-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c index b2eebe09a2..1150c30677 100644 --- a/src/resolve/resolved-dns-stream.c +++ b/src/resolve/resolved-dns-stream.c @@ -22,6 +22,7 @@ #include #include "fd-util.h" +#include "io-util.h" #include "missing.h" #include "resolved-dns-stream.h" -- cgit v1.2.3-54-g00ecf From 8f328d36c9c66efdb40fd19a970523d715078826 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:03:03 +0100 Subject: socket-util: move CMSG_FOREACH() from macro.h to socket-util.h --- src/basic/fd-util.c | 3 ++- src/basic/macro.h | 3 --- src/basic/socket-util.h | 3 +++ src/udev/udevd.c | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index f40365ce97..830522cdb5 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -19,10 +19,11 @@ along with systemd; If not, see . ***/ +#include "dirent-util.h" #include "fd-util.h" #include "parse-util.h" +#include "socket-util.h" #include "util.h" -#include "dirent-util.h" int close_nointr(int fd) { assert(fd >= 0); diff --git a/src/basic/macro.h b/src/basic/macro.h index c9bbe8df4b..02f34cedad 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -427,7 +427,4 @@ do { \ } \ struct __useless_struct_to_allow_trailing_semicolon__ -#define CMSG_FOREACH(cmsg, mh) \ - for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg))) - #include "log.h" diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h index 8b5410b391..c60f2556af 100644 --- a/src/basic/socket-util.h +++ b/src/basic/socket-util.h @@ -127,3 +127,6 @@ int getpeersec(int fd, char **ret); int send_one_fd(int transport_fd, int fd, int flags); int receive_one_fd(int transport_fd, int flags); + +#define CMSG_FOREACH(cmsg, mh) \ + for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg))) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 64346a7822..60fc3179b0 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -59,6 +59,7 @@ #include "process-util.h" #include "selinux-util.h" #include "signal-util.h" +#include "socket-util.h" #include "string-util.h" #include "terminal-util.h" #include "udev-util.h" -- cgit v1.2.3-54-g00ecf From 0d1dbeb3a4c5c86eba5125d43488da7bec16ea0e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:03:38 +0100 Subject: macro: move DECIMAL_STR_WIDTH() into macro.h So that it sets next to DECIMAL_STR_MAX(), where it belongs. --- src/basic/macro.h | 9 +++++++++ src/basic/util.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/macro.h b/src/basic/macro.h index 02f34cedad..01916bd788 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -362,6 +362,15 @@ do { \ sizeof(type) <= 4 ? 10 : \ sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)]))) +#define DECIMAL_STR_WIDTH(x) \ + ({ \ + typeof(x) _x_ = (x); \ + unsigned ans = 1; \ + while (_x_ /= 10) \ + ans++; \ + ans; \ + }) + #define SET_FLAG(v, flag, b) \ (v) = (b) ? ((v) | (flag)) : ((v) & ~(flag)) diff --git a/src/basic/util.h b/src/basic/util.h index 078c4313b5..fc73e13fe4 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -237,15 +237,6 @@ static inline unsigned log2u_round_up(unsigned x) { return log2u(x - 1) + 1; } -#define DECIMAL_STR_WIDTH(x) \ - ({ \ - typeof(x) _x_ = (x); \ - unsigned ans = 1; \ - while (_x_ /= 10) \ - ans++; \ - ans; \ - }) - #define alloca0(n) \ ({ \ char *_new_; \ -- cgit v1.2.3-54-g00ecf From c7f1808add4d971229ba5311cf66e659122aa338 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:23:53 +0100 Subject: macro.h: move definition of MODE_INVALID to parse-util.h --- src/basic/fs-util.c | 1 + src/basic/macro.h | 2 -- src/basic/parse-util.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index edb007f98c..6ad381afb4 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -24,6 +24,7 @@ #include "fileio.h" #include "fs-util.h" #include "mkdir.h" +#include "parse-util.h" #include "path-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/basic/macro.h b/src/basic/macro.h index 01916bd788..156c16b1c3 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -427,8 +427,6 @@ do { \ #endif #endif -#define MODE_INVALID ((mode_t) -1) - #define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ static inline void func##p(type *p) { \ if (*p) \ diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h index 35b4ba030c..72a619c38f 100644 --- a/src/basic/parse-util.h +++ b/src/basic/parse-util.h @@ -26,6 +26,8 @@ #include "macro.h" +#define MODE_INVALID ((mode_t) -1) + int parse_boolean(const char *v) _pure_; int parse_pid(const char *s, pid_t* ret_pid); int parse_mode(const char *s, mode_t *ret); -- cgit v1.2.3-54-g00ecf From 15a5e95075a7f6007dd97b2a165c8ed16fe683df Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:26:31 +0100 Subject: util-lib: split out printf() helpers to stdio-util.h --- Makefile.am | 1 + src/basic/log.c | 1 + src/basic/macro.h | 45 --------------------- src/basic/mount-util.c | 1 + src/basic/stdio-util.h | 78 +++++++++++++++++++++++++++++++++++++ src/basic/util.h | 4 -- src/basic/xattr-util.c | 1 + src/core/automount.c | 1 + src/core/main.c | 1 + src/core/selinux-access.c | 8 ++-- src/fsck/fsck.c | 1 + src/journal-remote/journal-remote.c | 1 + src/journal/journal-send.c | 1 + src/journal/journald-console.c | 1 + src/journal/journald-kmsg.c | 1 + src/journal/journald-stream.c | 1 + src/journal/journald-syslog.c | 1 + src/journal/sd-journal.c | 2 + src/libsystemd/sd-bus/bus-control.c | 1 + src/libsystemd/sd-bus/bus-socket.c | 3 +- src/machine/machined-dbus.c | 1 + src/network/networkd-link.c | 1 + src/nspawn/nspawn.c | 1 + src/shared/bus-util.c | 1 + src/shared/efivars.c | 1 + src/shared/spawn-polkit-agent.c | 6 ++- src/tmpfiles/tmpfiles.c | 1 + src/udev/udev-builtin-keyboard.c | 1 + 28 files changed, 112 insertions(+), 55 deletions(-) create mode 100644 src/basic/stdio-util.h (limited to 'src/basic/macro.h') diff --git a/Makefile.am b/Makefile.am index d851e96f38..c47ad240ab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -766,6 +766,7 @@ libbasic_la_SOURCES = \ src/basic/capability-util.h \ src/basic/conf-files.c \ src/basic/conf-files.h \ + src/basic/stdio-util.h \ src/basic/hostname-util.h \ src/basic/hostname-util.c \ src/basic/unit-name.c \ diff --git a/src/basic/log.c b/src/basic/log.c index 4583cb840f..505c0d072c 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -42,6 +42,7 @@ #include "process-util.h" #include "signal-util.h" #include "socket-util.h" +#include "stdio-util.h" #include "string-table.h" #include "string-util.h" #include "syslog-util.h" diff --git a/src/basic/macro.h b/src/basic/macro.h index 156c16b1c3..acd67feabb 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -301,51 +301,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define char_array_0(x) x[sizeof(x)-1] = 0; -#define VA_FORMAT_ADVANCE(format, ap) \ -do { \ - int _argtypes[128]; \ - size_t _i, _k; \ - _k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \ - assert(_k < ELEMENTSOF(_argtypes)); \ - for (_i = 0; _i < _k; _i++) { \ - if (_argtypes[_i] & PA_FLAG_PTR) { \ - (void) va_arg(ap, void*); \ - continue; \ - } \ - \ - switch (_argtypes[_i]) { \ - case PA_INT: \ - case PA_INT|PA_FLAG_SHORT: \ - case PA_CHAR: \ - (void) va_arg(ap, int); \ - break; \ - case PA_INT|PA_FLAG_LONG: \ - (void) va_arg(ap, long int); \ - break; \ - case PA_INT|PA_FLAG_LONG_LONG: \ - (void) va_arg(ap, long long int); \ - break; \ - case PA_WCHAR: \ - (void) va_arg(ap, wchar_t); \ - break; \ - case PA_WSTRING: \ - case PA_STRING: \ - case PA_POINTER: \ - (void) va_arg(ap, void*); \ - break; \ - case PA_FLOAT: \ - case PA_DOUBLE: \ - (void) va_arg(ap, double); \ - break; \ - case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: \ - (void) va_arg(ap, long double); \ - break; \ - default: \ - assert_not_reached("Unknown format string argument."); \ - } \ - } \ -} while(false) - /* Because statfs.t_type can be int on some architectures, we have to cast * the const magic to the type, otherwise the compiler warns about * signed/unsigned comparison, because the magic can be 32 bit unsigned. diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index 6b33d43024..24e88babcd 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -30,6 +30,7 @@ #include "parse-util.h" #include "path-util.h" #include "set.h" +#include "stdio-util.h" #include "string-util.h" #include "util.h" diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h new file mode 100644 index 0000000000..b36e8a947e --- /dev/null +++ b/src/basic/stdio-util.h @@ -0,0 +1,78 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2010 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include +#include +#include +#include + +#include "macro.h" + +#define xsprintf(buf, fmt, ...) \ + assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), "xsprintf: " #buf "[] must be big enough") + + +#define VA_FORMAT_ADVANCE(format, ap) \ +do { \ + int _argtypes[128]; \ + size_t _i, _k; \ + _k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \ + assert(_k < ELEMENTSOF(_argtypes)); \ + for (_i = 0; _i < _k; _i++) { \ + if (_argtypes[_i] & PA_FLAG_PTR) { \ + (void) va_arg(ap, void*); \ + continue; \ + } \ + \ + switch (_argtypes[_i]) { \ + case PA_INT: \ + case PA_INT|PA_FLAG_SHORT: \ + case PA_CHAR: \ + (void) va_arg(ap, int); \ + break; \ + case PA_INT|PA_FLAG_LONG: \ + (void) va_arg(ap, long int); \ + break; \ + case PA_INT|PA_FLAG_LONG_LONG: \ + (void) va_arg(ap, long long int); \ + break; \ + case PA_WCHAR: \ + (void) va_arg(ap, wchar_t); \ + break; \ + case PA_WSTRING: \ + case PA_STRING: \ + case PA_POINTER: \ + (void) va_arg(ap, void*); \ + break; \ + case PA_FLOAT: \ + case PA_DOUBLE: \ + (void) va_arg(ap, double); \ + break; \ + case PA_DOUBLE|PA_FLAG_LONG_DOUBLE: \ + (void) va_arg(ap, long double); \ + break; \ + default: \ + assert_not_reached("Unknown format string argument."); \ + } \ + } \ +} while(false) diff --git a/src/basic/util.h b/src/basic/util.h index fc73e13fe4..95c7c75b9c 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -85,10 +85,6 @@ static inline const char* one_zero(bool b) { bool fstype_is_network(const char *fstype); -#define xsprintf(buf, fmt, ...) \ - assert_message_se((size_t) snprintf(buf, ELEMENTSOF(buf), fmt, __VA_ARGS__) < ELEMENTSOF(buf), \ - "xsprintf: " #buf "[] must be big enough") - noreturn void freeze(void); void execute_directories(const char* const* directories, usec_t timeout, char *argv[]); diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c index 35fd1c1616..7351337c6b 100644 --- a/src/basic/xattr-util.c +++ b/src/basic/xattr-util.c @@ -23,6 +23,7 @@ #include "fd-util.h" #include "sparse-endian.h" +#include "stdio-util.h" #include "util.h" #include "xattr-util.h" diff --git a/src/core/automount.c b/src/core/automount.c index 379f71f74a..50a7772753 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -45,6 +45,7 @@ #include "path-util.h" #include "process-util.h" #include "special.h" +#include "stdio-util.h" #include "string-table.h" #include "string-util.h" #include "unit-name.h" diff --git a/src/core/main.c b/src/core/main.c index dbe774b14d..d9c888d747 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -78,6 +78,7 @@ #include "smack-setup.h" #include "special.h" #include "stat-util.h" +#include "stdio-util.h" #include "strv.h" #include "switch-root.h" #include "terminal-util.h" diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c index cf38fa0ebe..a9368ead22 100644 --- a/src/core/selinux-access.c +++ b/src/core/selinux-access.c @@ -32,13 +32,15 @@ #endif #include "sd-bus.h" + +#include "audit-fd.h" #include "bus-util.h" -#include "util.h" #include "log.h" +#include "path-util.h" #include "selinux-util.h" -#include "audit-fd.h" +#include "stdio-util.h" #include "strv.h" -#include "path-util.h" +#include "util.h" static bool initialized = false; diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index 45c24b2fcf..4119edde30 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -45,6 +45,7 @@ #include "signal-util.h" #include "socket-util.h" #include "special.h" +#include "stdio-util.h" #include "util.h" /* exit codes as defined in fsck(8) */ diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index dc87b21020..f70d278e1c 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -48,6 +48,7 @@ #include "signal-util.h" #include "socket-util.h" #include "stat-util.h" +#include "stdio-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index dddd5703f4..8fe99fae99 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -36,6 +36,7 @@ #include "io-util.h" #include "memfd-util.h" #include "socket-util.h" +#include "stdio-util.h" #include "string-util.h" #include "util.h" diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c index 9acc324bc5..72c4ba5879 100644 --- a/src/journal/journald-console.c +++ b/src/journal/journald-console.c @@ -31,6 +31,7 @@ #include "journald-server.h" #include "parse-util.h" #include "process-util.h" +#include "stdio-util.h" #include "terminal-util.h" static bool prefix_timestamp(void) { diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index 52e1fbeb3d..489f6f689c 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -37,6 +37,7 @@ #include "journald-syslog.h" #include "parse-util.h" #include "process-util.h" +#include "stdio-util.h" #include "string-util.h" void server_forward_kmsg( diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index de4f4d97fe..0dd6d54d68 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -44,6 +44,7 @@ #include "parse-util.h" #include "selinux-util.h" #include "socket-util.h" +#include "stdio-util.h" #include "string-util.h" #include "syslog-util.h" diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index d0c4a41b9d..3553e9cc1d 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -36,6 +36,7 @@ #include "process-util.h" #include "selinux-util.h" #include "socket-util.h" +#include "stdio-util.h" #include "string-util.h" #include "syslog-util.h" diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index cfe1623e5b..bd93d90776 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -47,6 +47,8 @@ #include "missing.h" #include "path-util.h" #include "replace-var.h" +#include "stat-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 7c9dcf5283..5951db483d 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -34,6 +34,7 @@ #include "bus-message.h" #include "bus-util.h" #include "capability-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "user-util.h" diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index 7ca544f6fd..2c46d84cd0 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -32,10 +32,11 @@ #include "bus-socket.h" #include "fd-util.h" #include "formats-util.h" +#include "hexdecoct.h" #include "macro.h" #include "missing.h" -#include "hexdecoct.h" #include "signal-util.h" +#include "stdio-util.h" #include "string-util.h" #include "user-util.h" #include "utf8.h" diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 3c91fa8644..182dedda89 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -39,6 +39,7 @@ #include "machined.h" #include "path-util.h" #include "process-util.h" +#include "stdio-util.h" #include "strv.h" #include "unit-name.h" #include "user-util.h" diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index de49fd5c22..ab37c43dcb 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -33,6 +33,7 @@ #include "networkd-netdev.h" #include "set.h" #include "socket-util.h" +#include "stdio-util.h" #include "string-table.h" #include "udev-util.h" #include "util.h" diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 28bca1f71e..1ce219b844 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -91,6 +91,7 @@ #include "signal-util.h" #include "socket-util.h" #include "stat-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "terminal-util.h" diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index b253eb95ee..8f6278191a 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -43,6 +43,7 @@ #include "rlimit-util.h" #include "set.h" #include "signal-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "syslog-util.h" diff --git a/src/shared/efivars.c b/src/shared/efivars.c index 6e8f156a68..e7972d1574 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -28,6 +28,7 @@ #include "fd-util.h" #include "io-util.h" #include "parse-util.h" +#include "stdio-util.h" #include "utf8.h" #include "util.h" #include "virt.h" diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c index 7cc9e7ccc1..ec6e5a8312 100644 --- a/src/shared/spawn-polkit-agent.c +++ b/src/shared/spawn-polkit-agent.c @@ -30,6 +30,7 @@ #include "log.h" #include "process-util.h" #include "spawn-polkit-agent.h" +#include "stdio-util.h" #include "util.h" #ifdef ENABLE_POLKIT @@ -78,8 +79,9 @@ void polkit_agent_close(void) { return; /* Inform agent that we are done */ - kill(agent_pid, SIGTERM); - kill(agent_pid, SIGCONT); + (void) kill(agent_pid, SIGTERM); + (void) kill(agent_pid, SIGCONT); + (void) wait_for_terminate(agent_pid, NULL); agent_pid = 0; } diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 7217f54611..41deea70fb 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -62,6 +62,7 @@ #include "set.h" #include "specifier.h" #include "stat-util.h" +#include "stdio-util.h" #include "string-table.h" #include "string-util.h" #include "strv.h" diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index 74df4cb0f4..aa10beafb0 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -25,6 +25,7 @@ #include "fd-util.h" #include "parse-util.h" +#include "stdio-util.h" #include "string-util.h" #include "udev.h" -- cgit v1.2.3-54-g00ecf From 872a590ef83b23a65071242a8082d25d5efa6db6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:26:52 +0100 Subject: stat-util.h: move F_TYPE_EQUAL() macro definition to stat-util.h --- src/basic/btrfs-util.c | 1 + src/basic/cgroup-util.c | 3 ++- src/basic/macro.h | 6 ------ src/basic/stat-util.h | 6 ++++++ 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/basic/macro.h') diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c index 7b49a1a516..7457e9f218 100644 --- a/src/basic/btrfs-util.c +++ b/src/basic/btrfs-util.c @@ -36,6 +36,7 @@ #include "path-util.h" #include "selinux-util.h" #include "smack-util.h" +#include "stat-util.h" #include "string-util.h" #include "util.h" diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index cfbeab7411..0f0e144b5e 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -41,15 +41,16 @@ #include "mkdir.h" #include "parse-util.h" #include "path-util.h" +#include "proc-cmdline.h" #include "process-util.h" #include "set.h" #include "special.h" +#include "stat-util.h" #include "string-table.h" #include "string-util.h" #include "unit-name.h" #include "user-util.h" #include "util.h" -#include "proc-cmdline.h" int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) { _cleanup_free_ char *fs = NULL; diff --git a/src/basic/macro.h b/src/basic/macro.h index acd67feabb..975714da2b 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -301,12 +301,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define char_array_0(x) x[sizeof(x)-1] = 0; - /* Because statfs.t_type can be int on some architectures, we have to cast - * the const magic to the type, otherwise the compiler warns about - * signed/unsigned comparison, because the magic can be 32 bit unsigned. - */ -#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b) - /* Returns the number of chars needed to format variables of the * specified type as a decimal string. Adds in extra space for a * negative '-' prefix (hence works correctly on signed diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index cb00e0f564..82edea06a8 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -61,3 +61,9 @@ int path_check_fstype(const char *path, statfs_f_type_t magic_value); bool is_temporary_fs(const struct statfs *s) _pure_; int fd_is_temporary_fs(int fd); + +/* Because statfs.t_type can be int on some architectures, we have to cast + * the const magic to the type, otherwise the compiler warns about + * signed/unsigned comparison, because the magic can be 32 bit unsigned. + */ +#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b) -- cgit v1.2.3-54-g00ecf From 7d50b32a129e781401cf897475f388f682de1368 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 01:48:17 +0100 Subject: util-lib: split out globbing related calls into glob-util.[ch] --- Makefile.am | 2 ++ src/analyze/analyze.c | 1 + src/basic/glob-util.c | 71 +++++++++++++++++++++++++++++++++++++ src/basic/glob-util.h | 37 +++++++++++++++++++ src/basic/macro.h | 3 -- src/basic/util.c | 44 ----------------------- src/basic/util.h | 14 ++------ src/core/execute.c | 1 + src/core/path.c | 1 + src/journal-remote/journal-upload.c | 1 + src/journal/fsprg.h | 1 + src/journal/journalctl.c | 1 + src/shared/condition.c | 1 + src/systemctl/systemctl.c | 1 + src/test/test-util.c | 3 +- src/tmpfiles/tmpfiles.c | 1 + src/udev/udev-rules.c | 1 + 17 files changed, 125 insertions(+), 59 deletions(-) create mode 100644 src/basic/glob-util.c create mode 100644 src/basic/glob-util.h (limited to 'src/basic/macro.h') diff --git a/Makefile.am b/Makefile.am index c47ad240ab..3c4250a144 100644 --- a/Makefile.am +++ b/Makefile.am @@ -812,6 +812,8 @@ libbasic_la_SOURCES = \ src/basic/mount-util.h \ src/basic/hexdecoct.c \ src/basic/hexdecoct.h \ + src/basic/glob-util.h \ + src/basic/glob-util.c \ src/basic/extract-word.c \ src/basic/extract-word.h \ src/basic/escape.c \ diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index a165152cb2..7e63bfa821 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -30,6 +30,7 @@ #include "analyze-verify.h" #include "bus-error.h" #include "bus-util.h" +#include "glob-util.h" #include "hashmap.h" #include "locale-util.h" #include "log.h" diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c new file mode 100644 index 0000000000..112c6392e5 --- /dev/null +++ b/src/basic/glob-util.c @@ -0,0 +1,71 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2010 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include + +#include "glob-util.h" +#include "strv.h" +#include "util.h" + +int glob_exists(const char *path) { + _cleanup_globfree_ glob_t g = {}; + int k; + + assert(path); + + errno = 0; + k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); + + if (k == GLOB_NOMATCH) + return 0; + if (k == GLOB_NOSPACE) + return -ENOMEM; + if (k != 0) + return errno ? -errno : -EIO; + + return !strv_isempty(g.gl_pathv); +} + +int glob_extend(char ***strv, const char *path) { + _cleanup_globfree_ glob_t g = {}; + int k; + char **p; + + errno = 0; + k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); + + if (k == GLOB_NOMATCH) + return -ENOENT; + if (k == GLOB_NOSPACE) + return -ENOMEM; + if (k != 0) + return errno ? -errno : -EIO; + if (strv_isempty(g.gl_pathv)) + return -ENOENT; + + STRV_FOREACH(p, g.gl_pathv) { + k = strv_extend(strv, *p); + if (k < 0) + return k; + } + + return 0; +} diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h new file mode 100644 index 0000000000..8817df14b4 --- /dev/null +++ b/src/basic/glob-util.h @@ -0,0 +1,37 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2010 Lennart Poettering + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ + +#include + +#include "macro.h" +#include "util.h" + +int glob_exists(const char *path); +int glob_extend(char ***strv, const char *path); + +#define _cleanup_globfree_ _cleanup_(globfree) + +_pure_ static inline bool string_is_glob(const char *p) { + /* Check if a string contains any glob patterns. */ + return !!strpbrk(p, GLOB_CHARS); +} diff --git a/src/basic/macro.h b/src/basic/macro.h index 975714da2b..daa7c416f7 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -294,9 +294,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { #define PTR_TO_SIZE(p) ((size_t) ((uintptr_t) (p))) #define SIZE_TO_PTR(u) ((void *) ((uintptr_t) (u))) -#define memzero(x,l) (memset((x), 0, (l))) -#define zero(x) (memzero(&(x), sizeof(x))) - #define CHAR_TO_STR(x) ((char[2]) { x, 0 }) #define char_array_0(x) x[sizeof(x)-1] = 0; diff --git a/src/basic/util.c b/src/basic/util.c index 412ea50b96..6da311ad1e 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -368,49 +367,6 @@ int socket_from_display(const char *display, char **path) { return 0; } -int glob_exists(const char *path) { - _cleanup_globfree_ glob_t g = {}; - int k; - - assert(path); - - errno = 0; - k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); - - if (k == GLOB_NOMATCH) - return 0; - else if (k == GLOB_NOSPACE) - return -ENOMEM; - else if (k == 0) - return !strv_isempty(g.gl_pathv); - else - return errno ? -errno : -EIO; -} - -int glob_extend(char ***strv, const char *path) { - _cleanup_globfree_ glob_t g = {}; - int k; - char **p; - - errno = 0; - k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g); - - if (k == GLOB_NOMATCH) - return -ENOENT; - else if (k == GLOB_NOSPACE) - return -ENOMEM; - else if (k != 0 || strv_isempty(g.gl_pathv)) - return errno ? -errno : -EIO; - - STRV_FOREACH(p, g.gl_pathv) { - k = strv_extend(strv, *p); - if (k < 0) - break; - } - - return k; -} - int block_get_whole_disk(dev_t d, dev_t *ret) { char *p, *s; int r; diff --git a/src/basic/util.h b/src/basic/util.h index 95c7c75b9c..3074029f38 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -94,9 +94,6 @@ bool plymouth_running(void); bool display_is_local(const char *display) _pure_; int socket_from_display(const char *display, char **path); -int glob_exists(const char *path); -int glob_extend(char ***strv, const char *path); - int block_get_whole_disk(dev_t d, dev_t *ret); #define NULSTR_FOREACH(i, l) \ @@ -132,7 +129,6 @@ static inline void freep(void *p) { } #define _cleanup_free_ _cleanup_(freep) -#define _cleanup_globfree_ _cleanup_(globfree) _malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) { if (_unlikely_(b != 0 && a > ((size_t) -1) / b)) @@ -155,13 +151,6 @@ _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_ return memdup(p, a * b); } -/** - * Check if a string contains any glob patterns. - */ -_pure_ static inline bool string_is_glob(const char *p) { - return !!strpbrk(p, GLOB_CHARS); -} - void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg); @@ -173,6 +162,9 @@ static inline void *mempset(void *s, int c, size_t n) { return (uint8_t*)s + n; } +#define memzero(x,l) (memset((x), 0, (l))) +#define zero(x) (memzero(&(x), sizeof(x))) + void* greedy_realloc(void **p, size_t *allocated, size_t need, size_t size); void* greedy_realloc0(void **p, size_t *allocated, size_t need, size_t size); #define GREEDY_REALLOC(array, allocated, need) \ diff --git a/src/core/execute.c b/src/core/execute.c index 3814fd4381..bf13e29bd9 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -70,6 +70,7 @@ #include "fileio.h" #include "formats-util.h" #include "fs-util.h" +#include "glob-util.h" #include "io-util.h" #include "ioprio.h" #include "log.h" diff --git a/src/core/path.c b/src/core/path.c index 761ec265b4..9c5309a58a 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -28,6 +28,7 @@ #include "bus-util.h" #include "dbus-path.h" #include "fd-util.h" +#include "glob-util.h" #include "macro.h" #include "mkdir.h" #include "path.h" diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 20e2a2f73b..1925475db8 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -31,6 +31,7 @@ #include "fd-util.h" #include "fileio.h" #include "formats-util.h" +#include "glob-util.h" #include "journal-upload.h" #include "log.h" #include "mkdir.h" diff --git a/src/journal/fsprg.h b/src/journal/fsprg.h index 150d034828..5959b1fed2 100644 --- a/src/journal/fsprg.h +++ b/src/journal/fsprg.h @@ -29,6 +29,7 @@ #include #include "macro.h" +#include "util.h" #ifdef __cplusplus extern "C" { diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 1965522dfd..2782ac0329 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -47,6 +47,7 @@ #include "fileio.h" #include "fs-util.h" #include "fsprg.h" +#include "glob-util.h" #include "hostname-util.h" #include "io-util.h" #include "journal-def.h" diff --git a/src/shared/condition.c b/src/shared/condition.c index d06120f0d7..2929e3e821 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -34,6 +34,7 @@ #include "condition.h" #include "extract-word.h" #include "fd-util.h" +#include "glob-util.h" #include "hostname-util.h" #include "ima-util.h" #include "mount-util.h" diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 2166554f4d..2faa93ef88 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -52,6 +52,7 @@ #include "fileio.h" #include "formats-util.h" #include "fs-util.h" +#include "glob-util.h" #include "hostname-util.h" #include "initreq.h" #include "install.h" diff --git a/src/test/test-util.c b/src/test/test-util.c index 6c6fce2d6a..647eff0496 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -39,6 +39,7 @@ #include "fileio.h" #include "fs-util.h" #include "fstab-util.h" +#include "glob-util.h" #include "hexdecoct.h" #include "io-util.h" #include "mkdir.h" @@ -54,8 +55,8 @@ #include "user-util.h" #include "util.h" #include "virt.h" -#include "xattr-util.h" #include "web-util.h" +#include "xattr-util.h" static void test_streq_ptr(void) { assert_se(streq_ptr(NULL, NULL)); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 41deea70fb..5196447963 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -49,6 +49,7 @@ #include "fileio.h" #include "formats-util.h" #include "fs-util.h" +#include "glob-util.h" #include "io-util.h" #include "label.h" #include "log.h" diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index b87c14efb2..7d5f473d45 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -32,6 +32,7 @@ #include "conf-files.h" #include "escape.h" #include "fd-util.h" +#include "glob-util.h" #include "path-util.h" #include "stat-util.h" #include "strbuf.h" -- cgit v1.2.3-54-g00ecf