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