2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 #ifndef __compat_h_included
6 #define __compat_h_included 1
8 #if !HAVE_DECL_ENVIRON && HAVE_VAR_ENVIRON
12 /*****************************************************************************/
13 /* I dont like this system dependent part, but it would be quite a challenge
16 /* define if the following does not work:
18 connect() -> Connection refused
20 instead, it needs close() and socket() between the two connect() attmpts: */
21 #if __FreeBSD__ || __APPLE__ || _AIX || __hpux__ || __osf__
22 # undef SOCKET_CAN_RECOVER
24 # define SOCKET_CAN_RECOVER 1
27 /* define if stat() says that pipes are sockets */
29 # define PIPE_STATES_SOCKET 1
31 # undef PIPE_STATES_SOCKET
34 /*****************************************************************************/
36 /* substitute some features that might be missing on some platforms */
38 #if !HAVE_TYPE_SIG_ATOMIC_T
39 typedef int sig_atomic_t;
53 # define MIN(x,y) ((x)<=(y)?(x):(y))
57 # define MAX(x,y) ((x)>=(y)?(x):(y))
60 /* O_ASYNC: Linux 2.2.10 */
61 #if !defined(O_ASYNC) && defined(FASYNC)
62 # define O_ASYNC FASYNC
65 /* NGROUPS not defined on Solaris */
66 #if !defined(NGROUPS) && defined(NGROUPS_MAX)
67 # define NGROUPS NGROUPS_MAX
70 /* UNIX_PATH_MAX: AIX 4.3.3 */
72 # define UNIX_PATH_MAX 104 /*! why 104? Linux: 108 ! */
76 /* SOL_IP: AIX 4.3.3 */
81 /* SOL_TCP: AIX 4.3.3 */
84 # define SOL_TCP IPPROTO_TCP
88 /* POSIX.1 doesn't seem to know sockets */
90 # define S_ISSOCK(fmode) 0
93 #if defined(IPPROTO_IPV6) && !defined(SOL_IPV6)
94 # define SOL_IPV6 IPPROTO_IPV6
98 #if !defined(HAVE_BASIC_SIZE_T) || !HAVE_BASIC_SIZE_T
99 # undef HAVE_BASIC_SIZE_T
100 # define HAVE_BASIC_SIZE_T 6
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
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
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
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
127 # error "HAVE_BASIC_SIZE_T is out of range:" HAVE_BASIC_SIZE_T
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
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"
150 #error "HAVE_BASIC_MODE_T is out of range:" HAVE_BASIC_MODE_T
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
161 # if HAVE_BASIC_PID_T==1
163 # elif HAVE_BASIC_PID_T==2
165 # elif HAVE_BASIC_PID_T==3
167 # elif HAVE_BASIC_PID_T==4
169 # elif HAVE_BASIC_PID_T==5
171 # elif HAVE_BASIC_PID_T==6
174 #error "HAVE_BASIC_PID_T is out of range:" HAVE_BASIC_PID_T
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
185 # if HAVE_BASIC_UID_T==1
187 # elif HAVE_BASIC_UID_T==2
189 # elif HAVE_BASIC_UID_T==3
191 # elif HAVE_BASIC_UID_T==4
193 # elif HAVE_BASIC_UID_T==5
195 # elif HAVE_BASIC_UID_T==6
198 #error "HAVE_BASIC_UID_T is out of range:" HAVE_BASIC_UID_T
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
209 # if HAVE_BASIC_GID_T==1
211 # elif HAVE_BASIC_GID_T==2
213 # elif HAVE_BASIC_GID_T==3
215 # elif HAVE_BASIC_GID_T==4
217 # elif HAVE_BASIC_GID_T==5
219 # elif HAVE_BASIC_GID_T==6
222 #error "HAVE_BASIC_GID_T is out of range:" HAVE_BASIC_GID_T
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
233 # if HAVE_BASIC_TIME_T==1
235 # elif HAVE_BASIC_TIME_T==2
237 # elif HAVE_BASIC_TIME_T==3
238 #define F_time "%""d"
239 # elif HAVE_BASIC_TIME_T==4
241 # elif HAVE_BASIC_TIME_T==5
243 # elif HAVE_BASIC_TIME_T==6
245 # elif HAVE_BASIC_TIME_T==7
247 # elif HAVE_BASIC_TIME_T==8
250 #error "HAVE_BASIC_TIME_T is out of range:" HAVE_BASIC_TIME_T
256 #if !defined(HAVE_BASIC_SOCKLEN_T) || !HAVE_BASIC_SOCKLEN_T
257 # undef HAVE_BASIC_SOCKLEN_T
258 # define HAVE_BASIC_SOCKLEN_T 3
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"
278 #error "HAVE_BASIC_SOCKLEN_T is out of range:" HAVE_BASIC_SOCKLEN_T
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*/
287 # if HAVE_BASIC_OFF_T==3
288 # define F_off "%""d"
289 # elif HAVE_BASIC_OFF_T==5
291 # elif HAVE_BASIC_OFF_T==7
294 #error "HAVE_BASIC_OFF_T is out of range:" HAVE_BASIC_OFF_T
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
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
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"
321 #error "HAVE_BASIC_OFF64_T is out of range:" HAVE_BASIC_OFF64_T
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
332 # if HAVE_BASIC_DEV_T==1
334 # elif HAVE_BASIC_DEV_T==2
336 # elif HAVE_BASIC_DEV_T==3
338 # elif HAVE_BASIC_DEV_T==4
340 # elif HAVE_BASIC_DEV_T==5
342 # elif HAVE_BASIC_DEV_T==6
344 # elif HAVE_BASIC_DEV_T==7
346 # elif HAVE_BASIC_DEV_T==8
349 #error "HAVE_BASIC_DEV_T is out of range:" HAVE_BASIC_DEV_T
355 #if !defined(HAVE_BASIC_SPEED_T) || !HAVE_BASIC_SPEED_T
356 # undef HAVE_BASIC_SPEED_T
357 # define HAVE_BASIC_SPEED_T 4
360 # if HAVE_BASIC_SPEED_T==1
361 #define F_speed "%hd"
362 # elif HAVE_BASIC_SPEED_T==2
363 #define F_speed "%hu"
364 # elif HAVE_BASIC_SPEED_T==3
365 #define F_speed "%""d"
366 # elif HAVE_BASIC_SPEED_T==4
368 # elif HAVE_BASIC_SPEED_T==5
369 #define F_speed "%ld"
370 # elif HAVE_BASIC_SPEED_T==6
371 #define F_speed "%lu"
372 # elif HAVE_BASIC_SPEED_T==7
373 #define F_speed "%Ld"
374 # elif HAVE_BASIC_SPEED_T==8
375 #define F_speed "%Lu"
377 #error "HAVE_BASIC_SPEED_T is out of range:" HAVE_BASIC_SPEED_T
380 #endif /* _WITH_TERMIOS */
382 /* all unsigned; default; unsigned long */
383 #if !defined(HAVE_TYPEOF_ST_INO) || !HAVE_TYPEOF_ST_INO
384 # undef HAVE_TYPEOF_ST_INO
385 # define HAVE_TYPEOF_ST_INO 6
388 # if HAVE_TYPEOF_ST_INO==1
389 #define F_st_ino "%hd"
390 # elif HAVE_TYPEOF_ST_INO==2
391 #define F_st_ino "%hu"
392 # elif HAVE_TYPEOF_ST_INO==3
393 #define F_st_ino "%""d"
394 # elif HAVE_TYPEOF_ST_INO==4
395 #define F_st_ino "%u"
396 # elif HAVE_TYPEOF_ST_INO==5
397 #define F_st_ino "%ld"
398 # elif HAVE_TYPEOF_ST_INO==6
399 #define F_st_ino "%lu"
400 # elif HAVE_TYPEOF_ST_INO==7 /* Cygwin 1.5 */
401 #define F_st_ino "%Ld"
402 # elif HAVE_TYPEOF_ST_INO==8
403 #define F_st_ino "%Lu"
405 #error "HAVE_TYPEOF_ST_INO is out of range:" HAVE_TYPEOF_ST_INO
409 /* all unsigned; default; unsigned long long */
410 #if !defined(HAVE_TYPEOF_ST64_INO) || !HAVE_TYPEOF_ST64_INO
411 # undef HAVE_TYPEOF_ST64_INO
412 # define HAVE_TYPEOF_ST64_INO 8
415 # if HAVE_TYPEOF_ST64_INO==1
416 #define F_st64_ino "%hd"
417 # elif HAVE_TYPEOF_ST64_INO==2
418 #define F_st64_ino "%hu"
419 # elif HAVE_TYPEOF_ST64_INO==3
420 #define F_st64_ino "%""d"
421 # elif HAVE_TYPEOF_ST64_INO==4
422 #define F_st64_ino "%u"
423 # elif HAVE_TYPEOF_ST64_INO==5
424 #define F_st64_ino "%ld"
425 # elif HAVE_TYPEOF_ST64_INO==6
426 #define F_st64_ino "%lu"
427 # elif HAVE_TYPEOF_ST64_INO==7
428 #define F_st64_ino "%Ld"
429 # elif HAVE_TYPEOF_ST64_INO==8
430 #define F_st64_ino "%Lu"
432 #error "HAVE_TYPEOF_ST64_INO is out of range:" HAVE_TYPEOF_ST64_INO
436 /* default: unsigned short */
437 #if !defined(HAVE_TYPEOF_ST_NLINK) || !HAVE_TYPEOF_ST_NLINK
438 # undef HAVE_TYPEOF_ST_NLINK
439 # define HAVE_TYPEOF_ST_NLINK 2
442 # if HAVE_TYPEOF_ST_NLINK==1
443 #define F_st_nlink "%hd"
444 # elif HAVE_TYPEOF_ST_NLINK==2
445 #define F_st_nlink "%hu"
446 # elif HAVE_TYPEOF_ST_NLINK==3
447 #define F_st_nlink "%""d"
448 # elif HAVE_TYPEOF_ST_NLINK==4
449 #define F_st_nlink "%u"
450 # elif HAVE_TYPEOF_ST_NLINK==5
451 #define F_st_nlink "%ld"
452 # elif HAVE_TYPEOF_ST_NLINK==6
453 #define F_st_nlink "%lu"
454 # elif HAVE_TYPEOF_ST_NLINK==7
455 #define F_st_nlink "%Ld"
456 # elif HAVE_TYPEOF_ST_NLINK==8
457 #define F_st_nlink "%Lu"
459 #error "HAVE_TYPEOF_ST_NLINK is out of range:" HAVE_TYPEOF_ST_NLINK
463 /* all signed; default: long */
464 #if !defined(HAVE_TYPEOF_ST_SIZE) || !HAVE_TYPEOF_ST_SIZE
465 # undef HAVE_TYPEOF_ST_SIZE
466 # define HAVE_TYPEOF_ST_SIZE 5
469 # if HAVE_TYPEOF_ST_SIZE==1
470 #define F_st_size "%hd"
471 # elif HAVE_TYPEOF_ST_SIZE==2
472 #define F_st_size "%hu"
473 # elif HAVE_TYPEOF_ST_SIZE==3
474 #define F_st_size "%""d"
475 # elif HAVE_TYPEOF_ST_SIZE==4
476 #define F_st_size "%u"
477 # elif HAVE_TYPEOF_ST_SIZE==5
478 #define F_st_size "%ld"
479 # elif HAVE_TYPEOF_ST_SIZE==6
480 #define F_st_size "%lu"
481 # elif HAVE_TYPEOF_ST_SIZE==7
482 #define F_st_size "%Ld"
483 # elif HAVE_TYPEOF_ST_SIZE==8
484 #define F_st_size "%Lu"
486 #error "HAVE_TYPEOF_ST_SIZE is out of range:" HAVE_TYPEOF_ST_SIZE
490 /* all signed; default: long long */
491 #if !defined(HAVE_TYPEOF_ST64_SIZE) || !HAVE_TYPEOF_ST64_SIZE
492 # undef HAVE_TYPEOF_ST64_SIZE
493 # define HAVE_TYPEOF_ST64_SIZE 7
496 # if HAVE_TYPEOF_ST64_SIZE==1
497 #define F_st64_size "%hd"
498 # elif HAVE_TYPEOF_ST64_SIZE==2
499 #define F_st64_size "%hu"
500 # elif HAVE_TYPEOF_ST64_SIZE==3
501 #define F_st64_size "%""d"
502 # elif HAVE_TYPEOF_ST64_SIZE==4
503 #define F_st64_size "%u"
504 # elif HAVE_TYPEOF_ST64_SIZE==5
505 #define F_st64_size "%ld"
506 # elif HAVE_TYPEOF_ST64_SIZE==6
507 #define F_st64_size "%lu"
508 # elif HAVE_TYPEOF_ST64_SIZE==7
509 #define F_st64_size "%Ld"
510 # elif HAVE_TYPEOF_ST64_SIZE==8
511 #define F_st64_size "%Lu"
513 #error "HAVE_TYPEOF_ST64_SIZE is out of range:" HAVE_TYPEOF_ST64_SIZE
517 /* very different results; default: long */
518 #if !defined(HAVE_TYPEOF_ST_BLKSIZE) || !HAVE_TYPEOF_ST_BLKSIZE
519 # undef HAVE_TYPEOF_ST_BLKSIZE
520 # define HAVE_TYPEOF_ST_BLKSIZE 5
523 # if HAVE_TYPEOF_ST_BLKSIZE==1
524 #define F_st_blksize "%hd"
525 # elif HAVE_TYPEOF_ST_BLKSIZE==2
526 #define F_st_blksize "%hu"
527 # elif HAVE_TYPEOF_ST_BLKSIZE==3
528 #define F_st_blksize "%""d"
529 # elif HAVE_TYPEOF_ST_BLKSIZE==4
530 #define F_st_blksize "%u"
531 # elif HAVE_TYPEOF_ST_BLKSIZE==5
532 #define F_st_blksize "%ld"
533 # elif HAVE_TYPEOF_ST_BLKSIZE==6
534 #define F_st_blksize "%lu"
535 # elif HAVE_TYPEOF_ST_BLKSIZE==7
536 #define F_st_blksize "%Ld"
537 # elif HAVE_TYPEOF_ST_BLKSIZE==8
538 #define F_st_blksize "%Lu"
540 #error "HAVE_TYPEOF_ST_BLKSIZE is out of range:" HAVE_TYPEOF_ST_BLKSIZE
545 #if !defined(HAVE_TYPEOF_ST_BLOCKS) || !HAVE_TYPEOF_ST_BLOCKS
546 # undef HAVE_TYPEOF_ST_BLOCKS
547 # define HAVE_TYPEOF_ST_BLOCKS 5
550 # if HAVE_TYPEOF_ST_BLOCKS==1
551 #define F_st_blocks "%hd"
552 # elif HAVE_TYPEOF_ST_BLOCKS==2
553 #define F_st_blocks "%hu"
554 # elif HAVE_TYPEOF_ST_BLOCKS==3
555 #define F_st_blocks "%""d"
556 # elif HAVE_TYPEOF_ST_BLOCKS==4
557 #define F_st_blocks "%u"
558 # elif HAVE_TYPEOF_ST_BLOCKS==5
559 #define F_st_blocks "%ld"
560 # elif HAVE_TYPEOF_ST_BLOCKS==6
561 #define F_st_blocks "%lu"
562 # elif HAVE_TYPEOF_ST_BLOCKS==7
563 #define F_st_blocks "%Ld"
564 # elif HAVE_TYPEOF_ST_BLOCKS==8
565 #define F_st_blocks "%Lu"
567 #error "HAVE_TYPEOF_ST_BLOCKS is out of range:" HAVE_TYPEOF_ST_BLOCKS
571 /* default: long long */
572 #if !defined(HAVE_TYPEOF_ST64_BLOCKS) || !HAVE_TYPEOF_ST64_BLOCKS
573 # undef HAVE_TYPEOF_ST64_BLOCKS
574 # define HAVE_TYPEOF_ST64_BLOCKS 7
576 #ifndef F_st64_blocks
577 # if HAVE_TYPEOF_ST64_BLOCKS==1
578 #define F_st64_blocks "%hd"
579 # elif HAVE_TYPEOF_ST64_BLOCKS==2
580 #define F_st64_blocks "%hu"
581 # elif HAVE_TYPEOF_ST64_BLOCKS==3
582 #define F_st64_blocks "%""d"
583 # elif HAVE_TYPEOF_ST64_BLOCKS==4
584 #define F_st64_blocks "%u"
585 # elif HAVE_TYPEOF_ST64_BLOCKS==5
586 #define F_st64_blocks "%ld"
587 # elif HAVE_TYPEOF_ST64_BLOCKS==6
588 #define F_st64_blocks "%lu"
589 # elif HAVE_TYPEOF_ST64_BLOCKS==7
590 #define F_st64_blocks "%Ld"
591 # elif HAVE_TYPEOF_ST64_BLOCKS==8
592 #define F_st64_blocks "%Lu"
594 #error "HAVE_TYPEOF_ST64_BLOCKS is out of range:" HAVE_TYPEOF_ST64_BLOCKS
599 /* at least for Linux */
600 #define F_tv_sec "%ld"
603 #if !defined(HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC) || !HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
604 # undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
605 # define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5
608 # if HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==1
609 #define F_tv_usec "%06hd"
610 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==2
611 #define F_tv_usec "%06hu"
612 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==3
613 #define F_tv_usec "%06d"
614 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==4
615 #define F_tv_usec "%06u"
616 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==5
617 #define F_tv_usec "%06ld"
618 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==6
619 #define F_tv_usec "%06lu"
620 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==7
621 #define F_tv_usec "%06Ld"
622 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==8
623 #define F_tv_usec "%06Lu"
625 #error "HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC is out of range:" HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
630 #if !defined(HAVE_TYPEOF_RLIM_MAX) || !HAVE_TYPEOF_RLIM_MAX
631 # undef HAVE_TYPEOF_RLIM_MAX
632 # define HAVE_TYPEOF_RLIM_MAX 5
635 # if HAVE_TYPEOF_RLIM_MAX==1
636 #define F_rlim_max "hd"
637 # elif HAVE_TYPEOF_RLIM_MAX==2
638 #define F_rlim_max "hu"
639 # elif HAVE_TYPEOF_RLIM_MAX==3
640 #define F_rlim_max "d"
641 # elif HAVE_TYPEOF_RLIM_MAX==4
642 #define F_rlim_max "u"
643 # elif HAVE_TYPEOF_RLIM_MAX==5
644 #define F_rlim_max "ld"
645 # elif HAVE_TYPEOF_RLIM_MAX==6
646 #define F_rlim_max "lu"
647 # elif HAVE_TYPEOF_RLIM_MAX==7
648 #define F_rlim_max "Ld"
649 # elif HAVE_TYPEOF_RLIM_MAX==8
650 #define F_rlim_max "Lu"
652 #error "HAVE_TYPEOF_RLIM_MAX is out of range:" HAVE_TYPEOF_RLIM_MAX
656 /* default: socklen_t */
657 #if !defined(HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN) || !HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
658 # undef HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
659 # define HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN HAVE_BASIC_SOCKLEN_T
662 # if HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==1
663 #define F_cmsg_len "%""hd"
664 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==2
665 #define F_cmsg_len "%""hu"
666 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==3
667 #define F_cmsg_len "%""d"
668 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==4
669 #define F_cmsg_len "%""u"
670 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==5
671 #define F_cmsg_len "%""ld"
672 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==6
673 #define F_cmsg_len "%""lu"
674 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==7
675 #define F_cmsg_len "%""Ld"
676 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==8
677 #define F_cmsg_len "%""Lu"
679 #error "HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN is out of range:" HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
683 /* Cygwin 1.3.22 has the prototypes, but not the type... */
684 #ifndef HAVE_TYPE_STAT64
689 #ifndef HAVE_TYPE_OFF64
691 # undef HAVE_FTRUNCATE64
694 #if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL)
695 # define NETDB_INTERNAL h_NETDB_INTERNAL
698 #ifndef INET_ADDRSTRLEN
699 # define INET_ADDRSTRLEN sizeof(struct sockaddr_in)
702 #if !HAVE_PROTOTYPE_HSTRERROR
703 /* with MacOSX this is char * */
704 extern const char *hstrerror(int);
707 #endif /* !defined(__compat_h_included) */