summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-27 00:42:07 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-27 13:25:57 +0100
commitee104e11e303499a637c5cd8157bd12ad5cc116d (patch)
tree9b5e194fd5e21d476cc60ae5a6dd125608278953 /src/basic
parent49cf4170d0b586551527ebf4297f8a3fe6bd71a3 (diff)
user-util: move UID/GID related macros from macro.h to user-util.h
Diffstat (limited to 'src/basic')
-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
5 files changed, 14 insertions, 10 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))