diff options
Diffstat (limited to 'src/shared')
33 files changed, 181 insertions, 192 deletions
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c index bd8c988751..47295ae379 100644 --- a/src/shared/acl-util.c +++ b/src/shared/acl-util.c @@ -22,9 +22,10 @@ #include <errno.h> #include <stdbool.h> -#include "acl-util.h" -#include "util.h" +#include "string-util.h" #include "strv.h" +#include "util.h" +#include "acl-util.h" int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) { acl_entry_t i; diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c index 64e50401b9..b3d2f96885 100644 --- a/src/shared/acpi-fpdt.c +++ b/src/shared/acpi-fpdt.c @@ -19,16 +19,17 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <stdio.h> +#include <fcntl.h> #include <stdint.h> +#include <stdio.h> #include <string.h> #include <unistd.h> -#include <fcntl.h> -#include <util.h> -#include <fileio.h> -#include <time-util.h> -#include <acpi-fpdt.h> +#include "acpi-fpdt.h" +#include "fd-util.h" +#include "fileio.h" +#include "time-util.h" +#include "util.h" struct acpi_table_header { char signature[4]; diff --git a/src/shared/architecture.c b/src/shared/architecture.c index 8e72e7a36a..e5efcd77b6 100644 --- a/src/shared/architecture.c +++ b/src/shared/architecture.c @@ -21,6 +21,7 @@ #include <sys/utsname.h> +#include "string-util.h" #include "architecture.h" int uname_architecture(void) { diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index ddf42f11e1..baa6f159f8 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -32,16 +32,18 @@ #include <termios.h> #include <unistd.h> +#include "ask-password-api.h" +#include "fd-util.h" #include "formats-util.h" #include "missing.h" #include "mkdir.h" #include "random-util.h" #include "signal-util.h" #include "socket-util.h" +#include "string-util.h" #include "strv.h" #include "terminal-util.h" #include "util.h" -#include "ask-password-api.h" #define KEYRING_TIMEOUT_USEC ((5 * USEC_PER_MINUTE) / 2) diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c index 48492ed13d..751dfdec45 100644 --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c @@ -20,14 +20,16 @@ ***/ #include <errno.h> -#include <sys/stat.h> #include <stdlib.h> +#include <sys/stat.h> #include <unistd.h> -#include "base-filesystem.h" #include "log.h" #include "macro.h" +#include "string-util.h" #include "util.h" +#include "base-filesystem.h" +#include "fd-util.h" typedef struct BaseFilesystem { const char *dir; diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index a106b64fd9..fdb6fced02 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -21,29 +21,31 @@ #include <sys/socket.h> +#include "sd-bus.h" #include "sd-daemon.h" #include "sd-event.h" -#include "sd-bus.h" #include "bus-error.h" #include "bus-internal.h" #include "bus-label.h" #include "bus-message.h" +#include "bus-util.h" #include "cgroup-util.h" #include "def.h" #include "env-util.h" +#include "escape.h" +#include "fd-util.h" #include "macro.h" #include "missing.h" #include "path-util.h" #include "set.h" #include "signal-util.h" +#include "string-util.h" #include "strv.h" #include "unit-name.h" #include "utf8.h" #include "util.h" -#include "bus-util.h" - static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { sd_event *e = userdata; diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h index fd70842b9e..3925c10fde 100644 --- a/src/shared/bus-util.h +++ b/src/shared/bus-util.h @@ -21,10 +21,12 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "sd-event.h" #include "sd-bus.h" +#include "sd-event.h" + #include "hashmap.h" #include "install.h" +#include "string-util.h" #include "time-util.h" typedef enum BusTransport { diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c index 31b4f6c684..395e41930c 100644 --- a/src/shared/cgroup-show.c +++ b/src/shared/cgroup-show.c @@ -19,19 +19,21 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <stdio.h> -#include <string.h> #include <dirent.h> #include <errno.h> +#include <stdio.h> +#include <string.h> -#include "util.h" +#include "cgroup-show.h" +#include "cgroup-util.h" +#include "fd-util.h" #include "formats-util.h" -#include "process-util.h" #include "macro.h" #include "path-util.h" -#include "cgroup-util.h" -#include "cgroup-show.h" +#include "process-util.h" +#include "string-util.h" #include "terminal-util.h" +#include "util.h" static int compare(const void *a, const void *b) { const pid_t *p = a, *q = b; diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index d1cdb151b2..fe3187384f 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -19,19 +19,21 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <dirent.h> +#include <fcntl.h> +#include <mqueue.h> #include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/sem.h> #include <sys/msg.h> +#include <sys/sem.h> +#include <sys/shm.h> #include <sys/stat.h> -#include <fcntl.h> -#include <dirent.h> -#include <mqueue.h> -#include "util.h" +#include "clean-ipc.h" +#include "fd-util.h" #include "formats-util.h" +#include "string-util.h" #include "strv.h" -#include "clean-ipc.h" +#include "util.h" static int clean_sysvipc_shm(uid_t delete_uid) { _cleanup_fclose_ FILE *f = NULL; diff --git a/src/shared/condition.c b/src/shared/condition.c index 1d7dd49e04..b8915dab8a 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -19,25 +19,29 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <stdlib.h> #include <errno.h> +#include <fnmatch.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> -#include <fnmatch.h> #include "sd-id128.h" -#include "util.h" -#include "virt.h" -#include "path-util.h" -#include "architecture.h" -#include "smack-util.h" + #include "apparmor-util.h" -#include "ima-util.h" -#include "selinux-util.h" +#include "architecture.h" #include "audit.h" #include "cap-list.h" -#include "hostname-util.h" #include "condition.h" +#include "extract-word.h" +#include "fd-util.h" +#include "hostname-util.h" +#include "ima-util.h" +#include "path-util.h" +#include "selinux-util.h" +#include "smack-util.h" +#include "string-util.h" +#include "util.h" +#include "virt.h" Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) { Condition *c; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index c282fb1231..1b47c0ab52 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -19,21 +19,24 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <string.h> -#include <stdio.h> #include <errno.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include "sd-messages.h" + #include "conf-files.h" -#include "util.h" -#include "macro.h" -#include "strv.h" #include "log.h" -#include "utf8.h" +#include "macro.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 5680f01bd9..d4df9d2acb 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -24,6 +24,7 @@ #include <stringprep.h> #endif +#include "string-util.h" #include "dns-domain.h" int dns_label_unescape(const char **name, char *dest, size_t sz) { diff --git a/src/shared/dropin.c b/src/shared/dropin.c index 1845068adb..1836e91acd 100644 --- a/src/shared/dropin.c +++ b/src/shared/dropin.c @@ -19,12 +19,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include "conf-files.h" #include "dropin.h" -#include "util.h" -#include "strv.h" -#include "mkdir.h" +#include "escape.h" +#include "fd-util.h" #include "fileio-label.h" -#include "conf-files.h" +#include "mkdir.h" +#include "string-util.h" +#include "strv.h" +#include "util.h" int drop_in_file(const char *dir, const char *unit, unsigned level, const char *name, char **_p, char **_q) { diff --git a/src/shared/efivars.c b/src/shared/efivars.c index f087c2a566..b482603bce 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -23,10 +23,11 @@ #include <string.h> #include <fcntl.h> -#include "util.h" +#include "efivars.h" +#include "fd-util.h" #include "utf8.h" +#include "util.h" #include "virt.h" -#include "efivars.h" #ifdef ENABLE_EFI diff --git a/src/shared/formats-util.h b/src/shared/formats-util.h deleted file mode 100644 index ce516b117d..0000000000 --- a/src/shared/formats-util.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -/*** - This file is part of systemd. - - Copyright 2015 Ronny Chevalier - - 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> - -#if SIZEOF_PID_T == 4 -# define PID_PRI PRIi32 -#elif SIZEOF_PID_T == 2 -# define PID_PRI PRIi16 -#else -# error Unknown pid_t size -#endif -#define PID_FMT "%" PID_PRI - -#if SIZEOF_UID_T == 4 -# define UID_FMT "%" PRIu32 -#elif SIZEOF_UID_T == 2 -# define UID_FMT "%" PRIu16 -#else -# error Unknown uid_t size -#endif - -#if SIZEOF_GID_T == 4 -# define GID_FMT "%" PRIu32 -#elif SIZEOF_GID_T == 2 -# define GID_FMT "%" PRIu16 -#else -# error Unknown gid_t size -#endif - -#if SIZEOF_TIME_T == 8 -# define PRI_TIME PRIi64 -#elif SIZEOF_TIME_T == 4 -# define PRI_TIME PRIu32 -#else -# error Unknown time_t size -#endif - -#if SIZEOF_RLIM_T == 8 -# define RLIM_FMT "%" PRIu64 -#elif SIZEOF_RLIM_T == 4 -# define RLIM_FMT "%" PRIu32 -#else -# error Unknown rlim_t size -#endif diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index c065adcfdf..bdfc13e3cd 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -19,10 +19,11 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include "fstab-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/generator.c b/src/shared/generator.c index e58bbea77c..0a8e282949 100644 --- a/src/shared/generator.c +++ b/src/shared/generator.c @@ -21,21 +21,23 @@ #include <unistd.h> -#include "util.h" -#include "special.h" -#include "mkdir.h" -#include "unit-name.h" +#include "dropin.h" +#include "escape.h" +#include "fd-util.h" +#include "fileio.h" +#include "fstab-util.h" #include "generator.h" +#include "mkdir.h" #include "path-util.h" -#include "fstab-util.h" -#include "fileio.h" -#include "dropin.h" +#include "special.h" +#include "string-util.h" +#include "unit-name.h" +#include "util.h" static int write_fsck_sysroot_service(const char *dir, const char *what) { - const char *unit; - _cleanup_free_ char *device = NULL; - _cleanup_free_ char *escaped; + _cleanup_free_ char *device = NULL, *escaped = NULL; _cleanup_fclose_ FILE *f = NULL; + const char *unit; int r; escaped = cescape(what); @@ -101,16 +103,17 @@ int generator_write_fsck_deps( if (!isempty(fstype) && !streq(fstype, "auto")) { r = fsck_exists(fstype); - if (r == -ENOENT) { + if (r < 0) + log_warning_errno(r, "Checking was requested for %s, but couldn't detect if fsck.%s may be used, proceeding: %m", what, fstype); + else if (r == 0) { /* treat missing check as essentially OK */ - log_debug_errno(r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype); + log_debug("Checking was requested for %s, but fsck.%s does not exist.", what, fstype); return 0; - } else if (r < 0) - return log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype); + } } if (path_equal(where, "/")) { - char *lnk; + const char *lnk; lnk = strjoina(dir, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service"); diff --git a/src/shared/import-util.c b/src/shared/import-util.c index 56388d5dd6..c4c66c847d 100644 --- a/src/shared/import-util.c +++ b/src/shared/import-util.c @@ -20,6 +20,7 @@ ***/ #include "btrfs-util.h" +#include "string-util.h" #include "util.h" #include "import-util.h" diff --git a/src/shared/install.c b/src/shared/install.c index 238433c808..9b72f76662 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -21,23 +21,25 @@ #include <errno.h> #include <fcntl.h> -#include <unistd.h> -#include <string.h> #include <fnmatch.h> +#include <string.h> +#include <unistd.h> -#include "util.h" -#include "mkdir.h" +#include "conf-files.h" +#include "conf-parser.h" #include "hashmap.h" -#include "set.h" -#include "path-util.h" +#include "install-printf.h" +#include "mkdir.h" #include "path-lookup.h" +#include "path-util.h" +#include "set.h" +#include "special.h" +#include "string-util.h" #include "strv.h" #include "unit-name.h" +#include "util.h" #include "install.h" -#include "conf-parser.h" -#include "conf-files.h" -#include "install-printf.h" -#include "special.h" +#include "fd-util.h" typedef struct { OrderedHashmap *will_install; diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index dbc07aa7ad..6f5b83d08d 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -19,25 +19,26 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <time.h> #include <errno.h> -#include <sys/socket.h> -#include <string.h> #include <fcntl.h> +#include <string.h> +#include <sys/socket.h> +#include <time.h> -#include "logs-show.h" -#include "log.h" -#include "util.h" -#include "utf8.h" +#include "fd-util.h" +#include "formats-util.h" #include "hashmap.h" +#include "hostname-util.h" #include "journal-internal.h" -#include "formats-util.h" +#include "log.h" +#include "logs-show.h" #include "process-util.h" +#include "string-util.h" #include "terminal-util.h" -#include "hostname-util.h" +#include "utf8.h" +#include "util.h" -/* up to three lines (each up to 100 characters), - or 300 characters, whichever is less */ +/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ #define PRINT_LINE_THRESHOLD 3 #define PRINT_CHAR_THRESHOLD 300 diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c index 8ed3ad7f44..415d939fc6 100644 --- a/src/shared/machine-image.c +++ b/src/shared/machine-image.c @@ -25,14 +25,15 @@ #include "btrfs-util.h" #include "copy.h" +#include "fd-util.h" +#include "machine-image.h" #include "mkdir.h" #include "path-util.h" #include "rm-rf.h" +#include "string-util.h" #include "strv.h" #include "utf8.h" -#include "machine-image.h" - static const char image_search_path[] = "/var/lib/machines\0" "/var/lib/container\0" /* legacy */ diff --git a/src/shared/machine-pool.c b/src/shared/machine-pool.c index 1da7d0815f..a2cb5fc5a0 100644 --- a/src/shared/machine-pool.c +++ b/src/shared/machine-pool.c @@ -19,19 +19,21 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <sys/mount.h> #include <sys/prctl.h> -#include <sys/vfs.h> #include <sys/statvfs.h> -#include <sys/mount.h> +#include <sys/vfs.h> -#include "util.h" -#include "process-util.h" +#include "btrfs-util.h" +#include "fd-util.h" #include "lockfile-util.h" +#include "machine-pool.h" #include "mkdir.h" -#include "btrfs-util.h" #include "path-util.h" +#include "process-util.h" #include "signal-util.h" -#include "machine-pool.h" +#include "string-util.h" +#include "util.h" #define VAR_LIB_MACHINES_SIZE_START (1024UL*1024UL*500UL) #define VAR_LIB_MACHINES_FREE_MIN (1024UL*1024UL*750UL) diff --git a/src/shared/pager.c b/src/shared/pager.c index d8f0fb404d..7029d6b2e2 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -21,17 +21,19 @@ #include <fcntl.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> #include <sys/prctl.h> +#include <unistd.h> +#include "copy.h" +#include "fd-util.h" +#include "macro.h" #include "pager.h" -#include "util.h" #include "process-util.h" -#include "macro.h" -#include "terminal-util.h" #include "signal-util.h" -#include "copy.h" +#include "string-util.h" +#include "terminal-util.h" +#include "util.h" static pid_t pager_pid = 0; diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index 34eec959ef..1e63c72047 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -27,8 +27,9 @@ #include "util.h" #include "strv.h" #include "path-util.h" -#include "path-lookup.h" #include "install.h" +#include "string-util.h" +#include "path-lookup.h" int user_config_home(char **config_home) { const char *e; @@ -210,7 +211,7 @@ static char** user_dirs( if (strv_extend(&res, generator_late) < 0) return NULL; - if (!path_strv_make_absolute_cwd(res)) + if (path_strv_make_absolute_cwd(res) < 0) return NULL; tmp = res; @@ -244,6 +245,7 @@ int lookup_paths_init( const char *e; bool append = false; /* Add items from SYSTEMD_UNIT_PATH before normal directories */ + int r; assert(p); @@ -259,9 +261,9 @@ int lookup_paths_init( /* FIXME: empty components in other places should be * rejected. */ - p->unit_path = path_split_and_make_absolute(e); - if (!p->unit_path) - return -ENOMEM; + r = path_split_and_make_absolute(e, &p->unit_path); + if (r < 0) + return r; } else p->unit_path = NULL; @@ -269,7 +271,6 @@ int lookup_paths_init( /* Let's figure something out. */ _cleanup_strv_free_ char **unit_path; - int r; /* For the user units we include share/ in the search * path in order to comply with the XDG basedir spec. @@ -342,9 +343,9 @@ int lookup_paths_init( e = getenv("SYSTEMD_SYSVINIT_PATH"); if (e) { - p->sysvinit_path = path_split_and_make_absolute(e); - if (!p->sysvinit_path) - return -ENOMEM; + r = path_split_and_make_absolute(e, &p->sysvinit_path); + if (r < 0) + return r; } else p->sysvinit_path = NULL; @@ -360,9 +361,9 @@ int lookup_paths_init( e = getenv("SYSTEMD_SYSVRCND_PATH"); if (e) { - p->sysvrcnd_path = path_split_and_make_absolute(e); - if (!p->sysvrcnd_path) - return -ENOMEM; + r = path_split_and_make_absolute(e, &p->sysvrcnd_path); + if (r < 0) + return r; } else p->sysvrcnd_path = NULL; @@ -417,9 +418,8 @@ void lookup_paths_free(LookupPaths *p) { p->unit_path = strv_free(p->unit_path); #ifdef HAVE_SYSV_COMPAT - strv_free(p->sysvinit_path); - strv_free(p->sysvrcnd_path); - p->sysvinit_path = p->sysvrcnd_path = NULL; + p->sysvinit_path = strv_free(p->sysvinit_path); + p->sysvrcnd_path = strv_free(p->sysvrcnd_path); #endif } diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 7749f20540..e5e0f37adf 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -24,8 +24,9 @@ #include <limits.h> #include <termios.h> -#include "util.h" +#include "fd-util.h" #include "ptyfwd.h" +#include "util.h" struct PTYForward { sd_event *event; diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index d73a74912e..c518cf83ec 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -21,6 +21,7 @@ #include <seccomp.h> +#include "string-util.h" #include "util.h" #include "seccomp-util.h" diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 3dedbd1f62..b5cb9508bf 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -22,9 +22,11 @@ #include <stdio.h> #include "conf-parser.h" -#include "sleep-config.h" +#include "fd-util.h" #include "fileio.h" #include "log.h" +#include "sleep-config.h" +#include "string-util.h" #include "strv.h" #include "util.h" diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c index 4db249e1ca..472cdecf20 100644 --- a/src/shared/spawn-polkit-agent.c +++ b/src/shared/spawn-polkit-agent.c @@ -29,6 +29,7 @@ #include "util.h" #include "process-util.h" #include "spawn-polkit-agent.h" +#include "fd-util.h" #ifdef ENABLE_POLKIT static pid_t agent_pid = 0; diff --git a/src/shared/specifier.c b/src/shared/specifier.c index 85bd477f2d..610aec0df5 100644 --- a/src/shared/specifier.c +++ b/src/shared/specifier.c @@ -22,9 +22,10 @@ #include <string.h> #include <sys/utsname.h> +#include "hostname-util.h" #include "macro.h" +#include "string-util.h" #include "util.h" -#include "hostname-util.h" #include "specifier.h" /* diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c index b12189cd10..60d7043fda 100644 --- a/src/shared/switch-root.c +++ b/src/shared/switch-root.c @@ -19,21 +19,23 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <sys/stat.h> -#include <stdbool.h> #include <errno.h> +#include <fcntl.h> +#include <stdbool.h> #include <string.h> #include <sys/mount.h> +#include <sys/stat.h> #include <unistd.h> -#include <fcntl.h> -#include "util.h" -#include "path-util.h" -#include "mkdir.h" -#include "rm-rf.h" #include "base-filesystem.h" +#include "fd-util.h" #include "missing.h" +#include "mkdir.h" +#include "path-util.h" +#include "rm-rf.h" +#include "string-util.h" #include "switch-root.h" +#include "util.h" int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) { diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c index b2cab948ef..21cb82ea1c 100644 --- a/src/shared/sysctl-util.c +++ b/src/shared/sysctl-util.c @@ -29,6 +29,7 @@ #include "fileio.h" #include "log.h" +#include "string-util.h" #include "util.h" #include "sysctl-util.h" diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c index 63f1e4ca6f..93e6313360 100644 --- a/src/shared/utmp-wtmp.c +++ b/src/shared/utmp-wtmp.c @@ -19,18 +19,20 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -#include <utmpx.h> #include <errno.h> +#include <fcntl.h> +#include <poll.h> #include <string.h> #include <sys/utsname.h> -#include <fcntl.h> #include <unistd.h> -#include <poll.h> +#include <utmpx.h> +#include "fd-util.h" +#include "hostname-util.h" #include "macro.h" #include "path-util.h" +#include "string-util.h" #include "terminal-util.h" -#include "hostname-util.h" #include "utmp-wtmp.h" int utmp_get_runlevel(int *runlevel, int *previous) { diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 9d39beb340..d58f9873d5 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -27,6 +27,7 @@ #include "watchdog.h" #include "log.h" +#include "fd-util.h" static int watchdog_fd = -1; static usec_t watchdog_timeout = USEC_INFINITY; |