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