user-util: move UID/GID related macros from macro.h to user-util.h

This commit is contained in:
Lennart Poettering
2015-10-27 13:25:57 +01:00
parent 49cf4170d0
commit ee104e11e3
31 changed files with 51 additions and 21 deletions
+1
View File
@@ -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) {
-10
View File
@@ -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) \
+1
View File
@@ -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) {
+1
View File
@@ -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) {
+11
View File
@@ -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))