diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-27 00:42:07 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-27 13:25:57 +0100 |
commit | ee104e11e303499a637c5cd8157bd12ad5cc116d (patch) | |
tree | 9b5e194fd5e21d476cc60ae5a6dd125608278953 /src/basic/user-util.h | |
parent | 49cf4170d0b586551527ebf4297f8a3fe6bd71a3 (diff) |
user-util: move UID/GID related macros from macro.h to user-util.h
Diffstat (limited to 'src/basic/user-util.h')
-rw-r--r-- | src/basic/user-util.h | 11 |
1 files changed, 11 insertions, 0 deletions
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)) |