summaryrefslogtreecommitdiff
path: root/src/basic/format-util.h
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-01-30 23:25:12 +0900
committerLennart Poettering <lennart@poettering.net>2020-02-02 17:13:08 +0100
commit60d0a5098b2b58c105d86e4eacad691a3bef8ffd (patch)
tree5fccea5838a583934de1cfdfce20c5e29aa9f7ec /src/basic/format-util.h
parentc757517d98ade27b9938635afb52e5621da9f1cb (diff)
downloadsystemd-60d0a5098b2b58c105d86e4eacad691a3bef8ffd.tar.gz
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.
Diffstat (limited to 'src/basic/format-util.h')
-rw-r--r--src/basic/format-util.h29
1 files changed, 8 insertions, 21 deletions
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 <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