1 /* $NetBSD: sys_defs.h,v 1.11 2017/02/20 05:43:12 rin Exp $ */ 2 3 #ifndef _SYS_DEFS_H_INCLUDED_ 4 #define _SYS_DEFS_H_INCLUDED_ 5 6 /*++ 7 /* NAME 8 /* sys_defs 3h 9 /* SUMMARY 10 /* portability header 11 /* SYNOPSIS 12 /* #include <sys_defs.h> 13 /* DESCRIPTION 14 /* .nf 15 16 /* 17 * Specific platforms. Major release numbers differ for a good reason. So be 18 * a good girl, plan for the future, and at least include the major release 19 * number in the system type (for example, SUNOS5 or FREEBSD2). The system 20 * type is determined by the makedefs shell script in the top-level 21 * directory. Adding support for a new system type means updating the 22 * makedefs script, and adding a section below for the new system. 23 */ 24 25 /* 26 * 4.4BSD and close derivatives. 27 */ 28 #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ 29 || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ 30 || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \ 31 || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ 32 || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ 33 || defined(OPENBSD5) || defined(OPENBSD6) \ 34 || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ 35 || defined(NETBSD4) || defined(NETBSD5) || defined(NETBSD6) \ 36 || defined(NETBSD7) \ 37 || defined(EKKOBSD1) || defined(DRAGONFLY) 38 #define SUPPORTED 39 #include <sys/types.h> 40 #include <sys/param.h> 41 #define UINT32_TYPE unsigned int 42 #define UINT16_TYPE unsigned short 43 #define USE_PATHS_H 44 #define HAS_FLOCK_LOCK 45 #define HAS_FCNTL_LOCK 46 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 47 #define DEF_MAILBOX_LOCK "flock, dotlock" 48 #define HAS_SUN_LEN 49 #define HAS_FSYNC 50 #define HAS_DB 51 #define HAS_SA_LEN 52 #define NATIVE_DB_TYPE "hash" 53 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000) 54 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" /* sendmail 8.10 */ 55 #endif 56 #if (defined(OpenBSD) && OpenBSD >= 200006) 57 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" /* OpenBSD 2.7 */ 58 #endif 59 #ifndef ALIAS_DB_MAP 60 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 61 #endif 62 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 63 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" 64 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ > 299000900) 65 #define USE_STATVFS 66 #define STATVFS_IN_SYS_STATVFS_H 67 #else 68 #define USE_STATFS 69 #define STATFS_IN_SYS_MOUNT_H 70 #endif 71 #define HAS_POSIX_REGEXP 72 #define HAS_ST_GEN /* struct stat contains inode 73 * generation number */ 74 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 75 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 76 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 77 #define NATIVE_COMMAND_DIR "/usr/sbin" 78 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 79 #define HAS_DLOPEN 80 #endif 81 82 #ifdef FREEBSD2 83 #define getsid(p) getpgrp() 84 #ifndef CMSG_SPACE 85 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) 86 #endif 87 #ifndef CMSG_LEN 88 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 89 #endif 90 #ifndef CMSG_ALIGN 91 #define CMSG_ALIGN(n) ALIGN(n) 92 #endif 93 #endif /* FREEBSD2 */ 94 95 #ifdef BSDI4 96 /* #define HAS_IPV6 find out interface lookup method */ 97 #endif 98 99 /* __FreeBSD_version version is major+minor */ 100 101 #if __FreeBSD_version >= 220000 102 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" /* introduced 2.1.5 */ 103 #endif 104 105 #if __FreeBSD_version >= 300000 106 #define HAS_ISSETUGID 107 #define HAS_FUTIMES 108 #endif 109 110 #if __FreeBSD_version >= 400000 111 #define SOCKADDR_SIZE socklen_t 112 #define SOCKOPT_SIZE socklen_t 113 #endif 114 115 #if __FreeBSD_version >= 420000 116 #define HAS_DUPLEX_PIPE /* 4.1 breaks with kqueue(2) */ 117 #endif 118 119 #if (__FreeBSD_version >= 702104 && __FreeBSD_version <= 800000) \ 120 || __FreeBSD_version >= 800100 121 #define HAS_CLOSEFROM 122 #endif 123 124 /* OpenBSD version is year+month */ 125 126 #if OpenBSD >= 199805 /* XXX */ 127 #define HAS_FUTIMES /* XXX maybe earlier */ 128 #endif 129 130 #if (defined(OpenBSD) && OpenBSD >= 199608) 131 #define PREFERRED_RAND_SOURCE "dev:/dev/arandom" /* XXX earlier */ 132 #endif 133 134 #if OpenBSD >= 200000 /* XXX */ 135 #define HAS_ISSETUGID 136 #endif 137 138 #if OpenBSD >= 200200 /* XXX */ 139 #define SOCKADDR_SIZE socklen_t 140 #define SOCKOPT_SIZE socklen_t 141 #endif 142 143 #if OpenBSD >= 200405 /* 3.5 */ 144 #define HAS_CLOSEFROM 145 #endif 146 147 /* __NetBSD_Version__ is major+minor */ 148 149 #if __NetBSD_Version__ >= 103000000 /* XXX maybe earlier */ 150 #undef DEF_MAILBOX_LOCK 151 #define DEF_MAILBOX_LOCK "flock, dotlock" 152 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" /* XXX maybe earlier */ 153 #endif 154 155 #if __NetBSD_Version__ >= 105000000 156 #define HAS_ISSETUGID /* XXX maybe earlier */ 157 #endif 158 159 #if __NetBSD_Version__ >= 106000000 /* XXX maybe earlier */ 160 #define SOCKADDR_SIZE socklen_t 161 #define SOCKOPT_SIZE socklen_t 162 #endif 163 164 #if __NetBSD_Version__ >= 299000900 /* 2.99.9 */ 165 #define HAS_CLOSEFROM 166 #endif 167 168 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 102000000) 169 #define HAS_FUTIMES 170 #endif 171 172 #if defined(__DragonFly__) 173 #define HAS_DEV_URANDOM 174 #define HAS_ISSETUGID 175 #define HAS_FUTIMES 176 #define SOCKADDR_SIZE socklen_t 177 #define SOCKOPT_SIZE socklen_t 178 #define HAS_DUPLEX_PIPE 179 #endif 180 181 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \ 182 || (defined(__FreeBSD__) && __FreeBSD__ >= 4) \ 183 || (defined(OpenBSD) && OpenBSD >= 200003) \ 184 || defined(__DragonFly__) \ 185 || defined(USAGI_LIBINET6) 186 #ifndef NO_IPV6 187 #define HAS_IPV6 188 #endif 189 #if !defined(NO_IPV6) || defined(__NetBSD__) 190 #define HAVE_GETIFADDRS 191 #endif 192 #endif 193 194 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \ 195 || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \ 196 || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ \ 197 || defined(__DragonFly__) 198 #define USE_SYSV_POLL 199 #endif 200 201 #ifndef NO_KQUEUE 202 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \ 203 || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \ 204 || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */ \ 205 || defined(__DragonFly__) 206 #define EVENTS_STYLE EVENTS_STYLE_KQUEUE 207 #endif 208 #endif 209 210 #ifndef NO_POSIX_GETPW_R 211 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 510000) \ 212 || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 300000000) \ 213 || (defined(OpenBSD) && OpenBSD >= 200811) /* OpenBSD 4.4 */ 214 #define HAVE_POSIX_GETPW_R 215 #endif 216 #endif 217 218 /* 219 * UNIX on MAC. 220 */ 221 #if defined(RHAPSODY5) || defined(MACOSX) 222 #define SUPPORTED 223 #include <sys/types.h> 224 #define UINT32_TYPE unsigned int 225 #define UINT16_TYPE unsigned short 226 #define USE_PATHS_H 227 #define HAS_FLOCK_LOCK 228 #define HAS_FCNTL_LOCK 229 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 230 #define DEF_MAILBOX_LOCK "flock, dotlock" 231 #define HAS_SUN_LEN 232 #define HAS_FSYNC 233 #define HAS_DB 234 #define HAS_SA_LEN 235 #define NATIVE_DB_TYPE "hash" 236 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 237 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 238 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" 239 #define USE_STATFS 240 #define STATFS_IN_SYS_MOUNT_H 241 #define HAS_POSIX_REGEXP 242 #ifndef NO_NETINFO 243 #define HAS_NETINFO 244 #endif 245 #ifndef NO_IPV6 246 #define HAS_IPV6 247 #define HAVE_GETIFADDRS 248 #endif 249 #define HAS_FUTIMES /* XXX Guessing */ 250 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 251 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 252 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 253 #define NATIVE_COMMAND_DIR "/usr/sbin" 254 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 255 #define SOCKADDR_SIZE socklen_t 256 #define SOCKOPT_SIZE socklen_t 257 #ifndef NO_KQUEUE 258 #define EVENTS_STYLE EVENTS_STYLE_KQUEUE 259 #define USE_SYSV_POLL_THEN_SELECT 260 #endif 261 #define USE_MAX_FILES_PER_PROC 262 #ifndef NO_POSIX_GETPW_R 263 #define HAVE_POSIX_GETPW_R 264 #endif 265 #define HAS_DLOPEN 266 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" 267 #endif 268 269 /* 270 * Ultrix 4.x, a sort of 4.[1-2] BSD system with System V.2 compatibility 271 * and POSIX. 272 */ 273 #ifdef ULTRIX4 274 #define SUPPORTED 275 #define UINT32_TYPE unsigned int 276 #define UINT16_TYPE unsigned short 277 /* Ultrix by default has only 64 descriptors per process */ 278 #ifndef FD_SETSIZE 279 #define FD_SETSIZE 96 280 #endif 281 #include <sys/types.h> 282 #define _PATH_MAILDIR "/var/spool/mail" 283 #define _PATH_BSHELL "/bin/sh" 284 #define _PATH_DEFPATH "/bin:/usr/bin:/usr/ucb" 285 #define _PATH_STDPATH "/bin:/usr/bin:/usr/etc:/usr/ucb" 286 #define HAS_FLOCK_LOCK 287 #define HAS_FCNTL_LOCK 288 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 289 #define DEF_MAILBOX_LOCK "flock, dotlock" 290 #define HAS_FSYNC 291 /* might be set by makedef */ 292 #ifdef HAS_DB 293 #define NATIVE_DB_TYPE "hash" 294 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 295 #else 296 #define HAS_DBM 297 #define NATIVE_DB_TYPE "dbm" 298 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 299 #endif 300 extern int optind; 301 extern char *optarg; 302 extern int opterr; 303 extern int h_errno; 304 305 #define MISSING_STRFTIME_E 306 #ifndef NO_NIS 307 #define HAS_NIS 308 #endif 309 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 310 #define ROOT_PATH "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb" 311 #define USE_STATFS 312 #define USE_STRUCT_FS_DATA 313 #define STATFS_IN_SYS_MOUNT_H 314 /* Ultrix misses just S_ISSOCK, the others are there */ 315 #define S_ISSOCK(mode) (((mode) & (S_IFMT)) == (S_IFSOCK)) 316 #define DUP2_DUPS_CLOSE_ON_EXEC 317 #define MISSING_USLEEP 318 #define NO_HERRNO 319 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail" 320 #define NATIVE_COMMAND_DIR "/usr/etc" 321 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 322 #endif 323 324 /* 325 * OSF, then Digital UNIX, then Compaq. A BSD-flavored hybrid. 326 */ 327 #ifdef OSF1 328 #define SUPPORTED 329 #include <sys/types.h> 330 #define UINT32_TYPE unsigned int 331 #define UINT16_TYPE unsigned short 332 #define MISSING_SETENV 333 #define USE_PATHS_H 334 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 335 #define HAS_FLOCK_LOCK 336 #define HAS_FCNTL_LOCK 337 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 338 #define DEF_MAILBOX_LOCK "flock, dotlock" 339 #define HAS_FSYNC 340 #define HAVE_BASENAME 341 #define HAS_DBM 342 #define NATIVE_DB_TYPE "dbm" 343 #define ALIAS_DB_MAP DEF_DB_TYPE ":/var/adm/sendmail/aliases" 344 extern int optind; /* XXX use <getopt.h> */ 345 extern char *optarg; /* XXX use <getopt.h> */ 346 extern int opterr; /* XXX use <getopt.h> */ 347 348 #ifndef NO_NIS 349 #define HAS_NIS 350 #endif 351 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 352 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 353 #define USE_STATFS 354 #define STATFS_IN_SYS_MOUNT_H 355 #define HAS_POSIX_REGEXP 356 #define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE 357 #define NO_MSGHDR_MSG_CONTROL 358 #ifndef NO_IPV6 359 #define HAS_IPV6 360 #endif 361 362 #endif 363 364 /* 365 * SunOS 4.x, a mostly 4.[2-3] BSD system with System V.2 compatibility and 366 * POSIX support. 367 */ 368 #ifdef SUNOS4 369 #define SUPPORTED 370 #include <sys/types.h> 371 #include <memory.h> 372 #define UINT32_TYPE unsigned int 373 #define UINT16_TYPE unsigned short 374 #define UNSAFE_CTYPE 375 #define fpos_t long 376 #define MISSING_SETENV 377 #define MISSING_STRERROR 378 #define MISSING_STRTOUL 379 #define _PATH_MAILDIR "/var/spool/mail" 380 #define _PATH_BSHELL "/bin/sh" 381 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 382 #define _PATH_STDPATH "/usr/bin:/usr/etc:/usr/ucb" 383 #define HAS_FLOCK_LOCK 384 #define HAS_FCNTL_LOCK 385 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 386 #define DEF_MAILBOX_LOCK "flock, dotlock" 387 #define HAS_FSYNC 388 #define HAS_DBM 389 #define NATIVE_DB_TYPE "dbm" 390 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 391 extern int optind; 392 extern char *optarg; 393 extern int opterr; 394 395 #ifndef NO_NIS 396 #define HAS_NIS 397 #endif 398 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 399 #define ROOT_PATH "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb" 400 #define USE_STATFS 401 #define STATFS_IN_SYS_VFS_H 402 #define memmove(d,s,l) bcopy(s,d,l) 403 #define NO_HERRNO 404 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail" 405 #define NATIVE_MAILQ_PATH "/usr/ucb/mailq" 406 #define NATIVE_NEWALIAS_PATH "/usr/ucb/newaliases" 407 #define NATIVE_COMMAND_DIR "/usr/etc" 408 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 409 #define STRCASECMP_IN_STRINGS_H 410 #define OCTAL_TO_UNSIGNED(res, str) sscanf((str), "%o", &(res)) 411 #define size_t unsigned 412 #define ssize_t int 413 #define getsid getpgrp 414 #endif 415 416 /* 417 * SunOS 5.x, mostly System V Release 4. 418 */ 419 #ifdef SUNOS5 420 #define SUPPORTED 421 #define _SVID_GETTOD /* Solaris 2.5, XSH4.2 versus SVID */ 422 #include <sys/types.h> 423 #define UINT32_TYPE unsigned int 424 #define UINT16_TYPE unsigned short 425 #define MISSING_SETENV 426 #define _PATH_MAILDIR "/var/mail" 427 #define _PATH_BSHELL "/bin/sh" 428 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 429 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 430 #define HAS_FCNTL_LOCK 431 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 432 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 433 #define HAS_FSYNC 434 #define HAS_DBM 435 #define NATIVE_DB_TYPE "dbm" 436 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 437 #ifndef NO_NIS 438 #define HAS_NIS 439 #ifndef NO_NISPLUS 440 #define HAS_NISPLUS 441 #endif /* NO_NISPLUS */ 442 #endif 443 #define USE_SYS_SOCKIO_H /* Solaris 2.5, changed sys/ioctl.h */ 444 #define GETTIMEOFDAY(t) gettimeofday(t) 445 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 446 #define FIONREAD_IN_SYS_FILIO_H 447 #define USE_STATVFS 448 #define STATVFS_IN_SYS_STATVFS_H 449 #define INT_MAX_IN_LIMITS_H 450 #ifdef STREAM_CONNECTIONS /* avoid UNIX-domain sockets */ 451 #define LOCAL_LISTEN stream_listen 452 #define LOCAL_ACCEPT stream_accept 453 #define LOCAL_CONNECT stream_connect 454 #define LOCAL_TRIGGER stream_trigger 455 #define LOCAL_SEND_FD stream_send_fd 456 #define LOCAL_RECV_FD stream_recv_fd 457 #endif 458 #define HAS_VOLATILE_LOCKS 459 #define BROKEN_READ_SELECT_ON_TCP_SOCKET 460 #define CANT_WRITE_BEFORE_SENDING_FD 461 #ifndef NO_POSIX_REGEXP 462 #define HAS_POSIX_REGEXP 463 #endif 464 #ifndef NO_IPV6 465 #define HAS_IPV6 466 #define HAS_SIOCGLIF 467 #endif 468 #ifndef NO_CLOSEFROM 469 #define HAS_CLOSEFROM 470 #endif 471 #ifndef NO_DEV_URANDOM 472 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" 473 #endif 474 #ifndef NO_FUTIMESAT 475 #define HAS_FUTIMESAT 476 #endif 477 #define USE_SYSV_POLL 478 #ifndef NO_DEVPOLL 479 #define EVENTS_STYLE EVENTS_STYLE_DEVPOLL 480 #endif 481 #ifndef NO_POSIX_GETPW_R 482 #define HAVE_POSIX_GETPW_R 483 #define GETPW_R_NEEDS_POSIX_PTHREAD_SEMANTICS 484 #endif 485 486 /* 487 * Allow build environment to override paths. 488 */ 489 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail" 490 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 491 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 492 #define NATIVE_COMMAND_DIR "/usr/sbin" 493 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 494 495 #define HAS_DLOPEN 496 #endif 497 498 /* 499 * UnixWare, System Release 4. 500 */ 501 #ifdef UW7 /* UnixWare 7 */ 502 #define SUPPORTED 503 #include <sys/types.h> 504 #define UINT32_TYPE unsigned int 505 #define UINT16_TYPE unsigned short 506 #define _PATH_MAILDIR "/var/mail" 507 #define _PATH_BSHELL "/bin/sh" 508 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 509 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 510 #define MISSING_SETENV 511 #define HAS_FCNTL_LOCK 512 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 513 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 514 #define HAS_FSYNC 515 #define HAS_DBM 516 #define NATIVE_DB_TYPE "dbm" 517 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 518 #ifndef NO_NIS 519 #define HAS_NIS 520 #endif 521 #define USE_SYS_SOCKIO_H 522 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 523 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 524 #define FIONREAD_IN_SYS_FILIO_H 525 #define DBM_NO_TRAILING_NULL 526 #define USE_STATVFS 527 #define STATVFS_IN_SYS_STATVFS_H 528 #define STRCASECMP_IN_STRINGS_H 529 #define SET_H_ERRNO(err) (set_h_errno(err)) 530 #endif 531 532 #ifdef UW21 /* UnixWare 2.1.x */ 533 #define SUPPORTED 534 #include <sys/types.h> 535 #define UINT32_TYPE unsigned int 536 #define UINT16_TYPE unsigned short 537 #define _PATH_MAILDIR "/var/mail" 538 #define _PATH_BSHELL "/bin/sh" 539 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 540 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 541 #define MISSING_SETENV 542 #define HAS_FCNTL_LOCK 543 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 544 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 545 #define HAS_FSYNC 546 #define HAS_DBM 547 #define NATIVE_DB_TYPE "dbm" 548 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 549 #ifndef NO_NIS 550 #define HAS_NIS */ 551 #endif 552 #define USE_SYS_SOCKIO_H 553 #define GETTIMEOFDAY(t) gettimeofday(t,NULL) 554 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 555 #define FIONREAD_IN_SYS_FILIO_H 556 #define DBM_NO_TRAILING_NULL 557 #define USE_STATVFS 558 #define STATVFS_IN_SYS_STATVFS_H 559 #endif 560 561 /* 562 * AIX: a SYSV-flavored hybrid. NB: fcntl() and flock() access the same 563 * underlying locking primitives. 564 */ 565 #if defined(AIX5) || defined(AIX6) 566 #define SUPPORTED 567 #include <sys/types.h> 568 #define UINT32_TYPE unsigned int 569 #define UINT16_TYPE unsigned short 570 #define MISSING_SETENV 571 #define USE_PATHS_H 572 #ifndef _PATH_BSHELL 573 #define _PATH_BSHELL "/bin/sh" 574 #endif 575 #ifndef _PATH_MAILDIR 576 #define _PATH_MAILDIR "/var/spool/mail" /* paths.h lies */ 577 #endif 578 #ifndef _PATH_DEFPATH 579 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 580 #endif 581 #ifndef _PATH_STDPATH 582 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 583 #endif 584 #define HAS_FCNTL_LOCK 585 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 586 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 587 #define USE_SYS_SELECT_H 588 #define HAS_FSYNC 589 #define HAS_DBM 590 #define NATIVE_DB_TYPE "dbm" 591 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 592 #ifndef NO_NIS 593 #define HAS_NIS 594 #endif 595 #define HAS_SA_LEN 596 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 597 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 598 #define SOCKADDR_SIZE socklen_t 599 #define SOCKOPT_SIZE socklen_t 600 #define USE_STATVFS 601 #define STATVFS_IN_SYS_STATVFS_H 602 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 603 #define NATIVE_MAILQ_PATH "/usr/sbin/mailq" 604 #define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases" 605 #define NATIVE_COMMAND_DIR "/usr/sbin" 606 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 607 608 /* 609 * XXX Need CMSG_SPACE() and CMSG_LEN() but don't want to drag in everything 610 * that comes with _LINUX_SOURCE_COMPAT. 611 */ 612 #include <sys/socket.h> 613 #ifndef CMSG_SPACE 614 #define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len)) 615 #endif 616 #ifndef CMSG_LEN 617 #define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 618 #endif 619 #ifndef NO_IPV6 620 #define HAS_IPV6 621 #endif 622 #define BROKEN_AI_PASSIVE_NULL_HOST 623 #define BROKEN_AI_NULL_SERVICE 624 #define USE_SYSV_POLL 625 #define MYMALLOC_FUZZ 1 626 #endif 627 628 #ifdef AIX4 629 #define SUPPORTED 630 #include <sys/types.h> 631 #define UINT32_TYPE unsigned int 632 #define UINT16_TYPE unsigned short 633 #define MISSING_SETENV 634 #define _PATH_BSHELL "/bin/sh" 635 #define _PATH_MAILDIR "/var/spool/mail" /* paths.h lies */ 636 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 637 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 638 #define HAS_FCNTL_LOCK 639 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 640 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 641 #define USE_SYS_SELECT_H 642 #define HAS_FSYNC 643 #define HAS_DBM 644 #define NATIVE_DB_TYPE "dbm" 645 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 646 #ifndef NO_NIS 647 #define HAS_NIS 648 #endif 649 #define HAS_SA_LEN 650 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 651 #define RESOLVE_H_NEEDS_STDIO_H 652 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 653 #define SOCKADDR_SIZE size_t 654 #define SOCKOPT_SIZE size_t 655 #define USE_STATVFS 656 #define STATVFS_IN_SYS_STATVFS_H 657 #define STRCASECMP_IN_STRINGS_H 658 #if 0 659 extern time_t time(time_t *); 660 extern int seteuid(uid_t); 661 extern int setegid(gid_t); 662 extern int initgroups(const char *, int); 663 664 #endif 665 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail" 666 #define NATIVE_MAILQ_PATH "/usr/sbin/mailq" 667 #define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases" 668 #define NATIVE_COMMAND_DIR "/usr/sbin" 669 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 670 671 #define CANT_USE_SEND_RECV_MSG 672 #endif 673 674 #ifdef AIX3 675 #define SUPPORTED 676 #include <sys/types.h> 677 #define UINT32_TYPE unsigned int 678 #define UINT16_TYPE unsigned short 679 #define MISSING_SETENV 680 #define _PATH_BSHELL "/bin/sh" 681 #define _PATH_MAILDIR "/var/spool/mail" /* paths.h lies */ 682 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 683 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 684 #define HAS_FCNTL_LOCK 685 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 686 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 687 #define USE_SYS_SELECT_H 688 #define HAS_FSYNC 689 #define HAS_DBM 690 #define NATIVE_DB_TYPE "dbm" 691 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 692 #ifndef NO_NIS 693 #define HAS_NIS 694 #endif 695 #define HAS_SA_LEN 696 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 697 #define RESOLVE_H_NEEDS_STDIO_H 698 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 699 #define SOCKADDR_SIZE size_t 700 #define SOCKOPT_SIZE size_t 701 #define USE_STATFS 702 #define STATFS_IN_SYS_STATFS_H 703 #define STRCASECMP_IN_STRINGS_H 704 extern time_t time(time_t *); 705 extern int seteuid(uid_t); 706 extern int setegid(gid_t); 707 extern int initgroups(const char *, int); 708 709 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail" 710 711 #define CANT_USE_SEND_RECV_MSG 712 #endif 713 714 /* 715 * IRIX, a mix of System V Releases. 716 */ 717 #if defined(IRIX5) || defined(IRIX6) 718 #define SUPPORTED 719 #include <sys/types.h> 720 #define UINT32_TYPE unsigned int 721 #define UINT16_TYPE unsigned short 722 #define MISSING_SETENV 723 #define _PATH_MAILDIR "/var/mail" 724 #define _PATH_BSHELL "/bin/sh" 725 #define _PATH_DEFPATH "/usr/bin:/usr/bsd" 726 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/bsd" 727 #define HAS_FCNTL_LOCK 728 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 729 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 730 #define HAS_FSYNC 731 #define HAS_DBM 732 #define NATIVE_DB_TYPE "dbm" 733 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 734 #ifndef NO_NIS 735 #define HAS_NIS 736 #endif 737 #define USE_SYS_SOCKIO_H /* XXX check */ 738 #define GETTIMEOFDAY(t) gettimeofday(t) 739 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/bsd" 740 #define FIONREAD_IN_SYS_FILIO_H /* XXX check */ 741 #define DBM_NO_TRAILING_NULL /* XXX check */ 742 #define USE_STATVFS 743 #define STATVFS_IN_SYS_STATVFS_H 744 #define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE 745 #define CANT_USE_SEND_RECV_MSG 746 #endif 747 748 #if defined(IRIX5) 749 #define MISSING_USLEEP 750 #endif 751 752 #if defined(IRIX6) 753 #ifndef NO_IPV6 754 #define HAS_IPV6 755 #endif 756 #define HAS_POSIX_REGEXP 757 #define PIPES_CANT_FIONREAD 758 #endif 759 760 /* 761 * LINUX. 762 */ 763 #if defined(LINUX2) || defined(LINUX3) || defined(LINUX4) 764 #define SUPPORTED 765 #include <sys/types.h> 766 #define UINT32_TYPE unsigned int 767 #define UINT16_TYPE unsigned short 768 #include <features.h> 769 #define USE_PATHS_H 770 #define HAS_FLOCK_LOCK 771 #define HAS_FCNTL_LOCK 772 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 773 #define DEF_MAILBOX_LOCK "fcntl, dotlock" /* RedHat >= 4.x */ 774 #define HAS_FSYNC 775 #define HAS_DB 776 #define NATIVE_DB_TYPE "hash" 777 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 778 #ifndef NO_NIS 779 #define HAS_NIS 780 #endif 781 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 782 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" 783 #define FIONREAD_IN_TERMIOS_H 784 #define USE_STATFS 785 #define STATFS_IN_SYS_VFS_H 786 #define PREPEND_PLUS_TO_OPTSTRING 787 #define HAS_POSIX_REGEXP 788 #define HAS_DLOPEN 789 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 790 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 791 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 792 #define NATIVE_COMMAND_DIR "/usr/sbin" 793 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 794 #ifdef __GLIBC_PREREQ 795 #define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) __GLIBC_PREREQ(maj, min) 796 #else 797 #define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) \ 798 ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) 799 #endif 800 #if HAVE_GLIBC_API_VERSION_SUPPORT(2, 1) 801 #define SOCKADDR_SIZE socklen_t 802 #define SOCKOPT_SIZE socklen_t 803 #endif 804 #ifndef NO_IPV6 805 #define HAS_IPV6 806 #if HAVE_GLIBC_API_VERSION_SUPPORT(2, 4) 807 /* Really 2.3.3 or later, but there's no __GLIBC_MICRO version macro. */ 808 #define HAVE_GETIFADDRS 809 #else 810 #define HAS_PROCNET_IFINET6 811 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6" 812 #endif 813 #endif 814 #include <linux/version.h> 815 #if !defined(KERNEL_VERSION) 816 #define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1) 817 #endif 818 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \ 819 || (__GLIBC__ < 2) 820 #define CANT_USE_SEND_RECV_MSG 821 #define DEF_SMTP_CACHE_DEMAND 0 822 #else 823 #define CANT_WRITE_BEFORE_SENDING_FD 824 #endif 825 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" /* introduced in 1.1 */ 826 #ifndef NO_EPOLL 827 #define EVENTS_STYLE EVENTS_STYLE_EPOLL /* introduced in 2.5 */ 828 #endif 829 #define USE_SYSV_POLL 830 #ifndef NO_POSIX_GETPW_R 831 #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1) \ 832 || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 1) \ 833 || (defined(_BSD_SOURCE) && _BSD_SOURCE >= 1) \ 834 || (defined(_SVID_SOURCE) && _SVID_SOURCE >= 1) \ 835 || (defined(_POSIX_SOURCE) && _POSIX_SOURCE >= 1) 836 #define HAVE_POSIX_GETPW_R 837 #endif 838 #endif 839 840 #endif 841 842 #ifdef LINUX1 843 #define SUPPORTED 844 #include <sys/types.h> 845 #define UINT32_TYPE unsigned int 846 #define UINT16_TYPE unsigned short 847 #define USE_PATHS_H 848 #define HAS_FLOCK_LOCK 849 #define HAS_FCNTL_LOCK 850 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 851 #define DEF_MAILBOX_LOCK "dotlock" /* verified RedHat 3.03 */ 852 #define HAS_FSYNC 853 #define HAS_DB 854 #define NATIVE_DB_TYPE "hash" 855 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 856 #ifndef NO_NIS 857 #define HAS_NIS 858 #endif 859 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 860 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" 861 #define FIONREAD_IN_TERMIOS_H /* maybe unnecessary */ 862 #define USE_STATFS 863 #define STATFS_IN_SYS_VFS_H 864 #define PREPEND_PLUS_TO_OPTSTRING 865 #define HAS_POSIX_REGEXP 866 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 867 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 868 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 869 #define NATIVE_COMMAND_DIR "/usr/sbin" 870 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 871 #define CANT_USE_SEND_RECV_MSG 872 #define DEF_SMTP_CACHE_DEMAND 0 873 #endif 874 875 /* 876 * GNU. 877 */ 878 #ifdef GNU0 879 #define SUPPORTED 880 #include <sys/types.h> 881 #include <features.h> 882 #define USE_PATHS_H 883 #define HAS_FCNTL_LOCK 884 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 885 #define DEF_MAILBOX_LOCK "fcntl, dotlock" /* RedHat >= 4.x */ 886 #define HAS_FSYNC 887 #define HAS_DB 888 #define NATIVE_DB_TYPE "hash" 889 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 890 #ifndef NO_NIS 891 #define HAS_NIS 892 #endif 893 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 894 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" 895 #define FIONREAD_IN_TERMIOS_H 896 #define USE_STATFS 897 #define STATFS_IN_SYS_VFS_H 898 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT 899 #define PREPEND_PLUS_TO_OPTSTRING 900 #define HAS_POSIX_REGEXP 901 #define HAS_DLOPEN 902 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 903 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 904 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 905 #define NATIVE_COMMAND_DIR "/usr/sbin" 906 #ifdef DEBIAN 907 #define NATIVE_DAEMON_DIR "/usr/lib/postfix" 908 #ifndef DEF_MANPAGE_DIR 909 #define DEF_MANPAGE_DIR "/usr/share/man" 910 #endif 911 #ifndef DEF_SAMPLE_DIR 912 #define DEF_SAMPLE_DIR "/usr/share/doc/postfix/examples" 913 #endif 914 #ifndef DEF_README_DIR 915 #define DEF_README_DIR "/usr/share/doc/postfix" 916 #endif 917 #else 918 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 919 #endif 920 #define SOCKADDR_SIZE socklen_t 921 #define SOCKOPT_SIZE socklen_t 922 #ifdef __FreeBSD_kernel__ 923 #define HAS_DUPLEX_PIPE 924 #define HAS_ISSETUGID 925 #endif 926 #ifndef NO_IPV6 927 #define HAS_IPV6 928 #ifdef __FreeBSD_kernel__ 929 #define HAVE_GETIFADDRS 930 #else 931 #define HAS_PROCNET_IFINET6 932 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6" 933 #endif 934 #endif 935 #define CANT_USE_SEND_RECV_MSG 936 #define DEF_SMTP_CACHE_DEMAND 0 937 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" 938 #endif 939 940 /* 941 * HPUX11 was copied from HPUX10, but can perhaps be trimmed down a bit. 942 */ 943 #ifdef HPUX11 944 #define SUPPORTED 945 #define USE_SIG_RETURN 946 #include <sys/types.h> 947 #define UINT32_TYPE unsigned int 948 #define UINT16_TYPE unsigned short 949 #define HAS_DBM 950 #define HAS_FCNTL_LOCK 951 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 952 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 953 #define HAS_FSYNC 954 #define NATIVE_DB_TYPE "dbm" 955 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 956 #define ROOT_PATH "/usr/bin:/sbin:/usr/sbin" 957 #define MISSING_SETENV 958 #ifndef NO_NIS 959 #define HAS_NIS 960 #endif 961 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 962 #define _PATH_BSHELL "/bin/sh" 963 #define _PATH_MAILDIR "/var/mail" 964 #define _PATH_DEFPATH "/usr/bin" 965 #define _PATH_STDPATH "/usr/bin:/sbin:/usr/sbin" 966 #define MISSING_SETEUID 967 #define HAVE_SETRESUID 968 #define MISSING_SETEGID 969 #define HAVE_SETRESGID 970 extern int h_errno; /* <netdb.h> imports too much stuff */ 971 972 #define USE_STATFS 973 #define STATFS_IN_SYS_VFS_H 974 #define HAS_POSIX_REGEXP 975 #define HAS_DLOPEN 976 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 977 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 978 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 979 #define NATIVE_COMMAND_DIR "/usr/sbin" 980 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 981 #endif 982 983 #ifdef HPUX10 984 #define SUPPORTED 985 #define USE_SIG_RETURN 986 #include <sys/types.h> 987 #define UINT32_TYPE unsigned int 988 #define UINT16_TYPE unsigned short 989 #define HAS_DBM 990 #define HAS_FCNTL_LOCK 991 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 992 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 993 #define HAS_FSYNC 994 #define NATIVE_DB_TYPE "dbm" 995 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 996 #define ROOT_PATH "/usr/bin:/sbin:/usr/sbin" 997 #define MISSING_SETENV 998 #ifndef NO_NIS 999 #define HAS_NIS 1000 #endif 1001 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 1002 #define _PATH_BSHELL "/bin/sh" 1003 #define _PATH_MAILDIR "/var/mail" 1004 #define _PATH_DEFPATH "/usr/bin" 1005 #define _PATH_STDPATH "/usr/bin:/sbin:/usr/sbin" 1006 #define MISSING_SETEUID 1007 #define HAVE_SETRESUID 1008 #define MISSING_SETEGID 1009 #define HAVE_SETRESGID 1010 extern int h_errno; /* <netdb.h> imports too much stuff */ 1011 1012 #define USE_STATFS 1013 #define STATFS_IN_SYS_VFS_H 1014 #define HAS_POSIX_REGEXP 1015 #define HAS_SHL_LOAD 1016 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" 1017 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 1018 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 1019 #define NATIVE_COMMAND_DIR "/usr/sbin" 1020 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 1021 #endif 1022 1023 #ifdef HPUX9 1024 #define SUPPORTED 1025 #define USE_SIG_RETURN 1026 #include <sys/types.h> 1027 #define UINT32_TYPE unsigned int 1028 #define UINT16_TYPE unsigned short 1029 #define HAS_DBM 1030 #define HAS_FCNTL_LOCK 1031 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 1032 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 1033 #define HAS_FSYNC 1034 #ifndef NO_NIS 1035 #define HAS_NIS 1036 #endif 1037 #define MISSING_SETENV 1038 #define MISSING_RLIMIT_FSIZE 1039 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 1040 #define NATIVE_DB_TYPE "dbm" 1041 #define ALIAS_DB_MAP DEF_DB_TYPE ":/usr/lib/aliases" 1042 #define ROOT_PATH "/bin:/usr/bin:/etc" 1043 #define _PATH_BSHELL "/bin/sh" 1044 #define _PATH_MAILDIR "/usr/mail" 1045 #define _PATH_DEFPATH "/bin:/usr/bin" 1046 #define _PATH_STDPATH "/bin:/usr/bin:/etc" 1047 #define MISSING_SETEUID 1048 #define HAVE_SETRESUID 1049 #define MISSING_SETEGID 1050 #define HAVE_SETRESGID 1051 extern int h_errno; 1052 1053 #define USE_ULIMIT /* no setrlimit() */ 1054 #define USE_STATFS 1055 #define STATFS_IN_SYS_VFS_H 1056 #define HAS_POSIX_REGEXP 1057 #define HAS_SHL_LOAD 1058 #define NATIVE_SENDMAIL_PATH "/usr/bin/sendmail" 1059 #define NATIVE_MAILQ_PATH "/usr/bin/mailq" 1060 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" 1061 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix" 1062 #endif 1063 1064 /* 1065 * NEXTSTEP3, without -lposix, because its naming service is broken. 1066 */ 1067 #ifdef NEXTSTEP3 1068 #define SUPPORTED 1069 #include <sys/types.h> 1070 #define UINT32_TYPE unsigned int 1071 #define UINT16_TYPE unsigned short 1072 #define HAS_DBM 1073 #define HAS_FLOCK_LOCK 1074 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 1075 #define DEF_MAILBOX_LOCK "flock, dotlock" 1076 #define USE_STATFS 1077 #define HAVE_SYS_DIR_H 1078 #define STATFS_IN_SYS_VFS_H 1079 #define HAS_FSYNC 1080 #ifndef NO_NIS 1081 #define HAS_NIS 1082 #endif 1083 #define HAS_NETINFO 1084 #define MISSING_SETENV_PUTENV 1085 #define MISSING_MKFIFO 1086 #define MISSING_SIGSET_T 1087 #define MISSING_SIGACTION 1088 #define MISSING_STD_FILENOS 1089 #define MISSING_SETSID 1090 #define MISSING_WAITPID 1091 #define MISSING_UTIMBUF 1092 #define HAS_WAIT4 1093 #define WAIT_STATUS_T union wait 1094 #define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x)) 1095 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 1096 #define _PATH_MAILDIR "/usr/spool/mail" 1097 #define _PATH_BSHELL "/bin/sh" 1098 #define _PATH_DEFPATH "/bin:/usr/bin:/usr/ucb" 1099 #define _PATH_STDPATH "/bin:/usr/bin:/usr/ucb" 1100 #define ROOT_PATH "/bin:/usr/bin:/usr/etc:/usr/ucb" 1101 #define NATIVE_DB_TYPE "dbm" 1102 #define ALIAS_DB_MAP "netinfo:/aliases" 1103 #include <libc.h> 1104 #define MISSING_POSIX_S_IS 1105 #define MISSING_POSIX_S_MODES 1106 /* It's amazing what is all missing... */ 1107 #define isascii(c) ((unsigned)(c)<=0177) 1108 extern int opterr; 1109 typedef unsigned short mode_t; 1110 1111 #define MISSING_PID_T 1112 #define MISSING_STRFTIME_E 1113 #define FD_CLOEXEC 1 1114 #define O_NONBLOCK O_NDELAY 1115 #define WEXITSTATUS(x) ((x).w_retcode) 1116 #define WTERMSIG(x) ((x).w_termsig) 1117 #endif 1118 1119 /* 1120 * OPENSTEP does not have posix (some fix...) 1121 */ 1122 #ifdef OPENSTEP4 1123 #define SUPPORTED 1124 #include <sys/types.h> 1125 #define UINT32_TYPE unsigned int 1126 #define UINT16_TYPE unsigned short 1127 #define HAS_DBM 1128 #define HAS_FLOCK_LOCK 1129 #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK 1130 #define DEF_MAILBOX_LOCK "flock, dotlock" 1131 #define USE_STATFS 1132 #define HAVE_SYS_DIR_H 1133 #define STATFS_IN_SYS_VFS_H 1134 #define HAS_FSYNC 1135 #ifndef NO_NIS 1136 #define HAS_NIS 1137 #endif 1138 #define HAS_NETINFO 1139 #define MISSING_SETENV_PUTENV 1140 #define MISSING_MKFIFO 1141 #define MISSING_SIGSET_T 1142 #define MISSING_SIGACTION 1143 #define MISSING_STD_FILENOS 1144 #define MISSING_SETSID 1145 #define MISSING_WAITPID 1146 #define MISSING_UTIMBUF 1147 #define HAS_WAIT4 1148 #define WAIT_STATUS_T union wait 1149 #define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x)) 1150 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 1151 #define _PATH_MAILDIR "/usr/spool/mail" 1152 #define _PATH_BSHELL "/bin/sh" 1153 #define _PATH_DEFPATH "/bin:/usr/bin:/usr/ucb" 1154 #define _PATH_STDPATH "/bin:/usr/bin:/usr/ucb" 1155 #define ROOT_PATH "/bin:/usr/bin:/usr/etc:/usr/ucb" 1156 #define NATIVE_DB_TYPE "dbm" 1157 #define ALIAS_DB_MAP "netinfo:/aliases" 1158 #include <libc.h> 1159 #define MISSING_POSIX_S_IS 1160 #define MISSING_POSIX_S_MODES 1161 /* It's amazing what is all missing... */ 1162 #define isascii(c) ((unsigned)(c)<=0177) 1163 extern int opterr; 1164 typedef unsigned short mode_t; 1165 1166 #define MISSING_PID_T 1167 #define MISSING_STRFTIME_E 1168 #define FD_CLOEXEC 1 1169 #define O_NONBLOCK O_NDELAY 1170 #define WEXITSTATUS(x) ((x).w_retcode) 1171 #define WTERMSIG(x) ((x).w_termsig) 1172 #endif 1173 1174 #ifdef ReliantUnix543 1175 #define SUPPORTED 1176 #include <sys/types.h> 1177 #define UINT32_TYPE unsigned int 1178 #define UINT16_TYPE unsigned short 1179 #define MISSING_SETENV 1180 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 1181 #define _PATH_BSHELL "/bin/sh" 1182 #define _PATH_MAILDIR "/var/spool/mail" 1183 #define HAS_FCNTL_LOCK 1184 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 1185 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 1186 #define HAS_FSYNC 1187 #define FIONREAD_IN_SYS_FILIO_H 1188 #define USE_SYS_SOCKIO_H 1189 #define HAS_DBM 1190 #define NATIVE_DB_TYPE "dbm" 1191 #define ALIAS_DB_MAP DEF_DB_TYPE ":/var/adm/sendmail/aliases" 1192 extern int optind; /* XXX use <getopt.h> */ 1193 extern char *optarg; /* XXX use <getopt.h> */ 1194 extern int opterr; /* XXX use <getopt.h> */ 1195 1196 #ifndef NO_NIS 1197 #define HAS_NIS 1198 #endif 1199 #define GETTIMEOFDAY(t) gettimeofday(t) 1200 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 1201 #define USE_STATVFS 1202 #define STATVFS_IN_SYS_STATVFS_H 1203 #define MISSING_USLEEP 1204 #endif 1205 1206 #ifdef DCOSX1 /* Siemens Pyramid */ 1207 #define SUPPORTED 1208 #include <sys/types.h> 1209 #define UINT32_TYPE unsigned int 1210 #define UINT16_TYPE unsigned short 1211 #define _PATH_MAILDIR "/var/mail" 1212 #define _PATH_BSHELL "/bin/sh" 1213 #define _PATH_DEFPATH "/usr/bin:/usr/ucb" 1214 #define _PATH_STDPATH "/usr/bin:/usr/sbin:/usr/ucb" 1215 #define MISSING_SETENV 1216 #define HAS_FCNTL_LOCK 1217 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 1218 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 1219 #define HAS_FSYNC 1220 #define NATIVE_DB_TYPE "hash" 1221 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/aliases" 1222 /* Uncomment the following line if you have NIS package installed */ 1223 /* #define HAS_NIS */ 1224 #define USE_SYS_SOCKIO_H 1225 #define GETTIMEOFDAY(t) gettimeofday(t,NULL) 1226 #define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb" 1227 #define FIONREAD_IN_SYS_FILIO_H 1228 #define DBM_NO_TRAILING_NULL 1229 #define USE_STATVFS 1230 #define STATVFS_IN_SYS_STATVFS_H 1231 #ifndef S_ISSOCK 1232 #define S_ISSOCK(mode) ((mode&0xF000) == 0xC000) 1233 #endif 1234 #endif 1235 1236 #ifdef SCO5 1237 #define SUPPORTED 1238 #include <sys/types.h> 1239 #include <sys/socket.h> 1240 extern int h_errno; 1241 1242 #define UINT32_TYPE unsigned int 1243 #define UINT16_TYPE unsigned short 1244 #define _PATH_MAILDIR "/usr/spool/mail" 1245 #define _PATH_BSHELL "/bin/sh" 1246 #define _PATH_DEFPATH "/bin:/usr/bin" 1247 #define USE_PATHS_H 1248 #define HAS_FCNTL_LOCK 1249 #define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL 1250 #define DEF_MAILBOX_LOCK "fcntl, dotlock" 1251 #define HAS_FSYNC 1252 #define HAS_DBM 1253 #define NATIVE_DB_TYPE "dbm" 1254 #define ALIAS_DB_MAP DEF_DB_TYPE ":/etc/mail/aliases" 1255 #define DBM_NO_TRAILING_NULL 1256 #ifndef NO_NIS 1257 #define HAS_NIS 1258 #endif 1259 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0) 1260 #define ROOT_PATH "/bin:/etc:/usr/bin:/tcb/bin" 1261 #define USE_STATVFS 1262 #define STATVFS_IN_SYS_STATVFS_H 1263 #define MISSING_SETENV 1264 #define STRCASECMP_IN_STRINGS_H 1265 /* SCO5 misses just S_ISSOCK, the others are there 1266 * Use C_ISSOCK definition from cpio.h. 1267 */ 1268 #include <cpio.h> 1269 #define S_ISSOCK(mode) (((mode) & (S_IFMT)) == (C_ISSOCK)) 1270 #define CANT_USE_SEND_RECV_MSG 1271 #define DEF_SMTP_CACHE_DEMAND 0 1272 #endif 1273 1274 /* 1275 * We're not going to try to guess like configure does. 1276 */ 1277 #ifndef SUPPORTED 1278 #error "unsupported platform" 1279 #endif 1280 1281 /* 1282 * Allow command line flags to override native settings 1283 */ 1284 #ifndef DEF_COMMAND_DIR 1285 #ifdef NATIVE_COMMAND_DIR 1286 #define DEF_COMMAND_DIR NATIVE_COMMAND_DIR 1287 #endif 1288 #endif 1289 1290 #ifndef DEF_DAEMON_DIR 1291 #ifdef NATIVE_DAEMON_DIR 1292 #define DEF_DAEMON_DIR NATIVE_DAEMON_DIR 1293 #endif 1294 #endif 1295 1296 #ifndef DEF_SENDMAIL_PATH 1297 #ifdef NATIVE_SENDMAIL_PATH 1298 #define DEF_SENDMAIL_PATH NATIVE_SENDMAIL_PATH 1299 #endif 1300 #endif 1301 1302 #ifndef DEF_MAILQ_PATH 1303 #ifdef NATIVE_MAILQ_PATH 1304 #define DEF_MAILQ_PATH NATIVE_MAILQ_PATH 1305 #endif 1306 #endif 1307 1308 #ifndef DEF_NEWALIAS_PATH 1309 #ifdef NATIVE_NEWALIAS_PATH 1310 #define DEF_NEWALIAS_PATH NATIVE_NEWALIAS_PATH 1311 #endif 1312 #endif 1313 1314 #ifndef DEF_DB_TYPE 1315 #define DEF_DB_TYPE NATIVE_DB_TYPE 1316 #endif 1317 1318 #define CAST_ANY_PTR_TO_INT(cptr) ((int) (long) (cptr)) 1319 #define CAST_INT_TO_VOID_PTR(ival) ((void *) (long) (ival)) 1320 1321 #ifdef DUP2_DUPS_CLOSE_ON_EXEC 1322 /* dup2_pass_on_exec() can be found in util/sys_compat.c */ 1323 extern int dup2_pass_on_exec(int oldd, int newd); 1324 1325 #define DUP2 dup2_pass_on_exec 1326 #else 1327 #define DUP2 dup2 1328 #endif 1329 1330 #ifdef PREPEND_PLUS_TO_OPTSTRING 1331 #define GETOPT(argc, argv, str) getopt((argc), (argv), "+" str) 1332 #else 1333 #define GETOPT(argc, argv, str) getopt((argc), (argv), (str)) 1334 #endif 1335 #define OPTIND (optind > 0 ? optind : 1) 1336 1337 /* 1338 * Check for required but missing definitions. 1339 */ 1340 #if !defined(HAS_FCNTL_LOCK) && !defined(HAS_FLOCK_LOCK) 1341 #error "define HAS_FCNTL_LOCK and/or HAS_FLOCK_LOCK" 1342 #endif 1343 1344 #if !defined(DEF_MAILBOX_LOCK) 1345 #error "define DEF_MAILBOX_LOCK" 1346 #endif 1347 1348 #if !defined(INTERNAL_LOCK) 1349 #error "define INTERNAL_LOCK" 1350 #endif 1351 1352 #if defined(USE_STATFS) && defined(USE_STATVFS) 1353 #error "define USE_STATFS or USE_STATVFS, not both" 1354 #endif 1355 1356 #if !defined(USE_STATFS) && !defined(USE_STATVFS) 1357 #error "define USE_STATFS or USE_STATVFS" 1358 #endif 1359 1360 /* 1361 * Defaults for systems that pre-date IPv6 support. 1362 */ 1363 #ifndef __NetBSD__ 1364 #ifndef HAS_IPV6 1365 #define EMULATE_IPV4_ADDRINFO 1366 #define MISSING_INET_PTON 1367 #define MISSING_INET_NTOP 1368 extern const char *inet_ntop(int, const void *, char *, size_t); 1369 extern int inet_pton(int, const char *, void *); 1370 1371 #endif 1372 #endif 1373 1374 /* 1375 * Workaround: after a watchdog alarm signal, wake up from select/poll/etc. 1376 * by writing to a pipe. Solaris needs this, and HP-UX apparently, too. The 1377 * run-time cost is negligible so we just turn it on for all systems. As a 1378 * side benefit, making this code system-independent will simplify the 1379 * detection of bit-rot problems. 1380 */ 1381 #ifndef NO_WATCHDOG_PIPE 1382 #define USE_WATCHDOG_PIPE 1383 #endif 1384 1385 /* 1386 * If we don't have defined a preferred random device above, but the system 1387 * has /dev/urandom, then we use that. 1388 */ 1389 #if !defined(PREFERRED_RAND_SOURCE) && defined(HAS_DEV_URANDOM) 1390 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom" 1391 #endif 1392 1393 /* 1394 * Defaults for systems without kqueue, /dev/poll or epoll support. 1395 * master/multi-server.c and *qmgr/qmgr_transport.c depend on this. 1396 */ 1397 #if !defined(EVENTS_STYLE) 1398 #define EVENTS_STYLE EVENTS_STYLE_SELECT 1399 #endif 1400 1401 #define EVENTS_STYLE_SELECT 1 /* Traditional BSD select */ 1402 #define EVENTS_STYLE_KQUEUE 2 /* FreeBSD kqueue */ 1403 #define EVENTS_STYLE_DEVPOLL 3 /* Solaris /dev/poll */ 1404 #define EVENTS_STYLE_EPOLL 4 /* Linux epoll */ 1405 1406 /* 1407 * We use poll() for read/write time limit enforcement on modern systems. We 1408 * use select() on historical systems without poll() support. And on systems 1409 * where poll() is not implemented for some file handle types, we try to use 1410 * select() as a fall-back solution (MacOS X needs this). 1411 */ 1412 #if !defined(USE_SYSV_POLL) && !defined(USE_SYSV_POLL_THEN_SELECT) 1413 #define USE_BSD_SELECT 1414 #endif 1415 1416 /* 1417 * The Postfix 2.9 post-install workaround assumes that the inet_protocols 1418 * default value is "ipv4" when Postfix is compiled without IPv6 support. 1419 */ 1420 #ifndef DEF_INET_PROTOCOLS 1421 #ifdef HAS_IPV6 1422 #define DEF_INET_PROTOCOLS INET_PROTO_NAME_ALL 1423 #else 1424 #define DEF_INET_PROTOCOLS INET_PROTO_NAME_IPV4 1425 #endif 1426 #endif 1427 1428 /* 1429 * Defaults for systems that pre-date POSIX socklen_t. 1430 */ 1431 #ifndef SOCKADDR_SIZE 1432 #define SOCKADDR_SIZE int 1433 #endif 1434 1435 #ifndef SOCKOPT_SIZE 1436 #define SOCKOPT_SIZE int 1437 #endif 1438 1439 /* 1440 * Defaults for normal systems. 1441 */ 1442 #ifndef LOCAL_LISTEN 1443 #define LOCAL_LISTEN unix_listen 1444 #define LOCAL_ACCEPT unix_accept 1445 #define LOCAL_CONNECT unix_connect 1446 #define LOCAL_TRIGGER unix_trigger 1447 #define LOCAL_SEND_FD unix_send_fd 1448 #define LOCAL_RECV_FD unix_recv_fd 1449 #endif 1450 1451 #if !defined (HAVE_SYS_NDIR_H) && !defined (HAVE_SYS_DIR_H) \ 1452 && !defined (HAVE_NDIR_H) 1453 #define HAVE_DIRENT_H 1454 #endif 1455 1456 #ifndef WAIT_STATUS_T 1457 typedef int WAIT_STATUS_T; 1458 1459 #define NORMAL_EXIT_STATUS(status) ((status) == 0) 1460 #endif 1461 1462 #ifdef NO_POSIX_GETPW_R 1463 #undef HAVE_POSIX_GETPW_R 1464 #endif 1465 1466 #ifdef NO_DB 1467 #undef HAS_DB 1468 #endif 1469 1470 #ifndef OCTAL_TO_UNSIGNED 1471 #define OCTAL_TO_UNSIGNED(res, str) ((res) = strtoul((str), (char **) 0, 8)) 1472 #endif 1473 1474 /* 1475 * Avoid useless type mis-matches when using sizeof in an integer context. 1476 */ 1477 #define INT_SIZEOF(foo) ((int) sizeof(foo)) 1478 1479 /* 1480 * Turn on the compatibility stuff. 1481 */ 1482 #ifdef MISSING_UTIMBUF 1483 struct utimbuf { 1484 time_t actime; 1485 time_t modtime; 1486 }; 1487 1488 #endif 1489 1490 #ifdef MISSING_STRERROR 1491 extern const char *strerror(int); 1492 1493 #endif 1494 1495 #if defined (MISSING_SETENV) || defined (MISSING_SETENV_PUTENV) 1496 extern int setenv(const char *, const char *, int); 1497 1498 #endif 1499 1500 #ifdef MISSING_SETEUID 1501 extern int seteuid(uid_t euid); 1502 1503 #endif 1504 1505 #ifdef MISSING_SETEGID 1506 extern int setegid(gid_t egid); 1507 1508 #endif 1509 1510 #ifdef MISSING_MKFIFO 1511 extern int mkfifo(char *, int); 1512 1513 #endif 1514 1515 #ifdef MISSING_WAITPID 1516 extern int waitpid(int, WAIT_STATUS_T *status, int options); 1517 1518 #endif 1519 1520 #ifdef MISSING_SETSID 1521 extern int setsid(void); 1522 1523 #endif 1524 1525 #ifndef HAS_CLOSEFROM 1526 extern int closefrom(int); 1527 1528 #endif 1529 1530 #ifdef MISSING_STD_FILENOS 1531 #define STDIN_FILENO 0 1532 #define STDOUT_FILENO 1 1533 #define STDERR_FILENO 2 1534 #endif 1535 1536 #ifdef MISSING_PID_T 1537 typedef int pid_t; 1538 1539 #endif 1540 1541 #ifdef MISSING_POSIX_S_IS 1542 #define S_ISBLK(mode) (((mode) & (_S_IFMT)) == (_S_IFBLK)) 1543 #define S_ISCHR(mode) (((mode) & (_S_IFMT)) == (_S_IFCHR)) 1544 #define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) 1545 #define S_ISSOCK(mode) (((mode) & (_S_IFMT)) == (_S_IFSOCK)) 1546 #define S_ISFIFO(mode) (((mode) & (_S_IFMT)) == (_S_IFIFO)) 1547 #define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) 1548 #define S_ISLNK(mode) (((mode) & (_S_IFMT)) == (_S_IFLNK)) 1549 #endif 1550 1551 #ifdef MISSING_POSIX_S_MODES 1552 #define S_IRUSR _S_IRUSR 1553 #define S_IRGRP 0000040 1554 #define S_IROTH 0000004 1555 #define S_IWUSR _S_IWUSR 1556 #define S_IWGRP 0000020 1557 #define S_IWOTH 0000002 1558 #define S_IXUSR _S_IXUSR 1559 #define S_IXGRP 0000010 1560 #define S_IXOTH 0000001 1561 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) 1562 #endif 1563 1564 /* 1565 * Memory alignment of memory allocator results. By default we align for 1566 * doubles. 1567 */ 1568 #ifndef ALIGN_TYPE 1569 #if defined(__hpux) && defined(__ia64) 1570 #define ALIGN_TYPE __float80 1571 #elif defined(__ia64__) 1572 #define ALIGN_TYPE long double 1573 #else 1574 #define ALIGN_TYPE double 1575 #endif 1576 #endif 1577 1578 /* 1579 * Clang-style attribute tests. 1580 * 1581 * XXX Without the unconditional test below, gcc 4.6 will barf on ``elif 1582 * defined(__clang__) && __has_attribute(__whatever__)'' with error message 1583 * ``missing binary operator before token "("''. 1584 */ 1585 #ifndef __has_attribute 1586 #define __has_attribute(x) 0 1587 #endif /* __has_attribute */ 1588 1589 /* 1590 * Need to specify what functions never return, so that the compiler can 1591 * warn for missing initializations and other trouble. However, OPENSTEP4 1592 * gcc 2.7.x cannot handle this so we define this only if NORETURN isn't 1593 * already defined above. 1594 * 1595 * Data point: gcc 2.7.2 has __attribute__ (Wietse Venema) but gcc 2.6.3 does 1596 * not (Clive Jones). So we'll set the threshold at 2.7. 1597 */ 1598 #ifndef NORETURN 1599 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 1600 #define NORETURN void __attribute__((__noreturn__)) 1601 #elif defined(__clang__) && __has_attribute(__noreturn__) 1602 #define NORETURN void __attribute__((__noreturn__)) 1603 #else 1604 #define NORETURN void 1605 #endif 1606 #endif /* NORETURN */ 1607 1608 /* 1609 * Turn on format string argument checking. This is more accurate than 1610 * printfck, but it misses #ifdef-ed code. XXX I am just guessing at what 1611 * gcc versions support this. In order to turn this off for some platforms, 1612 * specify #define PRINTFLIKE and #define SCANFLIKE in the system-dependent 1613 * sections above. 1614 */ 1615 #ifndef PRINTFLIKE 1616 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 1617 #define PRINTFLIKE(x,y) __attribute__ ((format (printf, (x), (y)))) 1618 #elif defined(__clang__) && __has_attribute(__format__) 1619 #define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y)))) 1620 #else 1621 #define PRINTFLIKE(x,y) 1622 #endif 1623 #endif /* PRINTFLIKE */ 1624 1625 #ifndef SCANFLIKE 1626 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3 1627 #define SCANFLIKE(x,y) __attribute__ ((format (scanf, (x), (y)))) 1628 #elif defined(__clang__) && __has_attribute(__format__) 1629 #define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, (x), (y)))) 1630 #else 1631 #define SCANFLIKE(x,y) 1632 #endif 1633 #endif /* SCANFLIKE */ 1634 1635 /* 1636 * Some gcc implementations don't grok these attributes with pointer to 1637 * function. Again, wild guess of what is supported. To override, specify 1638 * #define PRINTFPTRLIKE in the system-dependent sections above. 1639 */ 1640 #ifndef PRINTFPTRLIKE 1641 #if (__GNUC__ >= 3) /* XXX Rough estimate */ 1642 #define PRINTFPTRLIKE(x,y) PRINTFLIKE(x,y) 1643 #elif defined(__clang__) && __has_attribute(__format__) 1644 #define PRINTFPTRLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y)))) 1645 #else 1646 #define PRINTFPTRLIKE(x,y) 1647 #endif 1648 #endif 1649 1650 /* 1651 * Compiler optimization hint. This makes sense only for code in a 1652 * performance-critical loop. 1653 */ 1654 #ifndef EXPECTED 1655 #if defined(__GNUC__) && (__GNUC__ > 2) 1656 #define EXPECTED(x) __builtin_expect(!!(x), 1) 1657 #define UNEXPECTED(x) __builtin_expect(!!(x), 0) 1658 #else 1659 #define EXPECTED(x) (x) 1660 #define UNEXPECTED(x) (x) 1661 #endif 1662 #endif 1663 1664 /* 1665 * Warn about ignored function result values that must never be ignored. 1666 * Typically, this is for error results from "read" functions that normally 1667 * write to output parameters (for example, stat- or scanf-like functions) 1668 * or from functions that have other useful side effects (for example, 1669 * fseek- or rename-like functions). 1670 * 1671 * DO NOT use this for functions that write to a stream; it is entirely 1672 * legitimate to detect write errors with fflush() or fclose() only. On the 1673 * other hand most (but not all) functions that read from a stream must 1674 * never ignore result values. 1675 * 1676 * XXX Prepending "(void)" won't shut up GCC. Clang behaves as expected. 1677 */ 1678 #if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3) 1679 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 1680 #elif defined(__clang__) && __has_attribute(warn_unused_result) 1681 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 1682 #else 1683 #define WARN_UNUSED_RESULT 1684 #endif 1685 1686 /* 1687 * ISO C says that the "volatile" qualifier protects against optimizations 1688 * that cause longjmp() to clobber local variables. 1689 */ 1690 #ifndef NOCLOBBER 1691 #define NOCLOBBER volatile 1692 #endif 1693 1694 /* 1695 * Bit banging!! There is no official constant that defines the INT_MAX 1696 * equivalent of the off_t type. Wietse came up with the following macro 1697 * that works as long as off_t is some two's complement number. 1698 * 1699 * Note, however, that C99 permits signed integer representations other than 1700 * two's complement. 1701 */ 1702 #include <limits.h> 1703 #define __MAXINT__(T) ((T) (((((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ ((T) -1)))) 1704 #ifndef OFF_T_MAX 1705 #define OFF_T_MAX __MAXINT__(off_t) 1706 #endif 1707 1708 /* 1709 * Setting globals like h_errno can be problematic when Postfix is linked 1710 * with multi-threaded libraries. 1711 */ 1712 #ifndef SET_H_ERRNO 1713 #define SET_H_ERRNO(err) (h_errno = (err)) 1714 #endif 1715 1716 /* 1717 * Don't mix socket message send/receive calls with socket stream read/write 1718 * calls. The fact that you can get away with it only on some stacks implies 1719 * that there is no long-term guarantee. 1720 */ 1721 #ifndef CAN_WRITE_BEFORE_SENDING_FD 1722 #define CANT_WRITE_BEFORE_SENDING_FD 1723 #endif 1724 1725 /* 1726 * FreeBSD sendmsg(2) says that after sending a file descriptor, the sender 1727 * must not immediately close the descriptor, otherwise it may close the 1728 * descriptor before it is actually sent. 1729 */ 1730 #ifndef DONT_WAIT_AFTER_SENDING_FD 1731 #define MUST_READ_AFTER_SENDING_FD 1732 #endif 1733 1734 /* 1735 * Hope for the best. 1736 */ 1737 #ifndef UINT32_TYPE 1738 #define UINT32_TYPE uint32_t 1739 #define UINT16_TYPE uint16_t 1740 #endif 1741 #define UINT32_SIZE 4 1742 #define UINT16_SIZE 2 1743 1744 /* 1745 * For the sake of clarity. 1746 */ 1747 #ifndef HAVE_CONST_CHAR_STAR 1748 typedef const char *CONST_CHAR_STAR; 1749 1750 #endif 1751 1752 /* 1753 * Safety. On some systems, ctype.h misbehaves with non-ASCII or negative 1754 * characters. More importantly, Postfix uses the ISXXX() macros to ensure 1755 * protocol compliance, so we have to rule out non-ASCII characters. 1756 * 1757 * XXX The (unsigned char) casts in isalnum() etc arguments are unnecessary 1758 * because the ISASCII() guard already ensures that the values are 1759 * non-negative; the casts are done anyway to shut up chatty compilers. 1760 */ 1761 #define ISASCII(c) isascii(_UCHAR_(c)) 1762 #define _UCHAR_(c) ((unsigned char)(c)) 1763 #define ISALNUM(c) (ISASCII(c) && isalnum((unsigned char)(c))) 1764 #define ISALPHA(c) (ISASCII(c) && isalpha((unsigned char)(c))) 1765 #define ISCNTRL(c) (ISASCII(c) && iscntrl((unsigned char)(c))) 1766 #define ISDIGIT(c) (ISASCII(c) && isdigit((unsigned char)(c))) 1767 #define ISGRAPH(c) (ISASCII(c) && isgraph((unsigned char)(c))) 1768 #define ISLOWER(c) (ISASCII(c) && islower((unsigned char)(c))) 1769 #define ISPRINT(c) (ISASCII(c) && isprint((unsigned char)(c))) 1770 #define ISPUNCT(c) (ISASCII(c) && ispunct((unsigned char)(c))) 1771 #define ISSPACE(c) (ISASCII(c) && isspace((unsigned char)(c))) 1772 #define ISUPPER(c) (ISASCII(c) && isupper((unsigned char)(c))) 1773 #define TOLOWER(c) (ISUPPER(c) ? tolower((unsigned char)(c)) : (c)) 1774 #define TOUPPER(c) (ISLOWER(c) ? toupper((unsigned char)(c)) : (c)) 1775 1776 /* 1777 * Character sets for parsing. 1778 */ 1779 #define CHARS_COMMA_SP ", \t\r\n" /* list separator */ 1780 #define CHARS_SPACE " \t\r\n" /* word separator */ 1781 #define CHARS_BRACE "{}" /* grouping */ 1782 1783 /* 1784 * Scaffolding. I don't want to lose messages while the program is under 1785 * development. 1786 */ 1787 extern int REMOVE(const char *); 1788 1789 /* LICENSE 1790 /* .ad 1791 /* .fi 1792 /* The Secure Mailer license must be distributed with this software. 1793 /* AUTHOR(S) 1794 /* Wietse Venema 1795 /* IBM T.J. Watson Research 1796 /* P.O. Box 704 1797 /* Yorktown Heights, NY 10598, USA 1798 /*--*/ 1799 1800 #endif 1801