summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 16:18:16 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:25:55 +0100
commit6bedfcbb2970e06a4d3280c8fb62083d252ede73 (patch)
tree89f9202e924f566b45931a88bb06b01ff5daa0eb /src
parentf47fc3ffc4b69a00083a76308f777b52afb8efbf (diff)
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]
Diffstat (limited to 'src')
-rw-r--r--src/analyze/analyze.c1
-rw-r--r--src/backlight/backlight.c1
-rw-r--r--src/basic/audit.c1
-rw-r--r--src/basic/cap-list.c3
-rw-r--r--src/basic/capability.c1
-rw-r--r--src/basic/cgroup-util.c1
-rw-r--r--src/basic/cpu-set-util.c3
-rw-r--r--src/basic/fd-util.c1
-rw-r--r--src/basic/fdset.c1
-rw-r--r--src/basic/log.c1
-rw-r--r--src/basic/parse-util.c408
-rw-r--r--src/basic/parse-util.h88
-rw-r--r--src/basic/path-util.c1
-rw-r--r--src/basic/signal-util.c8
-rw-r--r--src/basic/signal-util.h2
-rw-r--r--src/basic/socket-util.c1
-rw-r--r--src/basic/terminal-util.c1
-rw-r--r--src/basic/user-util.c7
-rw-r--r--src/basic/util.c388
-rw-r--r--src/basic/util.h66
-rw-r--r--src/bootchart/bootchart.c1
-rw-r--r--src/bootchart/store.c1
-rw-r--r--src/cgtop/cgtop.c1
-rw-r--r--src/core/automount.c1
-rw-r--r--src/core/busname.c1
-rw-r--r--src/core/cgroup.c1
-rw-r--r--src/core/dbus-execute.c6
-rw-r--r--src/core/device.c3
-rw-r--r--src/core/execute.c1
-rw-r--r--src/core/job.c3
-rw-r--r--src/core/killall.c1
-rw-r--r--src/core/load-fragment.c1
-rw-r--r--src/core/main.c1
-rw-r--r--src/core/manager.c1
-rw-r--r--src/core/mount.c1
-rw-r--r--src/core/service.c1
-rw-r--r--src/core/show-status.c3
-rw-r--r--src/core/shutdown.c1
-rw-r--r--src/core/snapshot.c4
-rw-r--r--src/core/snapshot.h2
-rw-r--r--src/core/socket.c1
-rw-r--r--src/core/swap.c1
-rw-r--r--src/core/timer.c1
-rw-r--r--src/core/unit.c1
-rw-r--r--src/cryptsetup/cryptsetup-generator.c1
-rw-r--r--src/cryptsetup/cryptsetup.c1
-rw-r--r--src/debug-generator/debug-generator.c1
-rw-r--r--src/delta/delta.c1
-rw-r--r--src/firstboot/firstboot.c5
-rw-r--r--src/fsck/fsck.c1
-rw-r--r--src/fstab-generator/fstab-generator.c1
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c1
-rw-r--r--src/hostname/hostnamed.c13
-rw-r--r--src/import/importd.c1
-rw-r--r--src/import/pull-job.c1
-rw-r--r--src/import/pull.c1
-rw-r--r--src/journal-remote/journal-gatewayd.c1
-rw-r--r--src/journal-remote/journal-remote-parse.c1
-rw-r--r--src/journal-remote/journal-remote.c1
-rw-r--r--src/journal-remote/journal-upload.c1
-rw-r--r--src/journal/cat.c1
-rw-r--r--src/journal/coredump.c1
-rw-r--r--src/journal/coredumpctl.c3
-rw-r--r--src/journal/journal-file.c1
-rw-r--r--src/journal/journal-vacuum.c1
-rw-r--r--src/journal/journalctl.c1
-rw-r--r--src/journal/journald-console.c7
-rw-r--r--src/journal/journald-kmsg.c1
-rw-r--r--src/journal/journald-native.c1
-rw-r--r--src/journal/journald-server.c1
-rw-r--r--src/journal/journald-stream.c1
-rw-r--r--src/journal/test-compress-benchmark.c1
-rw-r--r--src/journal/test-journal-init.c1
-rw-r--r--src/journal/test-journal-interleaving.c4
-rw-r--r--src/journal/test-journal-stream.c10
-rw-r--r--src/libsystemd-network/network-internal.c3
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c1
-rw-r--r--src/libsystemd-network/test-ipv4ll-manual.c1
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c1
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd/sd-bus/busctl.c1
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c1
-rw-r--r--src/libsystemd/sd-daemon/sd-daemon.c1
-rw-r--r--src/libsystemd/sd-device/device-private.c1
-rw-r--r--src/libsystemd/sd-device/sd-device.c1
-rw-r--r--src/libsystemd/sd-login/sd-login.c1
-rw-r--r--src/libsystemd/sd-network/sd-network.c1
-rw-r--r--src/libudev/libudev-device.c1
-rw-r--r--src/login/loginctl.c1
-rw-r--r--src/login/logind-inhibit.c1
-rw-r--r--src/login/logind-seat.c1
-rw-r--r--src/login/logind-session.c1
-rw-r--r--src/login/logind-user.c1
-rw-r--r--src/login/pam_systemd.c1
-rw-r--r--src/machine/machine.c1
-rw-r--r--src/machine/machinectl.c1
-rw-r--r--src/network/networkctl.c1
-rw-r--r--src/network/networkd-address.c3
-rw-r--r--src/network/networkd-link-bus.c3
-rw-r--r--src/network/networkd-netdev-tunnel.c3
-rw-r--r--src/network/networkd-network.c1
-rw-r--r--src/network/networkd-route.c3
-rw-r--r--src/network/networkd-util.c1
-rw-r--r--src/notify/notify.c1
-rw-r--r--src/nspawn/nspawn-expose-ports.c1
-rw-r--r--src/nspawn/nspawn-mount.c3
-rw-r--r--src/nspawn/nspawn.c1
-rw-r--r--src/resolve-host/resolve-host.c1
-rw-r--r--src/resolve/resolved-conf.c3
-rw-r--r--src/resolve/resolved-link.c1
-rw-r--r--src/resolve/resolved-manager.c1
-rw-r--r--src/rfkill/rfkill.c1
-rw-r--r--src/run/run.c1
-rw-r--r--src/shared/apparmor-util.c6
-rw-r--r--src/shared/bus-util.c1
-rw-r--r--src/shared/condition.c1
-rw-r--r--src/shared/conf-parser.c5
-rw-r--r--src/shared/dns-domain.c3
-rw-r--r--src/shared/efivars.c1
-rw-r--r--src/shared/fstab-util.c3
-rw-r--r--src/shared/logs-show.c1
-rw-r--r--src/shared/machine-pool.c1
-rw-r--r--src/shared/sleep-config.c1
-rw-r--r--src/systemctl/systemctl.c1
-rw-r--r--src/test/test-btrfs.c1
-rw-r--r--src/test/test-cap-list.c8
-rw-r--r--src/test/test-cgroup-util.c1
-rw-r--r--src/test/test-fileio.c1
-rw-r--r--src/test/test-util.c3
-rw-r--r--src/timedate/timedatectl.c1
-rw-r--r--src/tmpfiles/tmpfiles.c1
-rw-r--r--src/udev/net/link-config.c1
-rw-r--r--src/udev/udev-builtin-keyboard.c1
-rw-r--r--src/udev/udevadm-settle.c1
-rw-r--r--src/udev/udevd.c1
135 files changed, 684 insertions, 502 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 4bf83eb329..6ba16d8b65 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -33,6 +33,7 @@
#include "hashmap.h"
#include "log.h"
#include "pager.h"
+#include "parse-util.h"
#include "special.h"
#include "strv.h"
#include "strxcpyx.h"
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index fc96eee6a9..6a2d04ef13 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -28,6 +28,7 @@
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
+#include "parse-util.h"
static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
struct udev_device *parent;
diff --git a/src/basic/audit.c b/src/basic/audit.c
index c9b762151a..4957fc1bec 100644
--- a/src/basic/audit.c
+++ b/src/basic/audit.c
@@ -26,6 +26,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "macro.h"
+#include "parse-util.h"
#include "process-util.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/basic/cap-list.c b/src/basic/cap-list.c
index bd5bffbfa5..4d391510bc 100644
--- a/src/basic/cap-list.c
+++ b/src/basic/cap-list.c
@@ -21,9 +21,10 @@
#include <string.h>
-#include "util.h"
#include "cap-list.h"
#include "missing.h"
+#include "parse-util.h"
+#include "util.h"
static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);
diff --git a/src/basic/capability.c b/src/basic/capability.c
index 6f25b5dee9..04c7047a6a 100644
--- a/src/basic/capability.c
+++ b/src/basic/capability.c
@@ -30,6 +30,7 @@
#include "fileio.h"
#include "log.h"
#include "macro.h"
+#include "parse-util.h"
#include "util.h"
int have_effective_cap(int value) {
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 4af991200c..232d6e8fe2 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
#include "login-util.h"
#include "macro.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"
diff --git a/src/basic/cpu-set-util.c b/src/basic/cpu-set-util.c
index 5e064d854f..cbeae0bf20 100644
--- a/src/basic/cpu-set-util.c
+++ b/src/basic/cpu-set-util.c
@@ -20,9 +20,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "cpu-set-util.h"
#include "extract-word.h"
+#include "parse-util.h"
#include "util.h"
-#include "cpu-set-util.h"
cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
cpu_set_t *c;
diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c
index e54c104597..76d7e32bfa 100644
--- a/src/basic/fd-util.c
+++ b/src/basic/fd-util.c
@@ -20,6 +20,7 @@
***/
#include "fd-util.h"
+#include "parse-util.h"
#include "util.h"
int close_nointr(int fd) {
diff --git a/src/basic/fdset.c b/src/basic/fdset.c
index 9669110828..ef60f66431 100644
--- a/src/basic/fdset.c
+++ b/src/basic/fdset.c
@@ -28,6 +28,7 @@
#include "fd-util.h"
#include "fdset.h"
#include "macro.h"
+#include "parse-util.h"
#include "set.h"
#include "util.h"
diff --git a/src/basic/log.c b/src/basic/log.c
index 99dccb1f10..2c0abdc0bd 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -42,6 +42,7 @@
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
+#include "parse-util.h"
#define SNDBUF_SIZE (8*1024*1024)
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
new file mode 100644
index 0000000000..2437fee60c
--- /dev/null
+++ b/src/basic/parse-util.c
@@ -0,0 +1,408 @@
+/*-*- 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 <http://www.gnu.org/licenses/>.
+***/
+
+#include "parse-util.h"
+#include "string-util.h"
+#include "util.h"
+
+int parse_boolean(const char *v) {
+ assert(v);
+
+ if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
+ return 1;
+ else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
+ return 0;
+
+ return -EINVAL;
+}
+
+int parse_pid(const char *s, pid_t* ret_pid) {
+ unsigned long ul = 0;
+ pid_t pid;
+ int r;
+
+ assert(s);
+ assert(ret_pid);
+
+ r = safe_atolu(s, &ul);
+ if (r < 0)
+ return r;
+
+ pid = (pid_t) ul;
+
+ if ((unsigned long) pid != ul)
+ return -ERANGE;
+
+ if (pid <= 0)
+ return -ERANGE;
+
+ *ret_pid = pid;
+ return 0;
+}
+
+int parse_mode(const char *s, mode_t *ret) {
+ char *x;
+ long l;
+
+ assert(s);
+ assert(ret);
+
+ errno = 0;
+ l = strtol(s, &x, 8);
+ if (errno != 0)
+ return -errno;
+
+ if (!x || x == s || *x)
+ return -EINVAL;
+ if (l < 0 || l > 07777)
+ return -ERANGE;
+
+ *ret = (mode_t) l;
+ return 0;
+}
+
+int parse_size(const char *t, uint64_t base, uint64_t *size) {
+
+ /* Soo, sometimes we want to parse IEC binary suffixes, and
+ * sometimes SI decimal suffixes. This function can parse
+ * both. Which one is the right way depends on the
+ * context. Wikipedia suggests that SI is customary for
+ * hardware metrics and network speeds, while IEC is
+ * customary for most data sizes used by software and volatile
+ * (RAM) memory. Hence be careful which one you pick!
+ *
+ * In either case we use just K, M, G as suffix, and not Ki,
+ * Mi, Gi or so (as IEC would suggest). That's because that's
+ * frickin' ugly. But this means you really need to make sure
+ * to document which base you are parsing when you use this
+ * call. */
+
+ struct table {
+ const char *suffix;
+ unsigned long long factor;
+ };
+
+ static const struct table iec[] = {
+ { "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
+ { "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
+ { "T", 1024ULL*1024ULL*1024ULL*1024ULL },
+ { "G", 1024ULL*1024ULL*1024ULL },
+ { "M", 1024ULL*1024ULL },
+ { "K", 1024ULL },
+ { "B", 1ULL },
+ { "", 1ULL },
+ };
+
+ static const struct table si[] = {
+ { "E", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
+ { "P", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
+ { "T", 1000ULL*1000ULL*1000ULL*1000ULL },
+ { "G", 1000ULL*1000ULL*1000ULL },
+ { "M", 1000ULL*1000ULL },
+ { "K", 1000ULL },
+ { "B", 1ULL },
+ { "", 1ULL },
+ };
+
+ const struct table *table;
+ const char *p;
+ unsigned long long r = 0;
+ unsigned n_entries, start_pos = 0;
+
+ assert(t);
+ assert(base == 1000 || base == 1024);
+ assert(size);
+
+ if (base == 1000) {
+ table = si;
+ n_entries = ELEMENTSOF(si);
+ } else {
+ table = iec;
+ n_entries = ELEMENTSOF(iec);
+ }
+
+ p = t;
+ do {
+ unsigned long long l, tmp;
+ double frac = 0;
+ char *e;
+ unsigned i;
+
+ p += strspn(p, WHITESPACE);
+ if (*p == '-')
+ return -ERANGE;
+
+ errno = 0;
+ l = strtoull(p, &e, 10);
+ if (errno > 0)
+ return -errno;
+ if (e == p)
+ return -EINVAL;
+
+ if (*e == '.') {
+ e++;
+
+ /* strtoull() itself would accept space/+/- */
+ if (*e >= '0' && *e <= '9') {
+ unsigned long long l2;
+ char *e2;
+
+ l2 = strtoull(e, &e2, 10);
+ if (errno > 0)
+ return -errno;
+
+ /* Ignore failure. E.g. 10.M is valid */
+ frac = l2;
+ for (; e < e2; e++)
+ frac /= 10;
+ }
+ }
+
+ e += strspn(e, WHITESPACE);
+
+ for (i = start_pos; i < n_entries; i++)
+ if (startswith(e, table[i].suffix))
+ break;
+
+ if (i >= n_entries)
+ return -EINVAL;
+
+ if (l + (frac > 0) > ULLONG_MAX / table[i].factor)
+ return -ERANGE;
+
+ tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
+ if (tmp > ULLONG_MAX - r)
+ return -ERANGE;
+
+ r += tmp;
+ if ((unsigned long long) (uint64_t) r != r)
+ return -ERANGE;
+
+ p = e + strlen(table[i].suffix);
+
+ start_pos = i + 1;
+
+ } while (*p);
+
+ *size = r;
+
+ return 0;
+}
+
+char *format_bytes(char *buf, size_t l, uint64_t t) {
+ unsigned i;
+
+ /* This only does IEC units so far */
+
+ static const struct {
+ const char *suffix;
+ uint64_t factor;
+ } table[] = {
+ { "E", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "P", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "T", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "G", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
+ { "M", UINT64_C(1024)*UINT64_C(1024) },
+ { "K", UINT64_C(1024) },
+ };
+
+ if (t == (uint64_t) -1)
+ return NULL;
+
+ for (i = 0; i < ELEMENTSOF(table); i++) {
+
+ if (t >= table[i].factor) {
+ snprintf(buf, l,
+ "%" PRIu64 ".%" PRIu64 "%s",
+ t / table[i].factor,
+ ((t*UINT64_C(10)) / table[i].factor) % UINT64_C(10),
+ table[i].suffix);
+
+ goto finish;
+ }
+ }
+
+ snprintf(buf, l, "%" PRIu64 "B", t);
+
+finish:
+ buf[l-1] = 0;
+ return buf;
+
+}
+
+int safe_atou(const char *s, unsigned *ret_u) {
+ char *x = NULL;
+ unsigned long l;
+
+ assert(s);
+ assert(ret_u);
+
+ errno = 0;
+ l = strtoul(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((unsigned long) (unsigned) l != l)
+ return -ERANGE;
+
+ *ret_u = (unsigned) l;
+ return 0;
+}
+
+int safe_atoi(const char *s, int *ret_i) {
+ char *x = NULL;
+ long l;
+
+ assert(s);
+ assert(ret_i);
+
+ errno = 0;
+ l = strtol(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((long) (int) l != l)
+ return -ERANGE;
+
+ *ret_i = (int) l;
+ return 0;
+}
+
+int safe_atollu(const char *s, long long unsigned *ret_llu) {
+ char *x = NULL;
+ unsigned long long l;
+
+ assert(s);
+ assert(ret_llu);
+
+ errno = 0;
+ l = strtoull(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno ? -errno : -EINVAL;
+
+ *ret_llu = l;
+ return 0;
+}
+
+int safe_atolli(const char *s, long long int *ret_lli) {
+ char *x = NULL;
+ long long l;
+
+ assert(s);
+ assert(ret_lli);
+
+ errno = 0;
+ l = strtoll(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno ? -errno : -EINVAL;
+
+ *ret_lli = l;
+ return 0;
+}
+
+int safe_atou8(const char *s, uint8_t *ret) {
+ char *x = NULL;
+ unsigned long l;
+
+ assert(s);
+ assert(ret);
+
+ errno = 0;
+ l = strtoul(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((unsigned long) (uint8_t) l != l)
+ return -ERANGE;
+
+ *ret = (uint8_t) l;
+ return 0;
+}
+
+int safe_atou16(const char *s, uint16_t *ret) {
+ char *x = NULL;
+ unsigned long l;
+
+ assert(s);
+ assert(ret);
+
+ errno = 0;
+ l = strtoul(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((unsigned long) (uint16_t) l != l)
+ return -ERANGE;
+
+ *ret = (uint16_t) l;
+ return 0;
+}
+
+int safe_atoi16(const char *s, int16_t *ret) {
+ char *x = NULL;
+ long l;
+
+ assert(s);
+ assert(ret);
+
+ errno = 0;
+ l = strtol(s, &x, 0);
+
+ if (!x || x == s || *x || errno)
+ return errno > 0 ? -errno : -EINVAL;
+
+ if ((long) (int16_t) l != l)
+ return -ERANGE;
+
+ *ret = (int16_t) l;
+ return 0;
+}
+
+int safe_atod(const char *s, double *ret_d) {
+ char *x = NULL;
+ double d = 0;
+ locale_t loc;
+
+ assert(s);
+ assert(ret_d);
+
+ loc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
+ if (loc == (locale_t) 0)
+ return -errno;
+
+ errno = 0;
+ d = strtod_l(s, &x, loc);
+
+ if (!x || x == s || *x || errno) {
+ freelocale(loc);
+ return errno ? -errno : -EINVAL;
+ }
+
+ freelocale(loc);
+ *ret_d = (double) d;
+ return 0;
+}
diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h
new file mode 100644
index 0000000000..35b4ba030c
--- /dev/null
+++ b/src/basic/parse-util.h
@@ -0,0 +1,88 @@
+/*-*- 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 <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+#include <sys/types.h>
+
+#include "macro.h"
+
+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);
+
+int parse_size(const char *t, uint64_t base, uint64_t *size);
+
+#define FORMAT_BYTES_MAX 8
+char *format_bytes(char *buf, size_t l, uint64_t t);
+
+int safe_atou(const char *s, unsigned *ret_u);
+int safe_atoi(const char *s, int *ret_i);
+int safe_atollu(const char *s, unsigned long long *ret_u);
+int safe_atolli(const char *s, long long int *ret_i);
+
+int safe_atou8(const char *s, uint8_t *ret);
+
+int safe_atou16(const char *s, uint16_t *ret);
+int safe_atoi16(const char *s, int16_t *ret);
+
+static inline int safe_atou32(const char *s, uint32_t *ret_u) {
+ assert_cc(sizeof(uint32_t) == sizeof(unsigned));
+ return safe_atou(s, (unsigned*) ret_u);
+}
+
+static inline int safe_atoi32(const char *s, int32_t *ret_i) {
+ assert_cc(sizeof(int32_t) == sizeof(int));
+ return safe_atoi(s, (int*) ret_i);
+}
+
+static inline int safe_atou64(const char *s, uint64_t *ret_u) {
+ assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
+ return safe_atollu(s, (unsigned long long*) ret_u);
+}
+
+static inline int safe_atoi64(const char *s, int64_t *ret_i) {
+ assert_cc(sizeof(int64_t) == sizeof(long long int));
+ return safe_atolli(s, (long long int*) ret_i);
+}
+
+#if LONG_MAX == INT_MAX
+static inline int safe_atolu(const char *s, unsigned long *ret_u) {
+ assert_cc(sizeof(unsigned long) == sizeof(unsigned));
+ return safe_atou(s, (unsigned*) ret_u);
+}
+static inline int safe_atoli(const char *s, long int *ret_u) {
+ assert_cc(sizeof(long int) == sizeof(int));
+ return safe_atoi(s, (int*) ret_u);
+}
+#else
+static inline int safe_atolu(const char *s, unsigned long *ret_u) {
+ assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
+ return safe_atollu(s, (unsigned long long*) ret_u);
+}
+static inline int safe_atoli(const char *s, long int *ret_u) {
+ assert_cc(sizeof(long int) == sizeof(long long int));
+ return safe_atolli(s, (long long int*) ret_u);
+}
+#endif
+
+int safe_atod(const char *s, double *ret_d);
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index e25e50e78a..0015667ac0 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -32,6 +32,7 @@
#include "log.h"
#include "macro.h"
#include "missing.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c
index 730f99e0af..e5ac6317d4 100644
--- a/src/basic/signal-util.c
+++ b/src/basic/signal-util.c
@@ -19,11 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "parse-util.h"
+#include "signal-util.h"
#include "string-util.h"
#include "util.h"
-#include "signal-util.h"
-
int reset_all_signal_handlers(void) {
static const struct sigaction sa = {
.sa_handler = SIG_DFL,
@@ -268,3 +268,7 @@ int signal_from_string_try_harder(const char *s) {
return signo;
}
+
+void nop_signal_handler(int sig) {
+ /* nothing here */
+}
diff --git a/src/basic/signal-util.h b/src/basic/signal-util.h
index 5e6eb50b07..e7393e2dac 100644
--- a/src/basic/signal-util.h
+++ b/src/basic/signal-util.h
@@ -39,3 +39,5 @@ const char *signal_to_string(int i) _const_;
int signal_from_string(const char *s) _pure_;
int signal_from_string_try_harder(const char *s);
+
+void nop_signal_handler(int sig);
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 684ac765f5..c4af6aa941 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -35,6 +35,7 @@
#include "formats-util.h"
#include "macro.h"
#include "missing.h"
+#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "string-util.h"
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 7dfab0af62..2fe5c26a67 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -34,6 +34,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "io-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "socket-util.h"
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 7e6c4c645d..0b3cf3d733 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -22,11 +22,12 @@
#include <pwd.h>
#include <grp.h>
-#include "user-util.h"
#include "macro.h"
-#include "util.h"
-#include "string-util.h"
+#include "parse-util.h"
#include "path-util.h"
+#include "string-util.h"
+#include "user-util.h"
+#include "util.h"
bool uid_is_valid(uid_t uid) {
diff --git a/src/basic/util.c b/src/basic/util.c
index d5227aa6d0..66b7978c60 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -89,6 +89,7 @@
#include "macro.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "random-util.h"
@@ -133,201 +134,6 @@ int unlink_noerrno(const char *path) {
return 0;
}
-int parse_boolean(const char *v) {
- assert(v);
-
- if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
- return 1;
- else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
- return 0;
-
- return -EINVAL;
-}
-
-int parse_pid(const char *s, pid_t* ret_pid) {
- unsigned long ul = 0;
- pid_t pid;
- int r;
-
- assert(s);
- assert(ret_pid);
-
- r = safe_atolu(s, &ul);
- if (r < 0)
- return r;
-
- pid = (pid_t) ul;
-
- if ((unsigned long) pid != ul)
- return -ERANGE;
-
- if (pid <= 0)
- return -ERANGE;
-
- *ret_pid = pid;
- return 0;
-}
-
-int safe_atou(const char *s, unsigned *ret_u) {
- char *x = NULL;
- unsigned long l;
-
- assert(s);
- assert(ret_u);
-
- errno = 0;
- l = strtoul(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((unsigned long) (unsigned) l != l)
- return -ERANGE;
-
- *ret_u = (unsigned) l;
- return 0;
-}
-
-int safe_atoi(const char *s, int *ret_i) {
- char *x = NULL;
- long l;
-
- assert(s);
- assert(ret_i);
-
- errno = 0;
- l = strtol(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((long) (int) l != l)
- return -ERANGE;
-
- *ret_i = (int) l;
- return 0;
-}
-
-int safe_atou8(const char *s, uint8_t *ret) {
- char *x = NULL;
- unsigned long l;
-
- assert(s);
- assert(ret);
-
- errno = 0;
- l = strtoul(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((unsigned long) (uint8_t) l != l)
- return -ERANGE;
-
- *ret = (uint8_t) l;
- return 0;
-}
-
-int safe_atou16(const char *s, uint16_t *ret) {
- char *x = NULL;
- unsigned long l;
-
- assert(s);
- assert(ret);
-
- errno = 0;
- l = strtoul(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((unsigned long) (uint16_t) l != l)
- return -ERANGE;
-
- *ret = (uint16_t) l;
- return 0;
-}
-
-int safe_atoi16(const char *s, int16_t *ret) {
- char *x = NULL;
- long l;
-
- assert(s);
- assert(ret);
-
- errno = 0;
- l = strtol(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno > 0 ? -errno : -EINVAL;
-
- if ((long) (int16_t) l != l)
- return -ERANGE;
-
- *ret = (int16_t) l;
- return 0;
-}
-
-int safe_atollu(const char *s, long long unsigned *ret_llu) {
- char *x = NULL;
- unsigned long long l;
-
- assert(s);
- assert(ret_llu);
-
- errno = 0;
- l = strtoull(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno ? -errno : -EINVAL;
-
- *ret_llu = l;
- return 0;
-}
-
-int safe_atolli(const char *s, long long int *ret_lli) {
- char *x = NULL;
- long long l;
-
- assert(s);
- assert(ret_lli);
-
- errno = 0;
- l = strtoll(s, &x, 0);
-
- if (!x || x == s || *x || errno)
- return errno ? -errno : -EINVAL;
-
- *ret_lli = l;
- return 0;
-}
-
-int safe_atod(const char *s, double *ret_d) {
- char *x = NULL;
- double d = 0;
- locale_t loc;
-
- assert(s);
- assert(ret_d);
-
- loc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
- if (loc == (locale_t) 0)
- return -errno;
-
- errno = 0;
- d = strtod_l(s, &x, loc);
-
- if (!x || x == s || *x || errno) {
- freelocale(loc);
- return errno ? -errno : -EINVAL;
- }
-
- freelocale(loc);
- *ret_d = (double) d;
- return 0;
-}
-
-
int fchmod_umask(int fd, mode_t m) {
mode_t u;
int r;
@@ -1195,134 +1001,6 @@ bool fstype_is_network(const char *fstype) {
return nulstr_contains(table, fstype);
}
-int parse_size(const char *t, uint64_t base, uint64_t *size) {
-
- /* Soo, sometimes we want to parse IEC binary suffixes, and
- * sometimes SI decimal suffixes. This function can parse
- * both. Which one is the right way depends on the
- * context. Wikipedia suggests that SI is customary for
- * hardware metrics and network speeds, while IEC is
- * customary for most data sizes used by software and volatile
- * (RAM) memory. Hence be careful which one you pick!
- *
- * In either case we use just K, M, G as suffix, and not Ki,
- * Mi, Gi or so (as IEC would suggest). That's because that's
- * frickin' ugly. But this means you really need to make sure
- * to document which base you are parsing when you use this
- * call. */
-
- struct table {
- const char *suffix;
- unsigned long long factor;
- };
-
- static const struct table iec[] = {
- { "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
- { "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
- { "T", 1024ULL*1024ULL*1024ULL*1024ULL },
- { "G", 1024ULL*1024ULL*1024ULL },
- { "M", 1024ULL*1024ULL },
- { "K", 1024ULL },
- { "B", 1ULL },
- { "", 1ULL },
- };
-
- static const struct table si[] = {
- { "E", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
- { "P", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
- { "T", 1000ULL*1000ULL*1000ULL*1000ULL },
- { "G", 1000ULL*1000ULL*1000ULL },
- { "M", 1000ULL*1000ULL },
- { "K", 1000ULL },
- { "B", 1ULL },
- { "", 1ULL },
- };
-
- const struct table *table;
- const char *p;
- unsigned long long r = 0;
- unsigned n_entries, start_pos = 0;
-
- assert(t);
- assert(base == 1000 || base == 1024);
- assert(size);
-
- if (base == 1000) {
- table = si;
- n_entries = ELEMENTSOF(si);
- } else {
- table = iec;
- n_entries = ELEMENTSOF(iec);
- }
-
- p = t;
- do {
- unsigned long long l, tmp;
- double frac = 0;
- char *e;
- unsigned i;
-
- p += strspn(p, WHITESPACE);
- if (*p == '-')
- return -ERANGE;
-
- errno = 0;
- l = strtoull(p, &e, 10);
- if (errno > 0)
- return -errno;
- if (e == p)
- return -EINVAL;
-
- if (*e == '.') {
- e++;
-
- /* strtoull() itself would accept space/+/- */
- if (*e >= '0' && *e <= '9') {
- unsigned long long l2;
- char *e2;
-
- l2 = strtoull(e, &e2, 10);
- if (errno > 0)
- return -errno;
-
- /* Ignore failure. E.g. 10.M is valid */
- frac = l2;
- for (; e < e2; e++)
- frac /= 10;
- }
- }
-
- e += strspn(e, WHITESPACE);
-
- for (i = start_pos; i < n_entries; i++)
- if (startswith(e, table[i].suffix))
- break;
-
- if (i >= n_entries)
- return -EINVAL;
-
- if (l + (frac > 0) > ULLONG_MAX / table[i].factor)
- return -ERANGE;
-
- tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
- if (tmp > ULLONG_MAX - r)
- return -ERANGE;
-
- r += tmp;
- if ((unsigned long long) (uint64_t) r != r)
- return -ERANGE;
-
- p = e + strlen(table[i].suffix);
-
- start_pos = i + 1;
-
- } while (*p);
-
- *size = r;
-
- return 0;
-}
-
bool is_device_path(const char *path) {
/* Returns true on paths that refer to a device, either in
@@ -2300,45 +1978,6 @@ int prot_from_flags(int flags) {
}
}
-char *format_bytes(char *buf, size_t l, uint64_t t) {
- unsigned i;
-
- static const struct {
- const char *suffix;
- uint64_t factor;
- } table[] = {
- { "E", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
- { "P", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
- { "T", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
- { "G", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
- { "M", UINT64_C(1024)*UINT64_C(1024) },
- { "K", UINT64_C(1024) },
- };
-
- if (t == (uint64_t) -1)
- return NULL;
-
- for (i = 0; i < ELEMENTSOF(table); i++) {
-
- if (t >= table[i].factor) {
- snprintf(buf, l,
- "%" PRIu64 ".%" PRIu64 "%s",
- t / table[i].factor,
- ((t*UINT64_C(10)) / table[i].factor) % UINT64_C(10),
- table[i].suffix);
-
- goto finish;
- }
- }
-
- snprintf(buf, l, "%" PRIu64 "B", t);
-
-finish:
- buf[l-1] = 0;
- return buf;
-
-}
-
void* memdup(const void *p, size_t l) {
void *r;
@@ -4111,27 +3750,6 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char
return 0;
}
-int parse_mode(const char *s, mode_t *ret) {
- char *x;
- long l;
-
- assert(s);
- assert(ret);
-
- errno = 0;
- l = strtol(s, &x, 8);
- if (errno != 0)
- return -errno;
-
- if (!x || x == s || *x)
- return -EINVAL;
- if (l < 0 || l > 07777)
- return -ERANGE;
-
- *ret = (mode_t) l;
- return 0;
-}
-
int mount_move_root(const char *path) {
assert(path);
@@ -4220,10 +3838,6 @@ int fgetxattr_malloc(int fd, const char *name, char **value) {
}
}
-void nop_signal_handler(int sig) {
- /* nothing here */
-}
-
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);
diff --git a/src/basic/util.h b/src/basic/util.h
index f32033767a..d51b824294 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -53,8 +53,6 @@
#define COMMENTS "#;"
#define GLOB_CHARS "*?["
-#define FORMAT_BYTES_MAX 8
-
size_t page_size(void) _pure_;
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
@@ -87,64 +85,6 @@ static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
-int parse_size(const char *t, uint64_t base, uint64_t *size);
-
-int parse_boolean(const char *v) _pure_;
-int parse_pid(const char *s, pid_t* ret_pid);
-
-int safe_atou(const char *s, unsigned *ret_u);
-int safe_atoi(const char *s, int *ret_i);
-
-int safe_atollu(const char *s, unsigned long long *ret_u);
-int safe_atolli(const char *s, long long int *ret_i);
-
-int safe_atod(const char *s, double *ret_d);
-
-int safe_atou8(const char *s, uint8_t *ret);
-
-#if LONG_MAX == INT_MAX
-static inline int safe_atolu(const char *s, unsigned long *ret_u) {
- assert_cc(sizeof(unsigned long) == sizeof(unsigned));
- return safe_atou(s, (unsigned*) ret_u);
-}
-static inline int safe_atoli(const char *s, long int *ret_u) {
- assert_cc(sizeof(long int) == sizeof(int));
- return safe_atoi(s, (int*) ret_u);
-}
-#else
-static inline int safe_atolu(const char *s, unsigned long *ret_u) {
- assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
- return safe_atollu(s, (unsigned long long*) ret_u);
-}
-static inline int safe_atoli(const char *s, long int *ret_u) {
- assert_cc(sizeof(long int) == sizeof(long long int));
- return safe_atolli(s, (long long int*) ret_u);
-}
-#endif
-
-static inline int safe_atou32(const char *s, uint32_t *ret_u) {
- assert_cc(sizeof(uint32_t) == sizeof(unsigned));
- return safe_atou(s, (unsigned*) ret_u);
-}
-
-static inline int safe_atoi32(const char *s, int32_t *ret_i) {
- assert_cc(sizeof(int32_t) == sizeof(int));
- return safe_atoi(s, (int*) ret_i);
-}
-
-static inline int safe_atou64(const char *s, uint64_t *ret_u) {
- assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
- return safe_atollu(s, (unsigned long long*) ret_u);
-}
-
-static inline int safe_atoi64(const char *s, int64_t *ret_i) {
- assert_cc(sizeof(int64_t) == sizeof(long long int));
- return safe_atolli(s, (long long int*) ret_i);
-}
-
-int safe_atou16(const char *s, uint16_t *ret);
-int safe_atoi16(const char *s, int16_t *ret);
-
int readlinkat_malloc(int fd, const char *p, char **ret);
int readlink_malloc(const char *p, char **r);
int readlink_value(const char *p, char **ret);
@@ -336,8 +276,6 @@ bool kexec_loaded(void);
int prot_from_flags(int flags) _const_;
-char *format_bytes(char *buf, size_t l, uint64_t t);
-
void* memdup(const void *p, size_t l) _alloc_(2);
int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...);
@@ -680,15 +618,11 @@ int syslog_parse_priority(const char **p, int *priority, bool with_facility);
int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
-int parse_mode(const char *s, mode_t *ret);
-
int mount_move_root(const char *path);
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
int fgetxattr_malloc(int fd, const char *name, char **value);
-void nop_signal_handler(int sig);
-
int version(void);
bool fdname_is_valid(const char *s);
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index ef113ed40c..c0019174ab 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -55,6 +55,7 @@
#include "io-util.h"
#include "list.h"
#include "macro.h"
+#include "parse-util.h"
#include "path-util.h"
#include "store.h"
#include "string-util.h"
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 6066e14288..50b69637ef 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -35,6 +35,7 @@
#include "cgroup-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "parse-util.h"
#include "store.h"
#include "string-util.h"
#include "strxcpyx.h"
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 3786dae2d9..43b8af4420 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -36,6 +36,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "terminal-util.h"
diff --git a/src/core/automount.c b/src/core/automount.c
index d362d6579d..2ee32312fb 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -40,6 +40,7 @@
#include "label.h"
#include "mkdir.h"
#include "mount.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "special.h"
diff --git a/src/core/busname.c b/src/core/busname.c
index 335a1fdc4c..df4a8bef52 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -30,6 +30,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "kdbus.h"
+#include "parse-util.h"
#include "service.h"
#include "signal-util.h"
#include "special.h"
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 2a2cf02774..a33eaa8d42 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -25,6 +25,7 @@
#include "cgroup-util.h"
#include "cgroup.h"
#include "fd-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "special.h"
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 6f1e0dc6ac..a7fbd71144 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -36,13 +36,13 @@
#include "ioprio.h"
#include "missing.h"
#include "namespace.h"
+#include "parse-util.h"
#include "path-util.h"
-#include "strv.h"
-#include "utf8.h"
-
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
#endif
+#include "strv.h"
+#include "utf8.h"
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
diff --git a/src/core/device.c b/src/core/device.c
index 9127d2d225..fb467a4876 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -25,14 +25,15 @@
#include "libudev.h"
#include "dbus-device.h"
+#include "device.h"
#include "log.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "swap.h"
#include "udev-util.h"
#include "unit-name.h"
#include "unit.h"
-#include "device.h"
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/execute.c b/src/core/execute.c
index 3f2607ff1a..24a8e646ad 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -76,6 +76,7 @@
#include "missing.h"
#include "mkdir.h"
#include "namespace.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "rm-rf.h"
diff --git a/src/core/job.c b/src/core/job.c
index 8a0e0a0ea4..7fde88f5fe 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -28,8 +28,10 @@
#include "dbus-job.h"
#include "dbus.h"
#include "escape.h"
+#include "job.h"
#include "log.h"
#include "macro.h"
+#include "parse-util.h"
#include "set.h"
#include "special.h"
#include "string-util.h"
@@ -37,7 +39,6 @@
#include "terminal-util.h"
#include "unit.h"
#include "virt.h"
-#include "job.h"
Job* job_new_raw(Unit *unit) {
Job *j;
diff --git a/src/core/killall.c b/src/core/killall.c
index cb11987166..dbfa90ebac 100644
--- a/src/core/killall.c
+++ b/src/core/killall.c
@@ -27,6 +27,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "killall.h"
+#include "parse-util.h"
#include "process-util.h"
#include "set.h"
#include "string-util.h"
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 31fdc48823..f5c28e514f 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -48,6 +48,7 @@
#include "load-fragment.h"
#include "log.h"
#include "missing.h"
+#include "parse-util.h"
#include "path-util.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
diff --git a/src/core/main.c b/src/core/main.c
index b0ca6fa10e..a8834b6f0b 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -67,6 +67,7 @@
#include "missing.h"
#include "mount-setup.h"
#include "pager.h"
+#include "parse-util.h"
#include "process-util.h"
#include "selinux-setup.h"
#include "selinux-util.h"
diff --git a/src/core/manager.c b/src/core/manager.c
index 287676ff27..9ad8a136ab 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -62,6 +62,7 @@
#include "manager.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "process-util.h"
diff --git a/src/core/mount.c b/src/core/mount.c
index ebdb3503e9..59f56bdefa 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -36,6 +36,7 @@
#include "mkdir.h"
#include "mount-setup.h"
#include "mount.h"
+#include "parse-util.h"
#include "path-util.h"
#include "smack-util.h"
#include "special.h"
diff --git a/src/core/service.c b/src/core/service.c
index abcbd4954f..d5bd8869da 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -39,6 +39,7 @@
#include "load-fragment.h"
#include "log.h"
#include "manager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "service.h"
diff --git a/src/core/show-status.c b/src/core/show-status.c
index 7951ea7303..9e4c9f563e 100644
--- a/src/core/show-status.c
+++ b/src/core/show-status.c
@@ -19,9 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "parse-util.h"
+#include "show-status.h"
#include "string-util.h"
#include "util.h"
-#include "show-status.h"
int parse_show_status(const char *v, ShowStatus *ret) {
int r;
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 33383a4b0b..93bbc315d3 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -37,6 +37,7 @@
#include "killall.h"
#include "log.h"
#include "missing.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "switch-root.h"
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
index 15726c344e..da1c99ad12 100644
--- a/src/core/snapshot.c
+++ b/src/core/snapshot.c
@@ -23,10 +23,12 @@
#include "bus-common-errors.h"
#include "dbus-snapshot.h"
+#include "parse-util.h"
+#include "parse-util.h"
+#include "snapshot.h"
#include "string-util.h"
#include "unit-name.h"
#include "unit.h"
-#include "snapshot.h"
static const UnitActiveState state_translation_table[_SNAPSHOT_STATE_MAX] = {
[SNAPSHOT_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/snapshot.h b/src/core/snapshot.h
index 97747e18bd..bd52dea408 100644
--- a/src/core/snapshot.h
+++ b/src/core/snapshot.h
@@ -23,6 +23,8 @@
typedef struct Snapshot Snapshot;
+#include "unit.h"
+
struct Snapshot {
Unit meta;
diff --git a/src/core/socket.c b/src/core/socket.c
index 7f401025ed..49cef210dc 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -43,6 +43,7 @@
#include "log.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "signal-util.h"
diff --git a/src/core/swap.c b/src/core/swap.c
index d864c7b304..c4151c6afd 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -32,6 +32,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "fstab-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"
diff --git a/src/core/timer.c b/src/core/timer.c
index 908d45ac73..3ece2e056d 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -24,6 +24,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "dbus-timer.h"
+#include "parse-util.h"
#include "special.h"
#include "string-util.h"
#include "timer.h"
diff --git a/src/core/unit.c b/src/core/unit.c
index 572b1c1b78..17c135cf3f 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -44,6 +44,7 @@
#include "macro.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 78adcf18d6..51a2c6dfd7 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -28,6 +28,7 @@
#include "hashmap.h"
#include "log.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index f5fb6a09fe..4c1d8a8e74 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -32,6 +32,7 @@
#include "escape.h"
#include "fileio.h"
#include "log.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c
index 7f26108e9c..115f99e68c 100644
--- a/src/debug-generator/debug-generator.c
+++ b/src/debug-generator/debug-generator.c
@@ -24,6 +24,7 @@
#include "unit-name.h"
#include "mkdir.h"
#include "string-util.h"
+#include "parse-util.h"
static const char *arg_dest = "/tmp";
static char **arg_mask = NULL;
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 5dbd526b9b..bb2e6195b9 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -30,6 +30,7 @@
#include "hashmap.h"
#include "log.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 5aa247b2ae..abb5e77966 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -26,17 +26,18 @@
#include "ask-password-api.h"
#include "copy.h"
+#include "fd-util.h"
#include "fileio.h"
#include "hostname-util.h"
#include "locale-util.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "random-util.h"
+#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "time-util.h"
-#include "string-util.h"
-#include "fd-util.h"
static char *arg_root = NULL;
static char *arg_locale = NULL; /* $LANG */
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index 9c49557787..7415be1529 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -37,6 +37,7 @@
#include "bus-util.h"
#include "device-util.h"
#include "fd-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 0a3917b7ba..18baf6cc7d 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -31,6 +31,7 @@
#include "log.h"
#include "mkdir.h"
#include "mount-setup.h"
+#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index ba97c98d6f..ac6d731753 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -37,6 +37,7 @@
#include "gpt.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index dd508aefb5..8bff7d4b39 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -24,16 +24,17 @@
#include <unistd.h>
#include <sys/utsname.h>
-#include "util.h"
-#include "strv.h"
+#include "bus-util.h"
#include "def.h"
-#include "virt.h"
#include "env-util.h"
-#include "fileio-label.h"
-#include "bus-util.h"
#include "event-util.h"
-#include "selinux-util.h"
+#include "fileio-label.h"
#include "hostname-util.h"
+#include "parse-util.h"
+#include "selinux-util.h"
+#include "strv.h"
+#include "util.h"
+#include "virt.h"
#define VALID_DEPLOYMENT_CHARS (DIGITS LETTERS "-.:")
diff --git a/src/import/importd.c b/src/import/importd.c
index b712cedcc6..975907e3c9 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -32,6 +32,7 @@
#include "machine-pool.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
diff --git a/src/import/pull-job.c b/src/import/pull-job.c
index 4736306de2..fd05877705 100644
--- a/src/import/pull-job.c
+++ b/src/import/pull-job.c
@@ -24,6 +24,7 @@
#include "fd-util.h"
#include "io-util.h"
#include "machine-pool.h"
+#include "parse-util.h"
#include "pull-job.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/import/pull.c b/src/import/pull.c
index 73d5f391c2..5029933074 100644
--- a/src/import/pull.c
+++ b/src/import/pull.c
@@ -27,6 +27,7 @@
#include "hostname-util.h"
#include "import-util.h"
#include "machine-image.h"
+#include "parse-util.h"
#include "pull-dkr.h"
#include "pull-raw.h"
#include "pull-tar.h"
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index 92ef723aff..b8a513bb74 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -40,6 +40,7 @@
#include "log.h"
#include "logs-show.h"
#include "microhttpd-util.h"
+#include "parse-util.h"
#include "sigbus.h"
#include "util.h"
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c
index bb299e378c..db1636ac3e 100644
--- a/src/journal-remote/journal-remote-parse.c
+++ b/src/journal-remote/journal-remote-parse.c
@@ -22,6 +22,7 @@
#include "fd-util.h"
#include "journal-remote-parse.h"
#include "journald-native.h"
+#include "parse-util.h"
#include "string-util.h"
#define LINE_CHUNK 8*1024u
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index de207f8d24..01c8e5c37a 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -44,6 +44,7 @@
#include "journal-remote.h"
#include "journald-native.h"
#include "macro.h"
+#include "parse-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index a945a9971a..20e2a2f73b 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -34,6 +34,7 @@
#include "journal-upload.h"
#include "log.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "sigbus.h"
#include "signal-util.h"
#include "string-util.h"
diff --git a/src/journal/cat.c b/src/journal/cat.c
index ff1887604a..95a1868b93 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -29,6 +29,7 @@
#include "sd-journal.h"
#include "fd-util.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 7336db219b..92f598464a 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -47,6 +47,7 @@
#include "log.h"
#include "macro.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "process-util.h"
#include "special.h"
#include "stacktrace.h"
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index f891ddffc6..fecccd4eb9 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -34,6 +34,7 @@
#include "log.h"
#include "macro.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"
@@ -41,8 +42,8 @@
#include "signal-util.h"
#include "string-util.h"
#include "terminal-util.h"
-#include "util.h"
#include "user-util.h"
+#include "util.h"
static enum {
ACTION_NONE,
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index f193cb90ce..c33e278cbe 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -35,6 +35,7 @@
#include "journal-def.h"
#include "journal-file.h"
#include "lookup3.h"
+#include "parse-util.h"
#include "random-util.h"
#include "string-util.h"
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index dca5bf5000..026dca4901 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -29,6 +29,7 @@
#include "journal-def.h"
#include "journal-file.h"
#include "journal-vacuum.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 6e452a4d51..c13b674e15 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -56,6 +56,7 @@
#include "logs-show.h"
#include "mkdir.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "sigbus.h"
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index 5f3eb05275..4a5e07ec5d 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -23,13 +23,14 @@
#include <fcntl.h>
#include <sys/socket.h>
+#include "fd-util.h"
#include "fileio.h"
-#include "journald-server.h"
-#include "journald-console.h"
#include "formats-util.h"
+#include "journald-console.h"
+#include "journald-server.h"
+#include "parse-util.h"
#include "process-util.h"
#include "terminal-util.h"
-#include "fd-util.h"
static bool prefix_timestamp(void) {
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 5a05632e56..e680aafafe 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -34,6 +34,7 @@
#include "journald-kmsg.h"
#include "journald-server.h"
#include "journald-syslog.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 7d4aac687e..ae229ecaf5 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -32,6 +32,7 @@
#include "journald-syslog.h"
#include "journald-wall.h"
#include "memfd-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "socket-util.h"
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 7cefea323e..f286e3030f 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -54,6 +54,7 @@
#include "journald-syslog.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "process-util.h"
#include "rm-rf.h"
#include "selinux-util.h"
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 0dd511519c..6745864da1 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -39,6 +39,7 @@
#include "journald-syslog.h"
#include "journald-wall.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "string-util.h"
diff --git a/src/journal/test-compress-benchmark.c b/src/journal/test-compress-benchmark.c
index 0a9ab7f52c..5a2f0564ca 100644
--- a/src/journal/test-compress-benchmark.c
+++ b/src/journal/test-compress-benchmark.c
@@ -21,6 +21,7 @@
#include "compress.h"
#include "macro.h"
+#include "parse-util.h"
#include "random-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/journal/test-journal-init.c b/src/journal/test-journal-init.c
index 717b703d19..142da85041 100644
--- a/src/journal/test-journal-init.c
+++ b/src/journal/test-journal-init.c
@@ -22,6 +22,7 @@
#include "sd-journal.h"
#include "log.h"
+#include "parse-util.h"
#include "rm-rf.h"
#include "util.h"
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 8069339c1f..3c8b0268a4 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -24,11 +24,13 @@
#include <fcntl.h>
#include "sd-journal.h"
+
#include "journal-file.h"
#include "journal-vacuum.h"
-#include "util.h"
#include "log.h"
+#include "parse-util.h"
#include "rm-rf.h"
+#include "util.h"
/* This program tests skipping around in a multi-file journal.
*/
diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c
index b5ecf2f375..b8482743a2 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -19,16 +19,18 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <unistd.h>
#include <fcntl.h>
+#include <unistd.h>
#include "sd-journal.h"
-#include "util.h"
+
+#include "journal-file.h"
+#include "journal-internal.h"
#include "log.h"
#include "macro.h"
+#include "parse-util.h"
#include "rm-rf.h"
-#include "journal-file.h"
-#include "journal-internal.h"
+#include "util.h"
#define N_ENTRIES 200
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 39551b5761..926ad0b02f 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -29,12 +29,13 @@
#include "conf-parser.h"
#include "dhcp-lease-internal.h"
#include "log.h"
+#include "network-internal.h"
+#include "parse-util.h"
#include "siphash24.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
-#include "network-internal.h"
const char *net_get_name(struct udev_device *device) {
const char *name, *field;
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index d982936a28..94a276fb28 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -34,6 +34,7 @@
#include "hostname-util.h"
#include "in-addr-util.h"
#include "network-internal.h"
+#include "parse-util.h"
#include "unaligned.h"
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) {
diff --git a/src/libsystemd-network/test-ipv4ll-manual.c b/src/libsystemd-network/test-ipv4ll-manual.c
index 08421c3575..9485a7df64 100644
--- a/src/libsystemd-network/test-ipv4ll-manual.c
+++ b/src/libsystemd-network/test-ipv4ll-manual.c
@@ -32,6 +32,7 @@
#include "event-util.h"
#include "in-addr-util.h"
#include "netlink-util.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index d7bff784b8..eee53b6407 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -32,6 +32,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "formats-util.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index f311e86d44..6f396b7953 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -45,6 +45,7 @@
#include "fileio.h"
#include "formats-util.h"
#include "memfd-util.h"
+#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index d3e846db84..4b121e849a 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -33,6 +33,7 @@
#include "fd-util.h"
#include "log.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "strv.h"
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 7b91c2583d..36370e79e3 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -48,6 +48,7 @@
#include "hostname-util.h"
#include "macro.h"
#include "missing.h"
+#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 85c73722df..a125be7cb8 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -36,6 +36,7 @@
#include "sd-daemon.h"
#include "fd-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "strv.h"
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index bcabf9468d..91690d83f6 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -32,6 +32,7 @@
#include "hashmap.h"
#include "macro.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "refcnt.h"
#include "set.h"
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index 593dda52f2..0e7a26523d 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -31,6 +31,7 @@
#include "fileio.h"
#include "hashmap.h"
#include "macro.h"
+#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "string-util.h"
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index f564d43e06..05cba9651a 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -36,6 +36,7 @@
#include "io-util.h"
#include "login-util.h"
#include "macro.h"
+#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index ad1227264c..6cc3321f42 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -33,6 +33,7 @@
#include "strv.h"
#include "util.h"
#include "fd-util.h"
+#include "parse-util.h"
_public_ int sd_network_get_operational_state(char **state) {
_cleanup_free_ char *s = NULL;
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 1e513f3ff7..bd349e3f64 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -41,6 +41,7 @@
#include "device-util.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
+#include "parse-util.h"
/**
* SECTION:libudev-device
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 1cd186dec3..92443c8190 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -35,6 +35,7 @@
#include "logs-show.h"
#include "macro.h"
#include "pager.h"
+#include "parse-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "spawn-polkit-agent.h"
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index c4b74eb734..460c2f0bd8 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -30,6 +30,7 @@
#include "formats-util.h"
#include "logind-inhibit.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "string-util.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index dad552d5f2..2566894d05 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -31,6 +31,7 @@
#include "logind-acl.h"
#include "logind-seat.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 714b1cb299..9651d3e24a 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -41,6 +41,7 @@
#include "io-util.h"
#include "logind-session.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "terminal-util.h"
#include "user-util.h"
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 80328068cd..9f3af59b54 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -36,6 +36,7 @@
#include "label.h"
#include "logind-user.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "smack-util.h"
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index dbd055a79a..464da88bcc 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -41,6 +41,7 @@
#include "hostname-util.h"
#include "login-util.h"
#include "macro.h"
+#include "parse-util.h"
#include "socket-util.h"
#include "strv.h"
#include "terminal-util.h"
diff --git a/src/machine/machine.c b/src/machine/machine.c
index e41f8add98..7aff55b761 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -35,6 +35,7 @@
#include "machine-dbus.h"
#include "machine.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "special.h"
#include "terminal-util.h"
#include "unit-name.h"
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 23cc74ab54..274952b8ce 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -48,6 +48,7 @@
#include "macro.h"
#include "mkdir.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "ptyfwd.h"
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index acb6b7ce24..be679acca0 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -36,6 +36,7 @@
#include "local-addresses.h"
#include "netlink-util.h"
#include "pager.h"
+#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index dcd7b482d3..1beb7ffae4 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -24,12 +24,13 @@
#include "conf-parser.h"
#include "firewall-util.h"
#include "netlink-util.h"
+#include "networkd-address.h"
#include "networkd.h"
+#include "parse-util.h"
#include "set.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
-#include "networkd-address.h"
int address_new(Address **ret) {
_cleanup_address_free_ Address *address = NULL;
diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c
index 1a1524dfb4..f40a01fd78 100644
--- a/src/network/networkd-link-bus.c
+++ b/src/network/networkd-link-bus.c
@@ -22,8 +22,9 @@
#include "bus-util.h"
#include "strv.h"
-#include "networkd.h"
#include "networkd-link.h"
+#include "networkd.h"
+#include "parse-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_operational_state, link_operstate, LinkOperationalState);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_administrative_state, link_state, LinkState);
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index bbc4606258..2dd16be381 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -30,9 +30,10 @@
#include "conf-parser.h"
#include "missing.h"
#include "networkd-link.h"
+#include "networkd-netdev-tunnel.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
-#include "networkd-netdev-tunnel.h"
#define DEFAULT_TNL_HOP_LIMIT 64
#define IP6_FLOWINFO_FLOWLABEL htonl(0x000FFFFF)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 150fd052c2..6cef5fb7aa 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -30,6 +30,7 @@
#include "network-internal.h"
#include "networkd-network.h"
#include "networkd.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index fcca679093..7ae6ca2600 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -22,10 +22,11 @@
#include "conf-parser.h"
#include "in-addr-util.h"
#include "netlink-util.h"
+#include "networkd-route.h"
#include "networkd.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
-#include "networkd-route.h"
int route_new(Route **ret) {
_cleanup_route_free_ Route *route = NULL;
diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c
index 4e4a4bbd58..3ada0ce32b 100644
--- a/src/network/networkd-util.c
+++ b/src/network/networkd-util.c
@@ -21,6 +21,7 @@
#include "conf-parser.h"
#include "networkd-util.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/notify/notify.c b/src/notify/notify.c
index 288e0a4316..77f017dbac 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -30,6 +30,7 @@
#include "env-util.h"
#include "formats-util.h"
#include "log.h"
+#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
diff --git a/src/nspawn/nspawn-expose-ports.c b/src/nspawn/nspawn-expose-ports.c
index 98e4a7682f..89c8240399 100644
--- a/src/nspawn/nspawn-expose-ports.c
+++ b/src/nspawn/nspawn-expose-ports.c
@@ -27,6 +27,7 @@
#include "local-addresses.h"
#include "netlink-util.h"
#include "nspawn-expose-ports.h"
+#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 25457fd62d..5d8172092a 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -26,13 +26,14 @@
#include "escape.h"
#include "label.h"
#include "mkdir.h"
+#include "nspawn-mount.h"
+#include "parse-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "set.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
-#include "nspawn-mount.h"
CustomMount* custom_mount_add(CustomMount **l, unsigned *n, CustomMountType t) {
CustomMount *c, *ret;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 6502fe1943..a4eefe5eb8 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -77,6 +77,7 @@
#include "nspawn-register.h"
#include "nspawn-settings.h"
#include "nspawn-setuid.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "ptyfwd.h"
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c
index 97516a87a8..9b808ff110 100644
--- a/src/resolve-host/resolve-host.c
+++ b/src/resolve-host/resolve-host.c
@@ -28,6 +28,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "in-addr-util.h"
+#include "parse-util.h"
#include "resolved-def.h"
#include "resolved-dns-packet.h"
diff --git a/src/resolve/resolved-conf.c b/src/resolve/resolved-conf.c
index 22a5c7fdbf..17eafec2fa 100644
--- a/src/resolve/resolved-conf.c
+++ b/src/resolve/resolved-conf.c
@@ -20,9 +20,10 @@
***/
#include "conf-parser.h"
-#include "string-util.h"
+#include "parse-util.h"
#include "resolved-conf.h"
#include "extract-word.h"
+#include "string-util.h"
int manager_parse_dns_server(Manager *m, DnsServerType type, const char *string) {
DnsServer *first;
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 43a3b61b08..8c88e2dbf1 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -24,6 +24,7 @@
#include "sd-network.h"
#include "missing.h"
+#include "parse-util.h"
#include "resolved-link.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 6144eedfeb..a6aac196db 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -33,6 +33,7 @@
#include "netlink-util.h"
#include "network-internal.h"
#include "ordered-set.h"
+#include "parse-util.h"
#include "random-util.h"
#include "resolved-bus.h"
#include "resolved-conf.h"
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 311343e454..559a176535 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -30,6 +30,7 @@
#include "fileio.h"
#include "io-util.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
diff --git a/src/run/run.c b/src/run/run.c
index 3646305961..dbcb29546f 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -40,6 +40,7 @@
#include "terminal-util.h"
#include "unit-name.h"
#include "user-util.h"
+#include "parse-util.h"
static bool arg_ask_password = true;
static bool arg_scope = false;
diff --git a/src/shared/apparmor-util.c b/src/shared/apparmor-util.c
index c2bbd330bd..48d0f84995 100644
--- a/src/shared/apparmor-util.c
+++ b/src/shared/apparmor-util.c
@@ -19,10 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-
-#include "util.h"
-#include "fileio.h"
#include "apparmor-util.h"
+#include "fileio.h"
+#include "parse-util.h"
+#include "util.h"
bool mac_apparmor_use(void) {
static int cached_use = -1;
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 604b8f248a..53b9752af0 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -37,6 +37,7 @@
#include "fd-util.h"
#include "macro.h"
#include "missing.h"
+#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "signal-util.h"
diff --git a/src/shared/condition.c b/src/shared/condition.c
index b8915dab8a..145ea41095 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -36,6 +36,7 @@
#include "fd-util.h"
#include "hostname-util.h"
#include "ima-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "smack-util.h"
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 1b47c0ab52..8bb33add72 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -27,16 +27,17 @@
#include "sd-messages.h"
#include "conf-files.h"
+#include "conf-parser.h"
+#include "fd-util.h"
#include "log.h"
#include "macro.h"
+#include "parse-util.h"
#include "path-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
-#include "conf-parser.h"
-#include "fd-util.h"
int config_item_table_lookup(
const void *table,
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index d4df9d2acb..a8176af840 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -24,8 +24,9 @@
#include <stringprep.h>
#endif
-#include "string-util.h"
#include "dns-domain.h"
+#include "parse-util.h"
+#include "string-util.h"
int dns_label_unescape(const char **name, char *dest, size_t sz) {
const char *n;
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 4808ede60c..771bc9458c 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -26,6 +26,7 @@
#include "efivars.h"
#include "fd-util.h"
#include "io-util.h"
+#include "parse-util.h"
#include "utf8.h"
#include "util.h"
#include "virt.h"
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
index bdfc13e3cd..20fb0f5a06 100644
--- a/src/shared/fstab-util.c
+++ b/src/shared/fstab-util.c
@@ -19,11 +19,12 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "fstab-util.h"
+#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
-#include "fstab-util.h"
bool fstab_is_mount_point(const char *mount) {
_cleanup_endmntent_ FILE *f = NULL;
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index d8ea4c9f92..3519323b7a 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -33,6 +33,7 @@
#include "journal-internal.h"
#include "log.h"
#include "logs-show.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "terminal-util.h"
diff --git a/src/shared/machine-pool.c b/src/shared/machine-pool.c
index a2cb5fc5a0..c576242b59 100644
--- a/src/shared/machine-pool.c
+++ b/src/shared/machine-pool.c
@@ -29,6 +29,7 @@
#include "lockfile-util.h"
#include "machine-pool.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index b5cb9508bf..0e232e6aa6 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -29,6 +29,7 @@
#include "string-util.h"
#include "strv.h"
#include "util.h"
+#include "parse-util.h"
#define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index fe4213c085..49a4b46fd4 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -61,6 +61,7 @@
#include "macro.h"
#include "mkdir.h"
#include "pager.h"
+#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "process-util.h"
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index afe3ff8fc2..33356f8387 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -25,6 +25,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
+#include "parse-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/test/test-cap-list.c b/src/test/test-cap-list.c
index 43a2d35b80..5f17868458 100644
--- a/src/test/test-cap-list.c
+++ b/src/test/test-cap-list.c
@@ -19,11 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "util.h"
-#include "fileio.h"
+#include <sys/prctl.h>
+
#include "cap-list.h"
#include "capability.h"
-#include <sys/prctl.h>
+#include "fileio.h"
+#include "parse-util.h"
+#include "util.h"
/* verify the capability parser */
static void test_cap_list(void) {
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 7bf59a0aa2..af8d478fa9 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -22,6 +22,7 @@
#include "cgroup-util.h"
#include "fd-util.h"
#include "formats-util.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "test-helper.h"
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index a40f013491..1c1fed4660 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -28,6 +28,7 @@
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/test/test-util.c b/src/test/test-util.c
index c1f8a866af..f42d8f19bb 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -39,14 +39,15 @@
#include "fileio.h"
#include "io-util.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "process-util.h"
#include "rm-rf.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
#include "virt.h"
-#include "user-util.h"
static void test_streq_ptr(void) {
assert_se(streq_ptr(NULL, NULL));
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 68fbe3f5b8..564d72773a 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -30,6 +30,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "pager.h"
+#include "parse-util.h"
#include "spawn-polkit-agent.h"
#include "strv.h"
#include "terminal-util.h"
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 05c4661a2c..57cca17e80 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -52,6 +52,7 @@
#include "macro.h"
#include "missing.h"
#include "mkdir.h"
+#include "parse-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "selinux-util.h"
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index e9577930e3..7459ee1fe2 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -34,6 +34,7 @@
#include "missing.h"
#include "netlink-util.h"
#include "network-internal.h"
+#include "parse-util.h"
#include "path-util.h"
#include "random-util.h"
#include "string-util.h"
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index 5e97bdd614..74df4cb0f4 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -24,6 +24,7 @@
#include <linux/input.h>
#include "fd-util.h"
+#include "parse-util.h"
#include "string-util.h"
#include "udev.h"
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index 3d6ca7a985..c25071b0fe 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -26,6 +26,7 @@
#include <getopt.h>
#include <poll.h>
+#include "parse-util.h"
#include "udev.h"
#include "util.h"
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index df5fd88bff..f1fc1cd082 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -53,6 +53,7 @@
#include "hashmap.h"
#include "io-util.h"
#include "netlink-util.h"
+#include "parse-util.h"
#include "process-util.h"
#include "selinux-util.h"
#include "signal-util.h"