From 60d0a5098b2b58c105d86e4eacad691a3bef8ffd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 30 Jan 2020 23:25:12 +0900 Subject: 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. --- src/basic/format-util.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'src/basic/format-util.h') diff --git a/src/basic/format-util.h b/src/basic/format-util.h index 59622508a3..29fbc947b3 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h @@ -5,30 +5,17 @@ #include #include -#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 -- cgit v1.2.1