summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/fs-util.c1
-rw-r--r--src/basic/macro.h10
-rw-r--r--src/basic/mkdir.c1
-rw-r--r--src/basic/socket-util.c1
-rw-r--r--src/basic/user-util.h11
-rw-r--r--src/bus-proxyd/proxy.c1
-rw-r--r--src/core/dbus-unit.c1
-rw-r--r--src/core/dbus.c1
-rw-r--r--src/core/mount-setup.c1
-rw-r--r--src/core/namespace.c1
-rw-r--r--src/hostname/hostnamed.c1
-rw-r--r--src/import/importd.c1
-rw-r--r--src/libsystemd/sd-bus/bus-control.c3
-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-device/device-private.c1
-rw-r--r--src/locale/localed.c1
-rw-r--r--src/login/logind-seat-dbus.c9
-rw-r--r--src/login/logind-user.c1
-rw-r--r--src/machine/image-dbus.c5
-rw-r--r--src/machine/machine-dbus.c1
-rw-r--r--src/nspawn/nspawn-mount.c1
-rw-r--r--src/shared/base-filesystem.c1
-rw-r--r--src/shared/bus-util.c3
-rw-r--r--src/shared/dev-setup.c5
-rw-r--r--src/shared/switch-root.c1
-rw-r--r--src/test/test-cgroup-util.c1
-rw-r--r--src/test/test-conf-files.c1
-rw-r--r--src/test/test-uid-range.c3
-rw-r--r--src/timedate/timedated.c1
-rw-r--r--src/udev/udevd.c1
31 files changed, 51 insertions, 21 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index bd775b7b6f..edb007f98c 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -27,6 +27,7 @@
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
int unlink_noerrno(const char *path) {
diff --git a/src/basic/macro.h b/src/basic/macro.h
index f55d65e2f1..eeb57ecb8e 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -295,14 +295,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
#define PTR_TO_SIZE(p) ((size_t) ((uintptr_t) (p)))
#define SIZE_TO_PTR(u) ((void *) ((uintptr_t) (u)))
-/* The following macros add 1 when converting things, since UID 0 is a
- * valid UID, while the pointer NULL is special */
-#define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1))
-#define UID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
-
-#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
-#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
-
#define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p))
#define PID_TO_PTR(p) ((void*) ((uintptr_t) p))
@@ -466,8 +458,6 @@ do { \
#endif
#endif
-#define UID_INVALID ((uid_t) -1)
-#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
index 9410b33503..0214c4627e 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -26,6 +26,7 @@
#include "mkdir.h"
#include "path-util.h"
#include "stat-util.h"
+#include "user-util.h"
#include "util.h"
int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir) {
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 71a52a840a..ef5b764e60 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -40,6 +40,7 @@
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "user-util.h"
#include "util.h"
int socket_address_parse(SocketAddress *a, const char *s) {
diff --git a/src/basic/user-util.h b/src/basic/user-util.h
index 4496f58ba3..11ff6674cf 100644
--- a/src/basic/user-util.h
+++ b/src/basic/user-util.h
@@ -54,3 +54,14 @@ int get_shell(char **_ret);
int reset_uid_gid(void);
int take_etc_passwd_lock(const char *root);
+
+#define UID_INVALID ((uid_t) -1)
+#define GID_INVALID ((gid_t) -1)
+
+/* The following macros add 1 when converting things, since UID 0 is a
+ * valid UID, while the pointer NULL is special */
+#define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1))
+#define UID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
+
+#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
+#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index ea2a01fdae..6c251b5244 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -44,6 +44,7 @@
#include "set.h"
#include "strv.h"
#include "synthesize.h"
+#include "user-util.h"
#include "util.h"
static int proxy_create_destination(Proxy *p, const char *destination, const char *local_sec, bool negotiate_fds) {
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 62086a7fde..10cd80389b 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -31,6 +31,7 @@
#include "special.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode);
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 37410a9870..bbab0aeddb 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -45,6 +45,7 @@
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
+#include "user-util.h"
#define CONNECTIONS_MAX 4096
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 7486ec3985..1ab4ee5b1a 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -40,6 +40,7 @@
#include "set.h"
#include "smack-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 65cf140123..6c49ff32fe 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -42,6 +42,7 @@
#include "string-util.h"
#include "strv.h"
#include "umask-util.h"
+#include "user-util.h"
#include "util.h"
typedef enum MountMode {
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index a42124288d..5c63a025a3 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -34,6 +34,7 @@
#include "path-util.h"
#include "selinux-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
#include "virt.h"
diff --git a/src/import/importd.c b/src/import/importd.c
index 601652231b..65e2354640 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -40,6 +40,7 @@
#include "string-table.h"
#include "strv.h"
#include "syslog-util.h"
+#include "user-util.h"
#include "util.h"
#include "web-util.h"
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index dc4ac88712..7c9dcf5283 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -29,13 +29,14 @@
#include "sd-bus.h"
#include "bus-bloom.h"
+#include "bus-control.h"
#include "bus-internal.h"
#include "bus-message.h"
#include "bus-util.h"
#include "capability-util.h"
#include "string-util.h"
#include "strv.h"
-#include "bus-control.h"
+#include "user-util.h"
_public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
int r;
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index d291da8934..7c99904c64 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -38,6 +38,7 @@
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
+#include "user-util.h"
#include "util.h"
enum {
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index a455259007..a32b0ef221 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -48,6 +48,7 @@
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
#define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index daed321bd8..69288b833e 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -41,6 +41,7 @@
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
+#include "user-util.h"
#include "util.h"
int device_add_property(sd_device *device, const char *key, const char *value) {
diff --git a/src/locale/localed.c b/src/locale/localed.c
index 343399a62d..1f25d232d2 100644
--- a/src/locale/localed.c
+++ b/src/locale/localed.c
@@ -44,6 +44,7 @@
#include "path-util.h"
#include "selinux-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
enum {
diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
index 346e1d2cec..66626b5871 100644
--- a/src/login/logind-seat-dbus.c
+++ b/src/login/logind-seat-dbus.c
@@ -22,13 +22,14 @@
#include <errno.h>
#include <string.h>
-#include "util.h"
-#include "bus-util.h"
-#include "strv.h"
#include "bus-common-errors.h"
#include "bus-label.h"
-#include "logind.h"
+#include "bus-util.h"
#include "logind-seat.h"
+#include "logind.h"
+#include "strv.h"
+#include "user-util.h"
+#include "util.h"
static int property_get_active_session(
sd_bus *bus,
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 9692a86709..1cf9be7441 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -45,6 +45,7 @@
#include "special.h"
#include "string-table.h"
#include "unit-name.h"
+#include "user-util.h"
#include "util.h"
User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c
index 2453a9ff04..a287b9697a 100644
--- a/src/machine/image-dbus.c
+++ b/src/machine/image-dbus.c
@@ -20,10 +20,11 @@
***/
#include "bus-label.h"
-#include "strv.h"
#include "bus-util.h"
-#include "machine-image.h"
#include "image-dbus.h"
+#include "machine-image.h"
+#include "strv.h"
+#include "user-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType);
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 0003b84dd5..1132d75823 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -48,6 +48,7 @@
#include "process-util.h"
#include "strv.h"
#include "terminal-util.h"
+#include "user-util.h"
static int property_get_id(
sd_bus *bus,
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index 865407ec10..81003dff89 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -36,6 +36,7 @@
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
CustomMount* custom_mount_add(CustomMount **l, unsigned *n, CustomMountType t) {
diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
index 9ccf26526f..ff91c6bdc5 100644
--- a/src/shared/base-filesystem.c
+++ b/src/shared/base-filesystem.c
@@ -30,6 +30,7 @@
#include "macro.h"
#include "string-util.h"
#include "umask-util.h"
+#include "user-util.h"
#include "util.h"
typedef struct BaseFilesystem {
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index c854ff4344..b253eb95ee 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -39,6 +39,7 @@
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
+#include "proc-cmdline.h"
#include "rlimit-util.h"
#include "set.h"
#include "signal-util.h"
@@ -46,9 +47,9 @@
#include "strv.h"
#include "syslog-util.h"
#include "unit-name.h"
+#include "user-util.h"
#include "utf8.h"
#include "util.h"
-#include "proc-cmdline.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/dev-setup.c b/src/shared/dev-setup.c
index 25ad918b85..0d321af967 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -23,10 +23,11 @@
#include <stdlib.h>
#include <unistd.h>
-#include "util.h"
+#include "dev-setup.h"
#include "label.h"
#include "path-util.h"
-#include "dev-setup.h"
+#include "user-util.h"
+#include "util.h"
int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
static const char symlinks[] =
diff --git a/src/shared/switch-root.c b/src/shared/switch-root.c
index 60d7043fda..fc885f6cb8 100644
--- a/src/shared/switch-root.c
+++ b/src/shared/switch-root.c
@@ -35,6 +35,7 @@
#include "rm-rf.h"
#include "string-util.h"
#include "switch-root.h"
+#include "user-util.h"
#include "util.h"
int switch_root(const char *new_root, const char *oldroot, bool detach_oldroot, unsigned long mountflags) {
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 104f6327be..e4f6d5168d 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -27,6 +27,7 @@
#include "process-util.h"
#include "string-util.h"
#include "test-helper.h"
+#include "user-util.h"
#include "util.h"
static void check_p_d_u(const char *path, int code, const char *result) {
diff --git a/src/test/test-conf-files.c b/src/test/test-conf-files.c
index d00517e929..f4b23355fc 100644
--- a/src/test/test-conf-files.c
+++ b/src/test/test-conf-files.c
@@ -28,6 +28,7 @@
#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
static void setup_test_dir(char *tmp_dir, const char *files, ...) {
diff --git a/src/test/test-uid-range.c b/src/test/test-uid-range.c
index bc5baa2fcb..9f69d71203 100644
--- a/src/test/test-uid-range.c
+++ b/src/test/test-uid-range.c
@@ -21,8 +21,9 @@
#include <stddef.h>
-#include "util.h"
#include "uid-range.h"
+#include "user-util.h"
+#include "util.h"
int main(int argc, char *argv[]) {
_cleanup_free_ UidRange *p = NULL;
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index e97dc97ae1..507a83b2a1 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -38,6 +38,7 @@
#include "path-util.h"
#include "selinux-util.h"
#include "strv.h"
+#include "user-util.h"
#include "util.h"
#define NULL_ADJTIME_UTC "0.0 0 0\n0\nUTC\n"
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2dcdef9918..64346a7822 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -63,6 +63,7 @@
#include "terminal-util.h"
#include "udev-util.h"
#include "udev.h"
+#include "user-util.h"
static bool arg_debug = false;
static int arg_daemonize = false;