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