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