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