util: uid_t, gid_t, and pid_t must be 32bit

We already have assert_cc(sizeof(uid_t) == sizeof(uint32_t)) or friends
at various places.
This commit is contained in:
Yu Watanabe
2020-02-02 17:13:08 +01:00
committed by Lennart Poettering
parent c757517d98
commit 60d0a5098b
5 changed files with 9 additions and 34 deletions
+8 -21
View File
@@ -5,30 +5,17 @@
#include <net/if.h>
#include <stdbool.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
#include "macro.h"
assert_cc(sizeof(pid_t) == sizeof(int32_t));
#define PID_PRI PRIi32
#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
assert_cc(sizeof(uid_t) == sizeof(uint32_t));
#define UID_FMT "%" PRIu32
#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
assert_cc(sizeof(gid_t) == sizeof(uint32_t));
#define GID_FMT "%" PRIu32
#if SIZEOF_TIME_T == 8
# define PRI_TIME PRIi64