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
97 #define F_uint8_t "%hu"
98 #define F_int8_t "%hd"
101 # if HAVE_BASIC_UINT16_T==0
102 # define F_uint16_t "%hu"
103 # elif HAVE_BASIC_UINT16_T==2
104 # define F_uint16_t "%hu"
105 # elif HAVE_BASIC_UINT16_T==4
106 # define F_uint16_t "%u"
107 # elif HAVE_BASIC_UINT16_T==6
108 # define F_uint16_t "%lu"
110 # error "HAVE_BASIC_UINT16_T is out of range:" HAVE_BASIC_UINT16_T
115 # if HAVE_BASIC_UINT32_T==0
116 # define F_uint32_t "%hu"
117 # elif HAVE_BASIC_UINT32_T==2
118 # define F_uint32_t "%hu"
119 # elif HAVE_BASIC_UINT32_T==4
120 # define F_uint32_t "%u"
121 # elif HAVE_BASIC_UINT32_T==6
122 # define F_uint32_t "%lu"
124 # error "HAVE_BASIC_UINT32_T is out of range:" HAVE_BASIC_UINT32_T
129 # if HAVE_BASIC_UINT64_T==0
130 # define F_uint64_t "%hu"
131 # elif HAVE_BASIC_UINT64_T==2
132 # define F_uint64_t "%hu"
133 # elif HAVE_BASIC_UINT64_T==4
134 # define F_uint64_t "%u"
135 # elif HAVE_BASIC_UINT64_T==6
136 # define F_uint64_t "%lu"
137 # elif HAVE_BASIC_UINT64_T==8
138 # define F_uint64_t "%llu"
140 # error "HAVE_BASIC_UINT64_T is out of range:" HAVE_BASIC_UINT64_T
145 # if HAVE_BASIC_INT16_T==0
146 # define F_int16_t "%hd"
147 # elif HAVE_BASIC_INT16_T==1
148 # define F_int16_t "%hd"
149 # elif HAVE_BASIC_INT16_T==3
150 # define F_int16_t "%d"
151 # elif HAVE_BASIC_INT16_T==5
152 # define F_int16_t "%ld"
154 # error "HAVE_BASIC_INT16_T is out of range:" HAVE_BASIC_INT16_T
159 # if HAVE_BASIC_INT32_T==0
160 # define F_int32_t "%hd"
161 # elif HAVE_BASIC_INT32_T==1
162 # define F_int32_t "%hd"
163 # elif HAVE_BASIC_INT32_T==3
164 # define F_int32_t "%d"
165 # elif HAVE_BASIC_INT32_T==5
166 # define F_int32_t "%ld"
168 # error "HAVE_BASIC_INT32_T is out of range:" HAVE_BASIC_INT32_T
173 # if HAVE_BASIC_INT64_T==0
174 # define F_int64_t "%hd"
175 # elif HAVE_BASIC_INT64_T==1
176 # define F_int64_t "%hd"
177 # elif HAVE_BASIC_INT64_T==3
178 # define F_int64_t "%d"
179 # elif HAVE_BASIC_INT64_T==5
180 # define F_int64_t "%ld"
181 # elif HAVE_BASIC_INT64_T==7
182 # define F_int64_t "%lld"
184 # error "HAVE_BASIC_INT64_T is out of range:" HAVE_BASIC_INT64_T
189 #if !defined(HAVE_BASIC_SIZE_T) || !HAVE_BASIC_SIZE_T
190 # undef HAVE_BASIC_SIZE_T
191 # define HAVE_BASIC_SIZE_T 6
193 #if HAVE_BASIC_SIZE_T==2
194 # define SIZET_MAX USHRT_MAX
195 # define SSIZET_MIN SHRT_MIN
196 # define SSIZET_MAX SHRT_MAX
199 #elif HAVE_BASIC_SIZE_T==4
200 # define SIZET_MAX UINT_MAX
201 # define SSIZET_MIN INT_MIN
202 # define SSIZET_MAX INT_MAX
205 #elif HAVE_BASIC_SIZE_T==6
206 # define SIZET_MAX ULONG_MAX
207 # define SSIZET_MIN LONG_MIN
208 # define SSIZET_MAX LONG_MAX
211 #elif HAVE_BASIC_SIZE_T==8
212 # define SIZET_MAX ULLONG_MAX
213 # define SSIZET_MIN LLONG_MIN
214 # define SSIZET_MAX LLONG_MAX
218 # error "HAVE_BASIC_SIZE_T is out of range:" HAVE_BASIC_SIZE_T
228 /* mode_t is always unsigned; default: unsigned int */
229 #if !defined(HAVE_BASIC_MODE_T) || !HAVE_BASIC_MODE_T
230 # undef HAVE_BASIC_MODE_T
231 # define HAVE_BASIC_MODE_T 4
234 # if HAVE_BASIC_MODE_T==1 || HAVE_BASIC_MODE_T==2
235 #define F_mode "0%03ho"
236 # elif HAVE_BASIC_MODE_T==3 || HAVE_BASIC_MODE_T==4
237 #define F_mode "0%03o"
238 # elif HAVE_BASIC_MODE_T==5 || HAVE_BASIC_MODE_T==6
239 #define F_mode "0%03lo"
241 #error "HAVE_BASIC_MODE_T is out of range:" HAVE_BASIC_MODE_T
246 /* default: unsigned int */
247 #if !defined(HAVE_BASIC_PID_T) || !HAVE_BASIC_PID_T
248 # undef HAVE_BASIC_PID_T
249 # define HAVE_BASIC_PID_T 4
252 # if HAVE_BASIC_PID_T==1
254 # elif HAVE_BASIC_PID_T==2
256 # elif HAVE_BASIC_PID_T==3
258 # elif HAVE_BASIC_PID_T==4
260 # elif HAVE_BASIC_PID_T==5
262 # elif HAVE_BASIC_PID_T==6
265 #error "HAVE_BASIC_PID_T is out of range:" HAVE_BASIC_PID_T
270 /* default: unsigned int */
271 #if !defined(HAVE_BASIC_UID_T) || !HAVE_BASIC_UID_T
272 # undef HAVE_BASIC_UID_T
273 # define HAVE_BASIC_UID_T 4
276 # if HAVE_BASIC_UID_T==1
278 # elif HAVE_BASIC_UID_T==2
280 # elif HAVE_BASIC_UID_T==3
282 # elif HAVE_BASIC_UID_T==4
284 # elif HAVE_BASIC_UID_T==5
286 # elif HAVE_BASIC_UID_T==6
289 #error "HAVE_BASIC_UID_T is out of range:" HAVE_BASIC_UID_T
294 /* default: unsigned int */
295 #if !defined(HAVE_BASIC_GID_T) || !HAVE_BASIC_GID_T
296 # undef HAVE_BASIC_GID_T
297 # define HAVE_BASIC_GID_T 4
300 # if HAVE_BASIC_GID_T==1
302 # elif HAVE_BASIC_GID_T==2
304 # elif HAVE_BASIC_GID_T==3
306 # elif HAVE_BASIC_GID_T==4
308 # elif HAVE_BASIC_GID_T==5
310 # elif HAVE_BASIC_GID_T==6
313 #error "HAVE_BASIC_GID_T is out of range:" HAVE_BASIC_GID_T
318 /* all signed; default: long */
319 #if !defined(HAVE_BASIC_TIME_T) || !HAVE_BASIC_TIME_T
320 # undef HAVE_BASIC_TIME_T
321 # define HAVE_BASIC_TIME_T 5
324 # if HAVE_BASIC_TIME_T==1
326 # elif HAVE_BASIC_TIME_T==2
328 # elif HAVE_BASIC_TIME_T==3
329 #define F_time "%""d"
330 # elif HAVE_BASIC_TIME_T==4
332 # elif HAVE_BASIC_TIME_T==5
334 # elif HAVE_BASIC_TIME_T==6
336 # elif HAVE_BASIC_TIME_T==7
338 # elif HAVE_BASIC_TIME_T==8
341 #error "HAVE_BASIC_TIME_T is out of range:" HAVE_BASIC_TIME_T
347 #if !defined(HAVE_BASIC_SOCKLEN_T) || !HAVE_BASIC_SOCKLEN_T
348 # undef HAVE_BASIC_SOCKLEN_T
349 # define HAVE_BASIC_SOCKLEN_T 3
352 # if HAVE_BASIC_SOCKLEN_T==1
353 #define F_socklen "%hd"
354 # elif HAVE_BASIC_SOCKLEN_T==2
355 #define F_socklen "%hu"
356 # elif HAVE_BASIC_SOCKLEN_T==3
357 #define F_socklen "%""d"
358 # elif HAVE_BASIC_SOCKLEN_T==4
359 #define F_socklen "%u"
360 # elif HAVE_BASIC_SOCKLEN_T==5
361 #define F_socklen "%ld"
362 # elif HAVE_BASIC_SOCKLEN_T==6
363 #define F_socklen "%lu"
364 # elif HAVE_BASIC_SOCKLEN_T==7
365 #define F_socklen "%Ld"
366 # elif HAVE_BASIC_SOCKLEN_T==8
367 #define F_socklen "%Lu"
369 #error "HAVE_BASIC_SOCKLEN_T is out of range:" HAVE_BASIC_SOCKLEN_T
373 #if !defined(HAVE_BASIC_OFF_T) || !HAVE_BASIC_OFF_T
374 # undef HAVE_BASIC_OFF_T
375 # define HAVE_BASIC_OFF_T 5 /*long*/
378 # if HAVE_BASIC_OFF_T==3
379 # define F_off "%""d"
380 # elif HAVE_BASIC_OFF_T==5
382 # elif HAVE_BASIC_OFF_T==7
385 #error "HAVE_BASIC_OFF_T is out of range:" HAVE_BASIC_OFF_T
389 /* default: long long */
390 #if !defined(HAVE_BASIC_OFF64_T) || !HAVE_BASIC_OFF64_T
391 # undef HAVE_BASIC_OFF64_T
392 # define HAVE_BASIC_OFF64_T 7
395 # if HAVE_BASIC_OFF64_T==1
396 #define F_off64 "%hd"
397 # elif HAVE_BASIC_OFF64_T==2
398 #define F_off64 "%hu"
399 # elif HAVE_BASIC_OFF64_T==3
400 #define F_off64 "%""d"
401 # elif HAVE_BASIC_OFF64_T==4
403 # elif HAVE_BASIC_OFF64_T==5
404 #define F_off64 "%ld"
405 # elif HAVE_BASIC_OFF64_T==6
406 #define F_off64 "%lu"
407 # elif HAVE_BASIC_OFF64_T==7
408 #define F_off64 "%Ld"
409 # elif HAVE_BASIC_OFF64_T==8
410 #define F_off64 "%Lu"
412 #error "HAVE_BASIC_OFF64_T is out of range:" HAVE_BASIC_OFF64_T
417 /* all unsigned; default: unsigned long */
418 #if !defined(HAVE_BASIC_DEV_T) || !HAVE_BASIC_DEV_T
419 # undef HAVE_BASIC_DEV_T
420 # define HAVE_BASIC_DEV_T 6
423 # if HAVE_BASIC_DEV_T==1
425 # elif HAVE_BASIC_DEV_T==2
427 # elif HAVE_BASIC_DEV_T==3
429 # elif HAVE_BASIC_DEV_T==4
431 # elif HAVE_BASIC_DEV_T==5
433 # elif HAVE_BASIC_DEV_T==6
435 # elif HAVE_BASIC_DEV_T==7
437 # elif HAVE_BASIC_DEV_T==8
440 #error "HAVE_BASIC_DEV_T is out of range:" HAVE_BASIC_DEV_T
446 #if !defined(HAVE_BASIC_SPEED_T) || !HAVE_BASIC_SPEED_T
447 # undef HAVE_BASIC_SPEED_T
448 # define HAVE_BASIC_SPEED_T 4
451 # if HAVE_BASIC_SPEED_T==1
452 #define F_speed "%hd"
453 # elif HAVE_BASIC_SPEED_T==2
454 #define F_speed "%hu"
455 # elif HAVE_BASIC_SPEED_T==3
456 #define F_speed "%""d"
457 # elif HAVE_BASIC_SPEED_T==4
459 # elif HAVE_BASIC_SPEED_T==5
460 #define F_speed "%ld"
461 # elif HAVE_BASIC_SPEED_T==6
462 #define F_speed "%lu"
463 # elif HAVE_BASIC_SPEED_T==7
464 #define F_speed "%Ld"
465 # elif HAVE_BASIC_SPEED_T==8
466 #define F_speed "%Lu"
468 #error "HAVE_BASIC_SPEED_T is out of range:" HAVE_BASIC_SPEED_T
471 #endif /* _WITH_TERMIOS */
473 /* all unsigned; default; unsigned long */
474 #if !defined(HAVE_TYPEOF_ST_INO) || !HAVE_TYPEOF_ST_INO
475 # undef HAVE_TYPEOF_ST_INO
476 # define HAVE_TYPEOF_ST_INO 6
479 # if HAVE_TYPEOF_ST_INO==1
480 #define F_st_ino "%hd"
481 # elif HAVE_TYPEOF_ST_INO==2
482 #define F_st_ino "%hu"
483 # elif HAVE_TYPEOF_ST_INO==3
484 #define F_st_ino "%""d"
485 # elif HAVE_TYPEOF_ST_INO==4
486 #define F_st_ino "%u"
487 # elif HAVE_TYPEOF_ST_INO==5
488 #define F_st_ino "%ld"
489 # elif HAVE_TYPEOF_ST_INO==6
490 #define F_st_ino "%lu"
491 # elif HAVE_TYPEOF_ST_INO==7 /* Cygwin 1.5 */
492 #define F_st_ino "%Ld"
493 # elif HAVE_TYPEOF_ST_INO==8
494 #define F_st_ino "%Lu"
496 #error "HAVE_TYPEOF_ST_INO is out of range:" HAVE_TYPEOF_ST_INO
500 /* all unsigned; default; unsigned long long */
501 #if !defined(HAVE_TYPEOF_ST64_INO) || !HAVE_TYPEOF_ST64_INO
502 # undef HAVE_TYPEOF_ST64_INO
503 # define HAVE_TYPEOF_ST64_INO 8
506 # if HAVE_TYPEOF_ST64_INO==1
507 #define F_st64_ino "%hd"
508 # elif HAVE_TYPEOF_ST64_INO==2
509 #define F_st64_ino "%hu"
510 # elif HAVE_TYPEOF_ST64_INO==3
511 #define F_st64_ino "%""d"
512 # elif HAVE_TYPEOF_ST64_INO==4
513 #define F_st64_ino "%u"
514 # elif HAVE_TYPEOF_ST64_INO==5
515 #define F_st64_ino "%ld"
516 # elif HAVE_TYPEOF_ST64_INO==6
517 #define F_st64_ino "%lu"
518 # elif HAVE_TYPEOF_ST64_INO==7
519 #define F_st64_ino "%Ld"
520 # elif HAVE_TYPEOF_ST64_INO==8
521 #define F_st64_ino "%Lu"
523 #error "HAVE_TYPEOF_ST64_INO is out of range:" HAVE_TYPEOF_ST64_INO
527 /* default: unsigned short */
528 #if !defined(HAVE_TYPEOF_ST_NLINK) || !HAVE_TYPEOF_ST_NLINK
529 # undef HAVE_TYPEOF_ST_NLINK
530 # define HAVE_TYPEOF_ST_NLINK 2
533 # if HAVE_TYPEOF_ST_NLINK==1
534 #define F_st_nlink "%hd"
535 # elif HAVE_TYPEOF_ST_NLINK==2
536 #define F_st_nlink "%hu"
537 # elif HAVE_TYPEOF_ST_NLINK==3
538 #define F_st_nlink "%""d"
539 # elif HAVE_TYPEOF_ST_NLINK==4
540 #define F_st_nlink "%u"
541 # elif HAVE_TYPEOF_ST_NLINK==5
542 #define F_st_nlink "%ld"
543 # elif HAVE_TYPEOF_ST_NLINK==6
544 #define F_st_nlink "%lu"
545 # elif HAVE_TYPEOF_ST_NLINK==7
546 #define F_st_nlink "%Ld"
547 # elif HAVE_TYPEOF_ST_NLINK==8
548 #define F_st_nlink "%Lu"
550 #error "HAVE_TYPEOF_ST_NLINK is out of range:" HAVE_TYPEOF_ST_NLINK
554 /* all signed; default: long */
555 #if !defined(HAVE_TYPEOF_ST_SIZE) || !HAVE_TYPEOF_ST_SIZE
556 # undef HAVE_TYPEOF_ST_SIZE
557 # define HAVE_TYPEOF_ST_SIZE 5
560 # if HAVE_TYPEOF_ST_SIZE==1
561 #define F_st_size "%hd"
562 # elif HAVE_TYPEOF_ST_SIZE==2
563 #define F_st_size "%hu"
564 # elif HAVE_TYPEOF_ST_SIZE==3
565 #define F_st_size "%""d"
566 # elif HAVE_TYPEOF_ST_SIZE==4
567 #define F_st_size "%u"
568 # elif HAVE_TYPEOF_ST_SIZE==5
569 #define F_st_size "%ld"
570 # elif HAVE_TYPEOF_ST_SIZE==6
571 #define F_st_size "%lu"
572 # elif HAVE_TYPEOF_ST_SIZE==7
573 #define F_st_size "%Ld"
574 # elif HAVE_TYPEOF_ST_SIZE==8
575 #define F_st_size "%Lu"
577 #error "HAVE_TYPEOF_ST_SIZE is out of range:" HAVE_TYPEOF_ST_SIZE
581 /* all signed; default: long long */
582 #if !defined(HAVE_TYPEOF_ST64_SIZE) || !HAVE_TYPEOF_ST64_SIZE
583 # undef HAVE_TYPEOF_ST64_SIZE
584 # define HAVE_TYPEOF_ST64_SIZE 7
587 # if HAVE_TYPEOF_ST64_SIZE==1
588 #define F_st64_size "%hd"
589 # elif HAVE_TYPEOF_ST64_SIZE==2
590 #define F_st64_size "%hu"
591 # elif HAVE_TYPEOF_ST64_SIZE==3
592 #define F_st64_size "%""d"
593 # elif HAVE_TYPEOF_ST64_SIZE==4
594 #define F_st64_size "%u"
595 # elif HAVE_TYPEOF_ST64_SIZE==5
596 #define F_st64_size "%ld"
597 # elif HAVE_TYPEOF_ST64_SIZE==6
598 #define F_st64_size "%lu"
599 # elif HAVE_TYPEOF_ST64_SIZE==7
600 #define F_st64_size "%Ld"
601 # elif HAVE_TYPEOF_ST64_SIZE==8
602 #define F_st64_size "%Lu"
604 #error "HAVE_TYPEOF_ST64_SIZE is out of range:" HAVE_TYPEOF_ST64_SIZE
608 /* very different results; default: long */
609 #if !defined(HAVE_TYPEOF_ST_BLKSIZE) || !HAVE_TYPEOF_ST_BLKSIZE
610 # undef HAVE_TYPEOF_ST_BLKSIZE
611 # define HAVE_TYPEOF_ST_BLKSIZE 5
614 # if HAVE_TYPEOF_ST_BLKSIZE==1
615 #define F_st_blksize "%hd"
616 # elif HAVE_TYPEOF_ST_BLKSIZE==2
617 #define F_st_blksize "%hu"
618 # elif HAVE_TYPEOF_ST_BLKSIZE==3
619 #define F_st_blksize "%""d"
620 # elif HAVE_TYPEOF_ST_BLKSIZE==4
621 #define F_st_blksize "%u"
622 # elif HAVE_TYPEOF_ST_BLKSIZE==5
623 #define F_st_blksize "%ld"
624 # elif HAVE_TYPEOF_ST_BLKSIZE==6
625 #define F_st_blksize "%lu"
626 # elif HAVE_TYPEOF_ST_BLKSIZE==7
627 #define F_st_blksize "%Ld"
628 # elif HAVE_TYPEOF_ST_BLKSIZE==8
629 #define F_st_blksize "%Lu"
631 #error "HAVE_TYPEOF_ST_BLKSIZE is out of range:" HAVE_TYPEOF_ST_BLKSIZE
636 #if !defined(HAVE_TYPEOF_ST_BLOCKS) || !HAVE_TYPEOF_ST_BLOCKS
637 # undef HAVE_TYPEOF_ST_BLOCKS
638 # define HAVE_TYPEOF_ST_BLOCKS 5
641 # if HAVE_TYPEOF_ST_BLOCKS==1
642 #define F_st_blocks "%hd"
643 # elif HAVE_TYPEOF_ST_BLOCKS==2
644 #define F_st_blocks "%hu"
645 # elif HAVE_TYPEOF_ST_BLOCKS==3
646 #define F_st_blocks "%""d"
647 # elif HAVE_TYPEOF_ST_BLOCKS==4
648 #define F_st_blocks "%u"
649 # elif HAVE_TYPEOF_ST_BLOCKS==5
650 #define F_st_blocks "%ld"
651 # elif HAVE_TYPEOF_ST_BLOCKS==6
652 #define F_st_blocks "%lu"
653 # elif HAVE_TYPEOF_ST_BLOCKS==7
654 #define F_st_blocks "%Ld"
655 # elif HAVE_TYPEOF_ST_BLOCKS==8
656 #define F_st_blocks "%Lu"
658 #error "HAVE_TYPEOF_ST_BLOCKS is out of range:" HAVE_TYPEOF_ST_BLOCKS
662 /* default: long long */
663 #if !defined(HAVE_TYPEOF_ST64_BLOCKS) || !HAVE_TYPEOF_ST64_BLOCKS
664 # undef HAVE_TYPEOF_ST64_BLOCKS
665 # define HAVE_TYPEOF_ST64_BLOCKS 7
667 #ifndef F_st64_blocks
668 # if HAVE_TYPEOF_ST64_BLOCKS==1
669 #define F_st64_blocks "%hd"
670 # elif HAVE_TYPEOF_ST64_BLOCKS==2
671 #define F_st64_blocks "%hu"
672 # elif HAVE_TYPEOF_ST64_BLOCKS==3
673 #define F_st64_blocks "%""d"
674 # elif HAVE_TYPEOF_ST64_BLOCKS==4
675 #define F_st64_blocks "%u"
676 # elif HAVE_TYPEOF_ST64_BLOCKS==5
677 #define F_st64_blocks "%ld"
678 # elif HAVE_TYPEOF_ST64_BLOCKS==6
679 #define F_st64_blocks "%lu"
680 # elif HAVE_TYPEOF_ST64_BLOCKS==7
681 #define F_st64_blocks "%Ld"
682 # elif HAVE_TYPEOF_ST64_BLOCKS==8
683 #define F_st64_blocks "%Lu"
685 #error "HAVE_TYPEOF_ST64_BLOCKS is out of range:" HAVE_TYPEOF_ST64_BLOCKS
690 /* at least for Linux */
691 #define F_tv_sec "%ld"
694 #if !defined(HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC) || !HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
695 # undef HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
696 # define HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC 5
699 # if HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==1
700 #define F_tv_usec "%06hd"
701 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==2
702 #define F_tv_usec "%06hu"
703 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==3
704 #define F_tv_usec "%06d"
705 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==4
706 #define F_tv_usec "%06u"
707 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==5
708 #define F_tv_usec "%06ld"
709 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==6
710 #define F_tv_usec "%06lu"
711 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==7
712 #define F_tv_usec "%06Ld"
713 # elif HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC==8
714 #define F_tv_usec "%06Lu"
716 #error "HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC is out of range:" HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC
721 #if !defined(HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC) || !HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC
722 # undef HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC
723 # define HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC 5
726 # if HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==1
727 #define F_tv_nsec "%09hd"
728 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==2
729 #define F_tv_nsec "%09hu"
730 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==3
731 #define F_tv_nsec "%09d"
732 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==4
733 #define F_tv_nsec "%09u"
734 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==5
735 #define F_tv_nsec "%09ld"
736 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==6
737 #define F_tv_nsec "%09lu"
738 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==7
739 #define F_tv_nsec "%09Ld"
740 # elif HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC==8
741 #define F_tv_nsec "%09Lu"
743 #error "HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC is out of range:" HAVE_TYPEOF_STRUCT_TIMESPEC_TV_NSEC
748 #if !defined(HAVE_TYPEOF_RLIM_MAX) || !HAVE_TYPEOF_RLIM_MAX
749 # undef HAVE_TYPEOF_RLIM_MAX
750 # define HAVE_TYPEOF_RLIM_MAX 5
753 # if HAVE_TYPEOF_RLIM_MAX==1
754 #define F_rlim_max "hd"
755 # elif HAVE_TYPEOF_RLIM_MAX==2
756 #define F_rlim_max "hu"
757 # elif HAVE_TYPEOF_RLIM_MAX==3
758 #define F_rlim_max "d"
759 # elif HAVE_TYPEOF_RLIM_MAX==4
760 #define F_rlim_max "u"
761 # elif HAVE_TYPEOF_RLIM_MAX==5
762 #define F_rlim_max "ld"
763 # elif HAVE_TYPEOF_RLIM_MAX==6
764 #define F_rlim_max "lu"
765 # elif HAVE_TYPEOF_RLIM_MAX==7
766 #define F_rlim_max "Ld"
767 # elif HAVE_TYPEOF_RLIM_MAX==8
768 #define F_rlim_max "Lu"
770 #error "HAVE_TYPEOF_RLIM_MAX is out of range:" HAVE_TYPEOF_RLIM_MAX
774 /* sigset_t printing - not an exact solution yet */
775 #define F_sigset "0x%06lx"
776 typedef unsigned long T_sigset
;
778 /* default: socklen_t */
779 #if !defined(HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN) || !HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
780 # undef HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
781 # define HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN HAVE_BASIC_SOCKLEN_T
784 # if HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==1
785 #define F_cmsg_len "%""hd"
786 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==2
787 #define F_cmsg_len "%""hu"
788 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==3
789 #define F_cmsg_len "%""d"
790 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==4
791 #define F_cmsg_len "%""u"
792 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==5
793 #define F_cmsg_len "%""ld"
794 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==6
795 #define F_cmsg_len "%""lu"
796 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==7
797 #define F_cmsg_len "%""Ld"
798 # elif HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN==8
799 #define F_cmsg_len "%""Lu"
801 #error "HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN is out of range:" HAVE_TYPEOF_STRUCT_CMSGHDR_CMSG_LEN
805 /* basic type of struct timeval tv_usec */
807 # if TYPEOF_STRUCT_TIMEVAL_TV_USEC==1
808 # define F_tv_usec "%hu"
809 # elif TYPEOF_STRUCT_TIMEVAL_TV_USEC==3
810 # define F_tv_usec "%u"
811 # elif TYPEOF_STRUCT_TIMEVAL_TV_USEC==5
812 # define F_tv_usec "%lu"
816 /* Cygwin 1.3.22 has the prototypes, but not the type... */
817 #ifndef HAVE_TYPE_STAT64
822 #ifndef HAVE_TYPE_OFF64
824 # undef HAVE_FTRUNCATE64
827 #if !defined(NETDB_INTERNAL) && defined(h_NETDB_INTERNAL)
828 # define NETDB_INTERNAL h_NETDB_INTERNAL
831 #ifndef INET_ADDRSTRLEN
832 # define INET_ADDRSTRLEN sizeof(struct sockaddr_in)
835 #if !HAVE_PROTOTYPE_HSTRERROR
836 /* with MacOSX this is char * */
837 extern const char *hstrerror(int);
840 #if !HAVE_PROTOTYPE_LIB_strndup
841 extern char *strndup (const char *s
, size_t n
);
844 #endif /* !defined(__compat_h_included) */