]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
6482f626 RC |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2015 Ronny Chevalier | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
23 | #include <inttypes.h> | |
24 | ||
25 | #if SIZEOF_PID_T == 4 | |
26 | # define PID_PRI PRIi32 | |
27 | #elif SIZEOF_PID_T == 2 | |
28 | # define PID_PRI PRIi16 | |
29 | #else | |
30 | # error Unknown pid_t size | |
31 | #endif | |
32 | #define PID_FMT "%" PID_PRI | |
33 | ||
34 | #if SIZEOF_UID_T == 4 | |
35 | # define UID_FMT "%" PRIu32 | |
36 | #elif SIZEOF_UID_T == 2 | |
37 | # define UID_FMT "%" PRIu16 | |
38 | #else | |
39 | # error Unknown uid_t size | |
40 | #endif | |
41 | ||
42 | #if SIZEOF_GID_T == 4 | |
43 | # define GID_FMT "%" PRIu32 | |
44 | #elif SIZEOF_GID_T == 2 | |
45 | # define GID_FMT "%" PRIu16 | |
46 | #else | |
47 | # error Unknown gid_t size | |
48 | #endif | |
49 | ||
50 | #if SIZEOF_TIME_T == 8 | |
51 | # define PRI_TIME PRIi64 | |
52 | #elif SIZEOF_TIME_T == 4 | |
6307c39b | 53 | # define PRI_TIME "li" |
6482f626 RC |
54 | #else |
55 | # error Unknown time_t size | |
56 | #endif | |
57 | ||
3bd7ef83 MS |
58 | #if defined __x86_64__ && defined __ILP32__ |
59 | # define PRI_TIMEX PRIi64 | |
60 | #else | |
61 | # define PRI_TIMEX "li" | |
62 | #endif | |
63 | ||
6482f626 RC |
64 | #if SIZEOF_RLIM_T == 8 |
65 | # define RLIM_FMT "%" PRIu64 | |
66 | #elif SIZEOF_RLIM_T == 4 | |
67 | # define RLIM_FMT "%" PRIu32 | |
68 | #else | |
69 | # error Unknown rlim_t size | |
70 | #endif | |
7bce046b LP |
71 | |
72 | #if SIZEOF_DEV_T == 8 | |
73 | # define DEV_FMT "%" PRIu64 | |
74 | #elif SIZEOF_DEV_T == 4 | |
75 | # define DEV_FMT "%" PRIu32 | |
76 | #else | |
77 | # error Unknown dev_t size | |
78 | #endif | |
79 | ||
80 | #if SIZEOF_INO_T == 8 | |
81 | # define INO_FMT "%" PRIu64 | |
82 | #elif SIZEOF_INO_T == 4 | |
83 | # define INO_FMT "%" PRIu32 | |
84 | #else | |
85 | # error Unknown ino_t size | |
86 | #endif |