1
2
3
4
5
6
7
8
9 #ifndef PCMK__PORTABILITY__H
10 # define PCMK__PORTABILITY__H
11
12
13
14
15
16
17
18
19 # undef _GNU_SOURCE
20 # define _GNU_SOURCE
21
22
23 # ifdef HAVE_CONFIG_H
24 # ifndef PCMK__CONFIG_H
25 # define PCMK__CONFIG_H
26 # include <config.h>
27 # endif
28 # endif
29
30
31
32 # ifndef HAVE_DAEMON
33
34 int daemon(int nochdir, int noclose);
35 # endif
36
37 # ifndef HAVE_SETENV
38
39 int setenv(const char *name, const char *value, int why);
40 # endif
41
42 # ifndef HAVE_STRERROR
43
44 char *strerror(int errnum);
45 # endif
46
47 # ifndef HAVE_STRCHRNUL
48
49 char *strchrnul(const char *s, int c_in);
50 # endif
51
52 # ifndef HAVE_ALPHASORT
53 # include <dirent.h>
54 int alphasort(const void *dirent1, const void *dirent2);
55 # endif
56
57 # ifndef HAVE_STRNLEN
58 size_t strnlen(const char *s, size_t maxlen);
59 # else
60 # define USE_GNU
61 # endif
62
63 # ifndef HAVE_STRNDUP
64 char *strndup(const char *str, size_t len);
65 # else
66 # define USE_GNU
67 # endif
68
69 # if SUPPORT_DBUS
70 # ifndef HAVE_DBUSBASICVALUE
71 # include <stdint.h>
72 # include <dbus/dbus.h>
73
74
75
76
77 typedef struct
78 {
79 uint32_t first32;
80 uint32_t second32;
81 } DBus8ByteStruct;
82
83
84
85
86
87
88
89
90
91
92
93 typedef union
94 {
95 unsigned char bytes[8];
96 int16_t i16;
97 uint16_t u16;
98 int32_t i32;
99 uint32_t u32;
100 uint32_t bool_val;
101 # ifdef DBUS_HAVE_INT64
102 int64_t i64;
103 uint64_t u64;
104 # endif
105 DBus8ByteStruct eight;
106 double dbl;
107 unsigned char byt;
108 char *str;
109 int fd;
110 } DBusBasicValue;
111 # endif
112 # endif
113
114
115
116 # include <errno.h>
117
118 # ifndef ENOTUNIQ
119 # define ENOTUNIQ 190
120 # endif
121
122 # ifndef ECOMM
123 # define ECOMM 191
124 # endif
125
126 # ifndef ELIBACC
127 # define ELIBACC 192
128 # endif
129
130 # ifndef EREMOTEIO
131 # define EREMOTEIO 193
132 # endif
133
134 # ifndef EUNATCH
135 # define EUNATCH 194
136 # endif
137
138 # ifndef ENOKEY
139 # define ENOKEY 195
140 # endif
141
142 # ifndef ENODATA
143 # define ENODATA 196
144 # endif
145
146 # ifndef ETIME
147 # define ETIME 197
148 # endif
149
150 # ifndef ENOSR
151 # define ENOSR 198
152 # endif
153
154 # ifndef ENOSTR
155 # define ENOSTR 199
156 # endif
157
158 # ifndef EKEYREJECTED
159 # define EKEYREJECTED 200
160 # endif
161
162 #endif