nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* source: compat.h */ |
2 | /* Copyright Gerhard Rieger */ |
||
3 | /* Published under the GNU General Public License V.2, see file COPYING */ |
||
4 | |||
5 | #ifndef __compat_h_included |
||
6 | #define __compat_h_included 1 |
||
7 | |||
8 | #if !HAVE_DECL_ENVIRON && HAVE_VAR_ENVIRON |
||
9 | extern char **environ; |
||
10 | #endif |
||
11 | |||
12 | /*****************************************************************************/ |
||
13 | /* I dont like this system dependent part, but it would be quite a challenge |
||
14 | for configure */ |
||
15 | |||
16 | /* define if the following does not work: |
||
17 | socket() |
||
18 | connect() -> Connection refused |
||
19 | connect() -> ok |
||
20 | instead, it needs close() and socket() between the two connect() attmpts: */ |
||
21 | #if __FreeBSD__ || __APPLE__ || _AIX || __hpux__ || __osf__ |
||
22 | # undef SOCKET_CAN_RECOVER |
||
23 | #else |
||
24 | # define SOCKET_CAN_RECOVER 1 |
||
25 | #endif |
||
26 | |||
27 | /* define if stat() says that pipes are sockets */ |
||
28 | #if __APPLE__ |
||
29 | # define PIPE_STATES_SOCKET 1 |
||
30 | #else |
||
31 | # undef PIPE_STATES_SOCKET |
||
32 | #endif |
||
33 | |||
34 | /*****************************************************************************/ |
||
35 | |||
36 | /* substitute some features that might be missing on some platforms */ |
||
37 | |||
38 | #if !HAVE_TYPE_SIG_ATOMIC_T |
||
39 | typedef int sig_atomic_t; |
||
40 | #endif |
||
41 | |||
42 | #ifndef SHUT_RD |
||
43 | # define SHUT_RD 0 |
||
44 | #endif |
||
45 | #ifndef SHUT_WR |
||
46 | # define SHUT_WR 1 |
||
47 | #endif |
||
48 | #ifndef SHUT_RDWR |
||
49 | # define SHUT_RDWR 2 |
||
50 | #endif |
||
51 | |||
52 | #ifndef MIN |
||
53 | # define MIN(x,y) ((x)<=(y)?(x):(y)) |
||
54 | #endif |
||
55 | |||
56 | #ifndef MAX |
||
57 | # define MAX(x,y) ((x)>=(y)?(x):(y)) |
||
58 | #endif |
||
59 | |||
60 | /* O_ASYNC: Linux 2.2.10 */ |
||
61 | #if !defined(O_ASYNC) && defined(FASYNC) |
||
62 | # define O_ASYNC FASYNC |
||
63 | #endif |
||
64 | |||
65 | /* NGROUPS not defined on Solaris */ |
||
66 | #if !defined(NGROUPS) && defined(NGROUPS_MAX) |
||
67 | # define NGROUPS NGROUPS_MAX |
||
68 | #endif |
||
69 | |||
70 | /* UNIX_PATH_MAX: AIX 4.3.3 */ |
||
71 | #ifndef UNIX_PATH_MAX |
||
72 | # define UNIX_PATH_MAX 104 /*! why 104? Linux: 108 ! */ |
||
73 | #endif |
||
74 | |||
75 | |||
76 | /* SOL_IP: AIX 4.3.3 */ |
||
77 | #ifndef SOL_IP |
||
78 | # define SOL_IP 0 |
||
79 | #endif |
||
80 | |||
81 | /* SOL_TCP: AIX 4.3.3 */ |
||
82 | #ifndef SOL_TCP |
||
83 | # ifdef IPPROTO_TCP |
||
84 | # define SOL_TCP IPPROTO_TCP |
||
85 | # endif |
||
86 | #endif |
||
87 | |||
88 | /* POSIX.1 doesn't seem to know sockets */ |
||
89 | #ifndef S_ISSOCK |
||
90 | # define S_ISSOCK(fmode) 0 |
||
91 | #endif |
||
92 | |||
93 | #if defined(IPPROTO_IPV6) && !defined(SOL_IPV6) |
||
94 | # define SOL_IPV6 IPPROTO_IPV6 |
||
95 | #endif |
||
96 | |||
97 | /* all unsigned */ |
||
98 | #if !defined(HAVE_BASIC_SIZE_T) || !HAVE_BASIC_SIZE_T |
||
99 | # undef HAVE_BASIC_SIZE_T |
||
100 | # define HAVE_BASIC_SIZE_T 6 |
||
101 | #endif |
||
102 | #if HAVE_BASIC_SIZE_T==2 |
||
103 | # define SIZET_MAX USHRT_MAX |
||
104 | # define SSIZET_MIN SHRT_MIN |
||
105 | # define SSIZET_MAX SHRT_MAX |
||
106 | # define F_Zd "%hd" |
||
107 | # define F_Zu "%hu" |
||
108 | #elif HAVE_BASIC_SIZE_T==4 |
||
109 | # define SIZET_MAX UINT_MAX |
||
110 | # define SSIZET_MIN INT_MIN |
||
111 | # define SSIZET_MAX INT_MAX |
||
112 | # define F_Zd "%""d" |
||
113 | # define F_Zu "%u" |
||
114 | #elif HAVE_BASIC_SIZE_T==6 |
||
115 | # define SIZET_MAX ULONG_MAX |
||
116 | # define SSIZET_MIN LONG_MIN |
||
117 | # define SSIZET_MAX LONG_MAX |
||
118 | # define F_Zd "%ld" |
||
119 | # define F_Zu "%lu" |
||
120 | #elif HAVE_BASIC_SIZE_T==8 |
||
121 | # define SIZET_MAX ULLONG_MAX |
||
122 | # define SSIZET_MIN LLONG_MIN |
||
123 | # define SSIZET_MAX LLONG_MAX |
||
124 | # define F_Zd "%Ld" |
||
125 | # define F_Zu "%Lu" |
||
126 | #else |
||
127 | # error "HAVE_BASIC_SIZE_T is out of range:" HAVE_BASIC_SIZE_T |
||
128 | #endif |
||
129 | #if HAVE_FORMAT_Z |
||
130 | # undef F_Zd |
||
131 | # undef F_Zu |
||
132 | # define F_Zd "%Zd" |
||
133 | # define F_Zu "%Zu" |
||
134 | #endif |
||
135 | |||
136 | |||
137 | /* mode_t is always unsigned; default: unsigned int */ |
||
138 | #if !defined(HAVE_BASIC_MODE_T) || !HAVE_BASIC_MODE_T |
||
139 | # undef HAVE_BASIC_MODE_T |
||
140 | # define HAVE_BASIC_MODE_T 4 |
||
141 | #endif |
||
142 | #ifndef F_mode |
||
143 | # if HAVE_BASIC_MODE_T==1 || HAVE_BASIC_MODE_T==2 |
||
144 | #define F_mode "0%03ho" |
||
145 | # elif HAVE_BASIC_MODE_T==3 || HAVE_BASIC_MODE_T==4 |
||
146 | #define F_mode "0%03o" |
||
147 | # elif HAVE_BASIC_MODE_T==5 || HAVE_BASIC_MODE_T==6 |
||
148 | #define F_mode "0%03lo" |
||
149 | # else |
||
150 | #error "HAVE_BASIC_MODE_T is out of range:" HAVE_BASIC_MODE_T |
||
151 | # endif |
||
152 | #endif |
||
153 | |||
154 | |||
155 | /* default: unsigned int */ |
||
156 | #if !defined(HAVE_BASIC_PID_T) || !HAVE_BASIC_PID_T |
||
157 | # undef HAVE_BASIC_PID_T |
||
158 | # define HAVE_BASIC_PID_T 4 |
||
159 | #endif |
||
160 | #ifndef F_pid |
||
161 | # if HAVE_BASIC_PID_T==1 |
||
162 | #define F_pid "%hd" |
||
163 | # elif HAVE_BASIC_PID_T==2 |
||
164 | #define F_pid "%hu" |
||
165 | # elif HAVE_BASIC_PID_T==3 |
||
166 | #define F_pid "%""d" |
||
167 | # elif HAVE_BASIC_PID_T==4 |
||
168 | #define F_pid "%u" |
||
169 | # elif HAVE_BASIC_PID_T==5 |
||
170 | #define F_pid "%ld" |
||
171 | # elif HAVE_BASIC_PID_T==6 |
||
172 | #define F_pid "%lu" |
||
173 | # else |
||
174 | #error "HAVE_BASIC_PID_T is out of range:" HAVE_BASIC_PID_T |
||
175 | # endif |
||
176 | #endif |
||
177 | |||
178 | |||
179 | /* default: unsigned int */ |
||
180 | #if !defined(HAVE_BASIC_UID_T) || !HAVE_BASIC_UID_T |
||
181 | # undef HAVE_BASIC_UID_T |
||
182 | # define HAVE_BASIC_UID_T 4 |
||
183 | #endif |
||
184 | #ifndef F_uid |
||
185 | # if HAVE_BASIC_UID_T==1 |
||
186 | #define F_uid "%hd" |
||
187 | # elif HAVE_BASIC_UID_T==2 |
||
188 | #define F_uid "%hu" |
||
189 | # elif HAVE_BASIC_UID_T==3 |
||
190 | #define F_uid "%""d" |
||
191 | # elif HAVE_BASIC_UID_T==4 |
||
192 | #define F_uid "%u" |
||
193 | # elif HAVE_BASIC_UID_T==5 |
||
194 | #define F_uid "%ld" |
||
195 | # elif HAVE_BASIC_UID_T==6 |
||
196 | #define F_uid "%lu" |
||
197 | # else |
||
198 | #error "HAVE_BASIC_UID_T is out of range:" HAVE_BASIC_UID_T |
||
199 | # endif |
||
200 | #endif |
||
201 | |||
202 | |||
203 | /* default: unsigned int */ |
||
204 | #if !defined(HAVE_BASIC_GID_T) || !HAVE_BASIC_GID_T |
||
205 | # undef HAVE_BASIC_GID_T |
||
206 | # define HAVE_BASIC_GID_T 4 |
||
207 | #endif |
||
208 | #ifndef F_gid |
||
209 | # if HAVE_BASIC_GID_T==1 |
||
210 | #define F_gid "%hd" |
||
211 | # elif HAVE_BASIC_GID_T==2 |
||
212 | #define F_gid "%hu" |
||
213 | # elif HAVE_BASIC_GID_T==3 |
||
214 | #define F_gid "%""d" |
||
215 | # elif HAVE_BASIC_GID_T==4 |
||
216 | #define F_gid "%u" |
||
217 | # elif HAVE_BASIC_GID_T==5 |
||
218 | #define F_gid "%ld" |
||
219 | # elif HAVE_BASIC_GID_T==6 |
||
220 | #define F_gid "%lu" |
||
221 | # else |
||
222 | #error "HAVE_BASIC_GID_T is out of range:" HAVE_BASIC_GID_T |
||
223 | # endif |
||
224 | #endif |
||
225 | |||
226 | |||
227 | /* all signed; default: long */ |
||
228 | #if !defined(HAVE_BASIC_TIME_T) || !HAVE_BASIC_TIME_T |
||
229 | # undef HAVE_BASIC_TIME_T |
||
230 | # define HAVE_BASIC_TIME_T 5 |
||
231 | #endif |
||
232 | #ifndef F_time |
||
233 | # if HAVE_BASIC_TIME_T==1 |
||
234 | #define F_time "%hd" |
||
235 | # elif HAVE_BASIC_TIME_T==2 |
||
236 | #define F_time "%hu" |
||
237 | # elif HAVE_BASIC_TIME_T==3 |
||
238 | #define F_time "%""d" |
||
239 | # elif HAVE_BASIC_TIME_T==4 |
||
240 | #define F_time "%u" |
||
241 | # elif HAVE_BASIC_TIME_T==5 |
||
242 | #define F_time "%ld" |
||
243 | # elif HAVE_BASIC_TIME_T==6 |
||
244 | #define F_time "%lu" |
||
245 | # elif HAVE_BASIC_TIME_T==7 |
||
246 | #define F_time "%Ld" |
||
247 | # elif HAVE_BASIC_TIME_T==8 |
||
248 | #define F_time "%Lu" |
||
249 | # else |
||
250 | #error "HAVE_BASIC_TIME_T is out of range:" HAVE_BASIC_TIME_T |
||
251 | # endif |
||
252 | #endif |
||
253 | |||
254 | |||
255 | /* default: int */ |
||
256 | #if !defined(HAVE_BASIC_SOCKLEN_T) || !HAVE_BASIC_SOCKLEN_T |
||
257 | # undef HAVE_BASIC_SOCKLEN_T |
||
258 | # define HAVE_BASIC_SOCKLEN_T 3 |
||
259 | #endif |
||
260 | #ifndef F_socklen |
||
261 | # if HAVE_BASIC_SOCKLEN_T==1 |
||
262 | #define F_socklen "%hd" |
||
263 | # elif HAVE_BASIC_SOCKLEN_T==2 |
||
264 | #define F_socklen "%hu" |
||
265 | # elif HAVE_BASIC_SOCKLEN_T==3 |
||
266 | #define F_socklen "%""d" |
||
267 | # elif HAVE_BASIC_SOCKLEN_T==4 |
||
268 | #define F_socklen "%u" |
||
269 | # elif HAVE_BASIC_SOCKLEN_T==5 |
||
270 | #define F_socklen "%ld" |
||
271 | # elif HAVE_BASIC_SOCKLEN_T==6 |
||
272 | #define F_socklen "%lu" |
||
273 | # elif HAVE_BASIC_SOCKLEN_T==7 |
||
274 | #define F_socklen "%Ld" |
||
275 | # elif HAVE_BASIC_SOCKLEN_T==8 |
||
276 | #define F_socklen "%Lu" |
||
277 | # else |
||
278 | #error "HAVE_BASIC_SOCKLEN_T is out of range:" HAVE_BASIC_SOCKLEN_T |
||
279 | # endif |
||
280 | #endif |
||
281 | |||
282 | #if !defined(HAVE_BASIC_OFF_T) || !HAVE_BASIC_OFF_T |
||
283 | # undef HAVE_BASIC_OFF_T |
||
284 | # define HAVE_BASIC_OFF_T 5 /*long*/ |
||
285 | #endif |
||
286 | #ifndef F_off |
||
287 | # if HAVE_BASIC_OFF_T==3 |
||
288 | # define F_off "%""d" |
||
289 | # elif HAVE_BASIC_OFF_T==5 |
||
290 | # define F_off "%ld" |
||
291 | # elif HAVE_BASIC_OFF_T==7 |
||
292 | # define F_off "%Ld" |
||
293 | # else |
||
294 | #error "HAVE_BASIC_OFF_T is out of range:" HAVE_BASIC_OFF_T |
||
295 | # endif |
||
296 | #endif |
||
297 | |||
298 | /* default: long long */ |
||
299 | #if !defined(HAVE_BASIC_OFF64_T) || !HAVE_BASIC_OFF64_T |
||
300 | # undef HAVE_BASIC_OFF64_T |
||
301 | # define HAVE_BASIC_OFF64_T 7 |
||
302 | #endif |
||
303 | #ifndef F_off64 |
||
304 | # if HAVE_BASIC_OFF64_T==1 |
||
305 | #define F_off64 "%hd" |
||
306 | # elif HAVE_BASIC_OFF64_T==2 |
||
307 | #define F_off64 "%hu" |
||
308 | # elif HAVE_BASIC_OFF64_T==3 |
||
309 | #define F_off64 "%""d" |
||
310 | # elif HAVE_BASIC_OFF64_T==4 |
||
311 | #define F_off64 "%u" |
||
312 | # elif HAVE_BASIC_OFF64_T==5 |
||
313 | #define F_off64 "%ld" |
||
314 | # elif HAVE_BASIC_OFF64_T==6 |
||
315 | #define F_off64 "%lu" |
||
316 | # elif HAVE_BASIC_OFF64_T==7 |
||
317 | #define F_off64 "%Ld" |
||
318 | # elif HAVE_BASIC_OFF64_T==8 |
||
319 | #define F_off64 "%Lu" |
||
320 | # else |
||
321 | #error "HAVE_BASIC_OFF64_T is out of range:" HAVE_BASIC_OFF64_T |
||
322 | # endif |
||
323 | #endif |
||
324 | |||
325 | |||
326 | /* all unsigned; default: unsigned long */ |
||
327 | #if !defined(HAVE_BASIC_DEV_T) || !HAVE_BASIC_DEV_T |
||
328 | # undef HAVE_BASIC_DEV_T |
||
329 | # define HAVE_BASIC_DEV_T 6 |
||
330 | #endif |
||
331 | #ifndef F_dev |
||
332 | # if HAVE_BASIC_DEV_T==1 |
||
333 | #define F_dev "%hd" |
||
334 | # elif HAVE_BASIC_DEV_T==2 |
||
335 | #define F_dev "%hu" |
||
336 | # elif HAVE_BASIC_DEV_T==3 |
||
337 | #define F_dev "%""d" |
||
338 | # elif HAVE_BASIC_DEV_T==4 |
||
339 | #define F_dev "%u" |
||
340 | # elif HAVE_BASIC_DEV_T==5 |
||
341 | #define F_dev "%ld" |
||
342 | # elif HAVE_BASIC_DEV_T==6 |
||
343 | #define F_dev "%lu" |
||
344 | # elif HAVE_BASIC_DEV_T==7 |
||
345 | #define F_dev "%Ld" |
||
346 | # elif HAVE_BASIC_DEV_T==8 |
||
347 | #define F_dev "%Lu" |
||
348 | # else |
||
349 | #error "HAVE_BASIC_DEV_T is out of range:" HAVE_BASIC_DEV_T |
||
350 | # endif |
||
351 | #endif |
||
352 | |||
353 | /* all unsigned; default; unsigned long */ |
||
354 | #if !defined(HAVE_TYPEOF_ST_INO) || !HAVE_TYPEOF_ST_INO |
||
355 | # undef HAVE_TYPEOF_ST_INO |
||
356 | # define HAVE_TYPEOF_ST_INO 6 |
||
357 | #endif |
||
358 | #ifndef F_st_ino |
||
359 | # if HAVE_TYPEOF_ST_INO==1 |
||
360 | #define F_st_ino "%hd" |
||
361 | # elif HAVE_TYPEOF_ST_INO==2 |
||
362 | #define F_st_ino "%hu" |
||
363 | # elif HAVE_TYPEOF_ST_INO==3 |
||
364 | #define F_st_ino "%""d" |
||
365 | # elif HAVE_TYPEOF_ST_INO==4 |
||
366 | #define F_st_ino "%u" |
||
367 | # elif HAVE_TYPEOF_ST_INO==5 |
||
368 | #define F_st_ino "%ld" |
||
369 | # elif HAVE_TYPEOF_ST_INO==6 |
||
370 | #define F_st_ino "%lu" |
||
371 | # elif HAVE_TYPEOF_ST_INO==7 /* Cygwin 1.5 */ |
||
372 | #define F_st_ino "%Ld" |
||
373 | # elif HAVE_TYPEOF_ST_INO==8 |
||
374 | #define F_st_ino "%Lu" |
||
375 | # else |
||
376 | #error "HAVE_TYPEOF_ST_INO is out of range:" HAVE_TYPEOF_ST_INO |
||
377 | # endif |
||
378 | #endif |
||
379 | |||
380 | /* all unsigned; default; unsigned long long */ |
||
381 | #if !defined(HAVE_TYPEOF_ST64_INO) || !HAVE_TYPEOF_ST64_INO |
||
382 | # undef HAVE_TYPEOF_ST64_INO |
||
383 | # define HAVE_TYPEOF_ST64_INO 8 |
||
384 | #endif |
||
385 | #ifndef F_st64_ino |
||
386 | # if HAVE_TYPEOF_ST64_INO==1 |
||
387 | #define F_st64_ino "%hd" |
||
388 | # elif HAVE_TYPEOF_ST64_INO==2 |
||
389 | #define F_st64_ino "%hu" |
||
390 | # elif HAVE_TYPEOF_ST64_INO==3 |
||
391 | #define F_st64_ino "%""d" |
||
392 | # elif HAVE_TYPEOF_ST64_INO==4 |
||
393 | #define F_st64_ino "%u" |
||
394 | # elif HAVE_TYPEOF_ST64_INO==5 |
||
395 | #define F_st64_ino "%ld" |
||
396 | # elif HAVE_TYPEOF_ST64_INO==6 |
||
397 | #define F_st64_ino "%lu" |
||
398 | # elif HAVE_TYPEOF_ST64_INO==7 |
||
399 | #define F_st64_ino "%Ld" |
||
400 | # elif HAVE_TYPEOF_ST64_INO==8 |
||
401 | #define F_st64_ino "%Lu" |
||
402 | # else |
||
403 | #error "HAVE_TYPEOF_ST64_INO is out of range:" HAVE_TYPEOF_ST64_INO |
||
404 | # endif |
||
405 | #endif |
||
406 | |||
407 | /* default: unsigned short */ |
||
408 | #if !defined(HAVE_TYPEOF_ST_NLINK) || !HAVE_TYPEOF_ST_NLINK |
||
409 | # undef HAVE_TYPEOF_ST_NLINK |
||
410 | # define HAVE_TYPEOF_ST_NLINK 2 |
||
411 | #endif |
||
412 | #ifndef F_st_nlink |
||
413 | # if HAVE_TYPEOF_ST_NLINK==1 |
||
414 | #define F_st_nlink "%hd" |
||
415 | # elif HAVE_TYPEOF_ST_NLINK==2 |
||
416 | #define F_st_nlink "%hu" |
||
417 | # elif HAVE_TYPEOF_ST_NLINK==3 |
||
418 | #define F_st_nlink "%""d" |
||
419 | # elif HAVE_TYPEOF_ST_NLINK==4 |
||
420 | #define F_st_nlink "%u" |
||
421 | # elif HAVE_TYPEOF_ST_NLINK==5 |
||
422 | #define F_st_nlink "%ld" |
||
423 | # elif HAVE_TYPEOF_ST_NLINK==6 |
||
424 | #define F_st_nlink "%lu" |
||
425 | # elif HAVE_TYPEOF_ST_NLINK==7 |
||
426 | #define F_st_nlink "%Ld" |
||
427 | # elif HAVE_TYPEOF_ST_NLINK==8 |
||
428 | #define F_st_nlink "%Lu" |
||
429 | # else |
||
430 | #error "HAVE_TYPEOF_ST_NLINK is out of range:" HAVE_TYPEOF_ST_NLINK |
||
431 | # endif |
||
432 | #endif |
||
433 | |||
434 | /* all signed; default: long */ |
||
435 | #if !defined(HAVE_TYPEOF_ST_SIZE) || !HAVE_TYPEOF_ST_SIZE |
||
436 | # undef HAVE_TYPEOF_ST_SIZE |
||
437 | # define HAVE_TYPEOF_ST_SIZE 5 |
||
438 | #endif |
||
439 | #ifndef F_st_size |
||
440 | # if HAVE_TYPEOF_ST_SIZE==1 |
||
441 | #define F_st_size "%hd" |
||
442 | # elif HAVE_TYPEOF_ST_SIZE==2 |
||
443 | #define F_st_size "%hu" |
||
444 | # elif HAVE_TYPEOF_ST_SIZE==3 |
||
445 | #define F_st_size "%""d" |
||
446 | # elif HAVE_TYPEOF_ST_SIZE==4 |
||
447 | #define F_st_size "%u" |
||
448 | # elif HAVE_TYPEOF_ST_SIZE==5 |
||
449 | #define F_st_size "%ld" |
||
450 | # elif HAVE_TYPEOF_ST_SIZE==6 |
||
451 | #define F_st_size "%lu" |
||
452 | # elif HAVE_TYPEOF_ST_SIZE==7 |
||
453 | #define F_st_size "%Ld" |
||
454 | # elif HAVE_TYPEOF_ST_SIZE==8 |
||
455 | #define F_st_size "%Lu" |
||
456 | # else |
||
457 | #error "HAVE_TYPEOF_ST_SIZE is out of range:" HAVE_TYPEOF_ST_SIZE |
||
458 | # endif |
||
459 | #endif |
||
460 | |||
461 | /* all signed; default: long long */ |
||
462 | #if !defined(HAVE_TYPEOF_ST64_SIZE) || !HAVE_TYPEOF_ST64_SIZE |
||
463 | # undef HAVE_TYPEOF_ST64_SIZE |
||
464 | # define HAVE_TYPEOF_ST64_SIZE 7 |
||
465 | #endif |
||
466 | #ifndef F_st64_size |
||
467 | # if HAVE_TYPEOF_ST64_SIZE==1 |
||
468 | #define F_st64_size "%hd" |
||
469 | # elif HAVE_TYPEOF_ST64_SIZE==2 |
||
470 | #define F_st64_size "%hu" |
||
471 | # elif HAVE_TYPEOF_ST64_SIZE==3 |
||
472 | #define F_st64_size "%""d" |
||
473 | # elif HAVE_TYPEOF_ST64_SIZE==4 |
||
474 | #define F_st64_size "%u" |
||
475 | # elif HAVE_TYPEOF_ST64_SIZE==5 |
||
476 | #define F_st64_size "%ld" |
||
477 | # elif HAVE_TYPEOF_ST64_SIZE==6 |
||
478 | #define F_st64_size "%lu" |
||
479 | # elif HAVE_TYPEOF_ST64_SIZE==7 |
||
480 | #define F_st64_size "%Ld" |
||
481 | # elif HAVE_TYPEOF_ST64_SIZE==8 |
||
482 | #define F_st64_size "%Lu" |
||
483 | # else |
||
484 | #error "HAVE_TYPEOF_ST64_SIZE is out of range:" HAVE_TYPEOF_ST64_SIZE |
||
485 | # endif |
||
486 | #endif |
||
487 | |||
488 | /* very different results; default: long */ |
||
489 | #if !defined(HAVE_TYPEOF_ST_BLKSIZE) || !HAVE_TYPEOF_ST_BLKSIZE |
||
490 | # undef HAVE_TYPEOF_ST_BLKSIZE |
||
491 | # define HAVE_TYPEOF_ST_BLKSIZE 5 |
||
492 | #endif |
||
493 | #ifndef F_st_blksize |
||
494 | # if HAVE_TYPEOF_ST_BLKSIZE==1 |
||
495 | #define F_st_blksize "%hd" |
||
496 | # elif HAVE_TYPEOF_ST_BLKSIZE==2 |
||
497 | #define F_st_blksize "%hu" |
||
498 | # elif HAVE_TYPEOF_ST_BLKSIZE==3 |
||
499 | #define F_st_blksize "%""d" |
||
500 | # elif HAVE_TYPEOF_ST_BLKSIZE==4 |
||
501 | #define F_st_blksize "%u" |
||
502 | # elif HAVE_TYPEOF_ST_BLKSIZE==5 |
||
503 | #define F_st_blksize "%ld" |
||
504 | # elif HAVE_TYPEOF_ST_BLKSIZE==6 |
||
505 | #define F_st_blksize "%lu" |
||
506 | # elif HAVE_TYPEOF_ST_BLKSIZE==7 |
||
507 | #define F_st_blksize "%Ld" |
||
508 | # elif HAVE_TYPEOF_ST_BLKSIZE==8 |
||
509 | #define F_st_blksize "%Lu" |
||
510 | # else |
||
511 | #error "HAVE_TYPEOF_ST_BLKSIZE is out of range:" HAVE_TYPEOF_ST_BLKSIZE |
||
512 | # endif |
||
513 | #endif |
||
514 | |||
515 | /* default: long */ |
||
516 | #if !defined(HAVE_TYPEOF_ST_BLOCKS) || !HAVE_TYPEOF_ST_BLOCKS |
||
517 | # undef HAVE_TYPEOF_ST_BLOCKS |
||
518 | # define HAVE_TYPEOF_ST_BLOCKS 5 |
||
519 | #endif |
||
520 | #ifndef F_st_blocks |
||
521 | # if HAVE_TYPEOF_ST_BLOCKS==1 |
||
522 | #define F_st_blocks "%hd" |
||
523 | # elif HAVE_TYPEOF_ST_BLOCKS==2 |
||
524 | #define F_st_blocks "%hu" |
||
525 | # elif HAVE_TYPEOF_ST_BLOCKS==3 |
||
526 | #define F_st_blocks "%""d" |
||
527 | # elif HAVE_TYPEOF_ST_BLOCKS==4 |
||
528 | #define F_st_blocks "%u" |
||
529 | # elif HAVE_TYPEOF_ST_BLOCKS==5 |
||
530 | #define F_st_blocks "%ld" |
||
531 | # elif HAVE_TYPEOF_ST_BLOCKS==6 |
||
532 | #define F_st_blocks "%lu" |
||
533 | # elif HAVE_TYPEOF_ST_BLOCKS==7 |
||
534 | #define F_st_blocks "%Ld" |
||
535 | # elif HAVE_TYPEOF_ST_BLOCKS==8 |
||
536 | #define F_st_blocks "%Lu" |
||
537 | # else |
||
538 | #error "HAVE_TYPEOF_ST_BLOCKS is out of range:" HAVE_TYPEOF_ST_BLOCKS |
||
539 | # endif |
||
540 | #endif |
||
541 | |||
542 | /* default: long long */ |
||
543 | #if !defined(HAVE_TYPEOF_ST64_BLOCKS) || !HAVE_TYPEOF_ST64_BLOCKS |
||
544 | # undef HAVE_TYPEOF_ST64_BLOCKS |
||
545 | # define HAVE_TYPEOF_ST64_BLOCKS 7 |
||
546 | #endif |
||
547 | #ifndef F_st64_blocks |
||
548 | # if HAVE_TYPEOF_ST64_BLOCKS==1 |
||
549 | #define F_st64_blocks "%hd" |
||
550 | # elif HAVE_TYPEOF_ST64_BLOCKS==2 |
||
551 | #define F_st64_blocks "%hu" |
||
552 | # elif HAVE_TYPEOF_ST64_BLOCKS==3 |
||
553 | #define F_st64_blocks "%""d" |
||
554 | # elif HAVE_TYPEOF_ST64_BLOCKS==4 |
||
555 | #define F_st64_blocks "%u" |
||
556 | # elif HAVE_TYPEOF_ST64_BLOCKS==5 |
||
557 | #define F_st64_blocks "%ld" |
||
558 | # elif HAVE_TYPEOF_ST64_BLOCKS==6 |
||
559 | #define F_st64_blocks "%lu" |
||
560 | # elif HAVE_TYPEOF_ST64_BLOCKS==7 |
||
561 | #define F_st64_blocks "%Ld" |
||
562 | # elif HAVE_TYPEOF_ST64_BLOCKS==8 |
||
563 | #define F_st64_blocks "%Lu" |
||
564 | # else |
||
565 | #error "HAVE_TYPEOF_ST64_BLOCKS is out of range:" HAVE_TYPEOF_ST64_BLOCKS |
||
566 | # endif |
||
567 | #endif |
||
568 | |||
569 | |||
570 | /* at least for Linux */ |
||
571 | #define F_tv_sec "%ld" |
||
572 | |||
573 | /* default: long */ |
||
574 | #if !defined(HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC) || !HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC |
||
575 | # undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC |
||
576 | # define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5 |
||
577 | #endif |
||
578 | #ifndef F_tv_usec |
||
579 | # if HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==1 |
||
580 | #define F_tv_usec "%06hd" |
||
581 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==2 |
||
582 | #define F_tv_usec "%06hu" |
||
583 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==3 |
||
584 | #define F_tv_usec "%06d" |
||
585 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==4 |
||
586 | #define F_tv_usec "%06u" |
||
587 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==5 |
||
588 | #define F_tv_usec "%06ld" |
||
589 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==6 |
||
590 | #define F_tv_usec "%06lu" |
||
591 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==7 |
||
592 | #define F_tv_usec "%06Ld" |
||
593 | # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==8 |
||
594 | #define F_tv_usec "%06Lu" |
||
595 | # else |
||
596 | #error "HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC is out of range:" HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC |
||
597 | # endif |
||
598 | #endif |
||
599 | |||
600 | /* default: long */ |
||
601 | #if !defined(HAVE_TYPEOF_RLIM_MAX) || !HAVE_TYPEOF_RLIM_MAX |
||
602 | # undef HAVE_TYPEOF_RLIM_MAX |
||
603 | # define HAVE_TYPEOF_RLIM_MAX 5 |
||
604 | #endif |
||
605 | #ifndef F_rlim_max |
||
606 | # if HAVE_TYPEOF_RLIM_MAX==1 |
||
607 | #define F_rlim_max "hd" |
||
608 | # elif HAVE_TYPEOF_RLIM_MAX==2 |
||
609 | #define F_rlim_max "hu" |
||
610 | # elif HAVE_TYPEOF_RLIM_MAX==3 |
||
611 | #define F_rlim_max "d" |
||
612 | # elif HAVE_TYPEOF_RLIM_MAX==4 |
||
613 | #define F_rlim_max "u" |
||
614 | # elif HAVE_TYPEOF_RLIM_MAX==5 |
||
615 | #define F_rlim_max "ld" |
||
616 | # elif HAVE_TYPEOF_RLIM_MAX==6 |
||
617 | #define F_rlim_max "lu" |
||
618 | # elif HAVE_TYPEOF_RLIM_MAX==7 |
||
619 | #define F_rlim_max "Ld" |
||
620 | # elif HAVE_TYPEOF_RLIM_MAX==8 |
||
621 | #define F_rlim_max "Lu" |
||
622 | # else |
||
623 | #error "HAVE_TYPEOF_RLIM_MAX is out of range:" HAVE_TYPEOF_RLIM_MAX |
||
624 | # endif |
||
625 | #endif |
||
626 | |||
627 | /* default: socklen_t */ |
||
628 | #if !defined(HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN) || !HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN |
||
629 | # undef HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN |
||
630 | # define HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN HAVE_BASIC_SOCKLEN_T |
||
631 | #endif |
||
632 | #ifndef F_cmsg_len |
||
633 | # if HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==1 |
||
634 | #define F_cmsg_len "%""hd" |
||
635 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==2 |
||
636 | #define F_cmsg_len "%""hu" |
||
637 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==3 |
||
638 | #define F_cmsg_len "%""d" |
||
639 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==4 |
||
640 | #define F_cmsg_len "%""u" |
||
641 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==5 |
||
642 | #define F_cmsg_len "%""ld" |
||
643 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==6 |
||
644 | #define F_cmsg_len "%""lu" |
||
645 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==7 |
||
646 | #define F_cmsg_len "%""Ld" |
||
647 | # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==8 |
||
648 | #define F_cmsg_len "%""Lu" |
||
649 | # else |
||
650 | #error "HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN is out of range:" HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN |
||
651 | # endif |
||
652 | #endif |
||
653 | |||
654 | #define F_thread "%lu" |
||
655 | |||
656 | /* Cygwin 1.3.22 has the prototypes, but not the type... */ |
||
657 | #ifndef HAVE_TYPE_STAT64 |
||
658 | # undef HAVE_STAT64 |
||
659 | # undef HAVE_FSTAT64 |
||
660 | # undef HAVE_LSTAT64 |
||
661 | #endif |
||
662 | #ifndef HAVE_TYPE_OFF64 |
||
663 | # undef HAVE_LSEEK64 |
||
664 | # undef HAVE_FTRUNCATE64 |
||
665 | #endif |
||
666 | |||
667 | #if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL) |
||
668 | # define NETDB_INTERNAL h_NETDB_INTERNAL |
||
669 | #endif |
||
670 | |||
671 | #ifndef INET_ADDRSTRLEN |
||
672 | # define INET_ADDRSTRLEN sizeof(struct sockaddr_in) |
||
673 | #endif |
||
674 | |||
675 | #if !HAVE_PROTOTYPE_HSTRERROR |
||
676 | /* with MacOSX this is char * */ |
||
677 | extern const char *hstrerror(int); |
||
678 | #endif |
||
679 | |||
680 | #endif /* !defined(__compat_h_included) */ |