conf.h revision 266527
137Srgrimes/*
237Srgrimes * Copyright (c) 1998-2011 Proofpoint, Inc. and its suppliers.
337Srgrimes *	All rights reserved.
4705Swollman * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
5705Swollman * Copyright (c) 1988, 1993
6705Swollman *	The Regents of the University of California.  All rights reserved.
739139Sobrien *
846414Sghelmer * By using this file, you agree to the terms and conditions set
980266Sdougb * forth in the LICENSE file which can be found at the top level of
1080945Sdougb * the sendmail distribution.
1180266Sdougb *
1239139Sobrien *
1339139Sobrien *	$Id: conf.h,v 1.147 2013-11-22 20:51:31 ca Exp $
1439139Sobrien */
1539139Sobrien
167685Sache/*
177685Sache**  CONF.H -- All user-configurable parameters for sendmail
1837Srgrimes**
1950472Speter**	Send updates to Sendmail.ORG so they will be
20705Swollman**	included in the next release; see
21705Swollman**	http://www.sendmail.org/email-addresses.html
227685Sache**	for current e-mail address.
237685Sache*/
2422009Sphk
257685Sache#ifndef SM_CONF_H
267685Sache# define SM_CONF_H 1
2722009Sphk
287685Sache
297685Sache# include <sm/config.h>
307685Sache# include <sm/varargs.h>
317685Sache
3222009Sphk/*
337685Sache**  General "standard C" defines.
347685Sache**
3522009Sphk**	These may be undone later, to cope with systems that claim to
36215249Stuexen**	be Standard C but aren't.  Gcc is the biggest offender -- it
377685Sache**	doesn't realize that the library is part of the language.
387685Sache**
39215249Stuexen**	Life would be much easier if we could get rid of this sort
407685Sache**	of bozo problems.
417685Sache*/
427685Sache
437685Sache# ifdef __STDC__
44215249Stuexen#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
457685Sache# endif /* __STDC__ */
467685Sache
477685Sache/*
487685Sache**  Assume you have standard calls; can be #undefed below if necessary.
497685Sache*/
507685Sache
51215249Stuexen# ifndef HASLSTAT
527685Sache#  define HASLSTAT	1	/* has lstat(2) call */
537685Sache# endif /* ! HASLSTAT */
54215249Stuexen
557685Sache# ifndef HASNICE
567685Sache#  define HASNICE	1	/* has nice(2) call */
57215249Stuexen# endif /* ! HASNICE */
587685Sache
597685Sache# ifndef HASRRESVPORT
60215249Stuexen#  define HASRRESVPORT	1	/* has rrsevport(3) call */
61131994Scperciva# endif /* ! HASRRESVPORT */
62131994Scperciva
637685Sache/**********************************************************************
647685Sache**  "Hard" compilation options.
657685Sache**	#define these if they are available; comment them out otherwise.
667685Sache**  These cannot be overridden from the Makefile, and should really not
677685Sache**  be turned off unless absolutely necessary.
687685Sache**********************************************************************/
697685Sache
707685Sache#define LOG		1	/* enable logging -- don't turn off */
717685Sache
727685Sache/**********************************************************************
737685Sache**  Operating system configuration.
747685Sache**
757685Sache**	Unless you are porting to a new OS, you shouldn't have to
767685Sache**	change these.
777685Sache**********************************************************************/
787685Sache
797685Sache/*
807685Sache**  HP-UX -- tested for 8.07, 9.00, and 9.01.
817685Sache**
827685Sache**	If V4FS is defined, compile for HP-UX 10.0.
837685Sache**	11.x support from Richard Allen <ra@hp.is>.
847685Sache*/
857685Sache
867685Sache# ifdef __hpux
877685Sache		/* common definitions for HP-UX 9.x and 10.x */
887685Sache#  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
897685Sache#  define SYSTEM5	1	/* include all the System V defines */
907685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
917685Sache#  define HASFCHMOD	1	/* has fchmod(2) syscall */
927685Sache#  define USESETEUID	1	/* has usable seteuid(2) call */
937685Sache#  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
947685Sache#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
957685Sache#  define seteuid(e)	setresuid(-1, e, -1)
967685Sache#  define IP_SRCROUTE	1	/* can check IP source routing */
977685Sache#  define LA_TYPE	LA_HPUX
987685Sache#  define SPT_TYPE	SPT_PSTAT
997685Sache#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1007685Sache#  define GIDSET_T	gid_t
101131994Scperciva#  define LDA_USE_LOCKF	1
102131994Scperciva#  ifndef HASGETUSERSHELL
1037685Sache#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
1047685Sache#  endif /* ! HASGETUSERSHELL */
1057685Sache#  ifdef HPUX10
1067685Sache#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
1077685Sache#   ifndef SMRSH_CMDDIR
1087685Sache#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
1097685Sache#   endif /* ! SMRSH_CMDDIR */
1107685Sache#  endif /* HPUX10 */
1117685Sache#  ifdef HPUX11
1127685Sache#   define HASSETREUID	1	/* setreuid(2) works on HP-UX 11.x */
1137685Sache#   define HASFCHOWN	1	/* has fchown(2) */
1147685Sache#   ifndef BROKEN_RES_SEARCH
1157685Sache#    define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
1167685Sache#   endif /* ! BROKEN_RES_SEARCH */
117169784Sgrog#   ifndef SMRSH_CMDDIR
118169784Sgrog#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
1197685Sache#   endif /* ! SMRSH_CMDDIR */
1207685Sache#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
1217685Sache#  else /* HPUX11 */
1227685Sache#   ifndef NOT_SENDMAIL
1237685Sache#    define syslog	hard_syslog
1247685Sache#   endif /* ! NOT_SENDMAIL */
1257685Sache#  endif /* HPUX11 */
1267685Sache#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1277685Sache
1287685Sache#  ifdef V4FS
1297685Sache		/* HP-UX 10.x */
1307685Sache#   define _PATH_UNIX		"/stand/vmunix"
1317685Sache#   ifndef _PATH_VENDOR_CF
1327685Sache#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
1337685Sache#   endif /* ! _PATH_VENDOR_CF */
1347685Sache#   ifndef _PATH_SENDMAILPID
13513583Spst#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
13613583Spst#   endif /* ! _PATH_SENDMAILPID */
13713583Spst#   ifndef IDENTPROTO
13813583Spst#    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
1397685Sache#   endif /* ! IDENTPROTO */
1407685Sache#   include <sys/mpctl.h>	/* for mpctl() in get_num_procs_online() */
1417685Sache#  else /* V4FS */
1427685Sache		/* HP-UX 9.x */
1437685Sache#   define _PATH_UNIX		"/hp-ux"
1447685Sache#   ifndef _PATH_VENDOR_CF
1457685Sache#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1467685Sache#   endif /* ! _PATH_VENDOR_CF */
1477685Sache#   ifndef IDENTPROTO
1487685Sache#    define IDENTPROTO	0	/* TCP/IP implementation is broken */
1497685Sache#   endif /* ! IDENTPROTO */
1507685Sache#   ifdef __STDC__
1517685Sacheextern void	hard_syslog(int, char *, ...);
1527685Sache#   else /* __STDC__ */
1537685Sacheextern void	hard_syslog();
1547685Sache#   endif /* __STDC__ */
1557685Sache#   define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
1567685Sache#  endif /* V4FS */
1577685Sache
1587685Sache# endif /* __hpux */
1597685Sache
1607685Sache/*
161215249Stuexen**  IBM AIX 5.x
162131994Scperciva*/
163131994Scperciva
1647685Sache# ifdef _AIX5
1657685Sache#  include <sys/signal.h>
1667685Sache#  include <sys/wait.h>
1677685Sache#  define _AIX4		40300
1687685Sache#  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
1697685Sache#  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
1707685Sache#  if _AIX5 >= 50200
1717685Sache#   define HASUNSETENV	1	/* has unsetenv(3) call */
1727685Sache#  endif /* _AIX5 >= 50200 */
1737685Sache# endif /* _AIX5 */
1747685Sache
1757685Sache/*
1767685Sache**  IBM AIX 4.x
1777685Sache*/
178131994Scperciva
179131994Scperciva# ifdef _AIX4
1807685Sache#  define _AIX3		1	/* pull in AIX3 stuff */
1817685Sache#  define BSD4_4_SOCKADDR	/* has sa_len */
1827685Sache#  define USESETEUID	1	/* seteuid(2) works */
1837685Sache#  define TZ_TYPE	TZ_NAME	/* use tzname[] vector */
1847685Sache#  ifndef SOCKOPT_LEN_T
1857685Sache#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
1867685Sache#  endif /* SOCKOPT_LEN_T */
1877685Sache#  if _AIX4 >= 40200
1887685Sache#   define HASSETREUID	1	/* setreuid(2) works as of AIX 4.2 */
1897685Sache#   ifndef SOCKADDR_LEN_T
1907685Sache#    define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1917685Sache#   endif /* SOCKADDR_LEN_T */
1927685Sache#  endif /* _AIX4 >= 40200 */
1937685Sache#  if defined(_ILS_MACROS)	/* IBM versions aren't side-effect clean */
1947685Sache#   undef isascii
1957685Sache#   define isascii(c)		!(c & ~0177)
1967685Sache#   undef isdigit
1977685Sache#   define isdigit(__a)		(_IS(__a,_ISDIGIT))
19880597Sdougb#   undef isspace
19980597Sdougb#   define isspace(__a)		(_IS(__a,_ISSPACE))
2007685Sache#  endif /* defined(_ILS_MACROS) */
2017685Sache# endif /* _AIX4 */
2027685Sache
2037685Sache
2047685Sache/*
2057685Sache**  IBM AIX 3.x -- actually tested for 3.2.3
2067685Sache*/
2077685Sache
2087685Sache# ifdef _AIX3
2097685Sache#  include <paths.h>
2107685Sache#  include <sys/machine.h>	/* to get byte order */
21139139Sobrien#  include <sys/select.h>
21239139Sobrien#  define HASFCHOWN	1	/* has fchown(2) */
213131994Scperciva#  define HASINITGROUPS	1	/* has initgroups(3) call */
2147685Sache#  define HASUNAME	1	/* use System V uname(2) system call */
2157685Sache#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2167685Sache#  define HASFCHMOD	1	/* has fchmod(2) syscall */
2177685Sache#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
2187685Sache#  define GIDSET_T	gid_t
2197685Sache#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
2207685Sache#  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
2217685Sache#  ifndef LA_TYPE
2227685Sache#   define LA_TYPE	LA_INT
2237685Sache#  endif /* LA_TYPE */
2247685Sache#  define FSHIFT	16
2257685Sache#  define LA_AVENRUN	"avenrun"
2267685Sache#  if !defined(_AIX4) || _AIX4 < 40300
2277685Sache#   ifndef __BIT_TYPES_DEFINED__
2287685Sache#    define SM_INT32	int
2297685Sache#   endif /* __BIT_TYPES_DEFINED__ */
2307685Sache#  endif /* !defined(_AIX4) || _AIX4 < 40300 */
2317685Sache#  if !defined(_AIX4) || _AIX4 < 40200
2327685Sache#   define SM_CONF_SYSLOG	0
2337685Sache#  endif /* !defined(_AIX4) || _AIX4 < 40200 */
2347685Sache# endif /* _AIX3 */
2357685Sache
2367685Sache
2377685Sache/*
2387685Sache**  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
2397685Sache**
2407685Sache**	From Mark Whetzel <markw@wg.waii.com>.
2417685Sache*/
2427685Sache
2437685Sache# ifdef AIX			/* AIX/RT compiler pre-defines this */
2447685Sache#  include <paths.h>
2457685Sache#  include <sys/time.h>		/* AIX/RT resource.h does NOT include this */
2467685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
2477685Sache#  define HASUNAME	1	/* use System V uname(2) system call */
2487685Sache#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2497685Sache#  define HASFCHMOD	0	/* does not have fchmod(2) syscall */
2507685Sache#  define HASSETREUID	1	/* use setreuid(2) -lbsd system call */
2517685Sache#  define HASSETVBUF	1	/* use setvbuf(2) system call */
2527685Sache#  define HASSETRLIMIT	0	/* does not have setrlimit call */
2537685Sache#  define HASFLOCK	0	/* does not have flock call - use fcntl */
2547685Sache#  define HASULIMIT	1	/* use ulimit instead of setrlimit call */
2557685Sache#  define SM_CONF_GETOPT	0	/* Do we need theirs or ours */
2567685Sache#  define SYS5SETPGRP	1	/* don't have setpgid on AIX/RT */
2577685Sache#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
2587685Sache#  define BSD4_3		1	/* NOT bsd 4.4 or posix signals */
2597685Sache#  define GIDSET_T	int
2607685Sache#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
2617685Sache#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
2627685Sache#  define LA_TYPE	LA_SUBR		/* use our ported loadavgd daemon */
2637685Sache#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2647685Sache#  define ARBPTR_T	int *
2657685Sache#  define void		int
2667685Sachetypedef int		pid_t;
2677685Sache/* RTisms for BSD compatibility, specified in the Makefile
2687685Sache  define BSD		1
26939139Sobrien  define BSD_INCLUDES		1
27039139Sobrien  define BSD_REMAP_SIGNAL_TO_SIGVEC
27191141Scjc    RTisms needed above */
27291141Scjc/* make this sendmail in a completely different place */
27391141Scjc#  ifndef _PATH_VENDOR_CF
27491141Scjc#   define _PATH_VENDOR_CF	"/usr/local/newmail/sendmail.cf"
2757685Sache#  endif /* ! _PATH_VENDOR_CF */
2767685Sache#  ifndef _PATH_SENDMAILPID
2777685Sache#   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
2787685Sache#  endif /* ! _PATH_SENDMAILPID */
2797685Sache# endif /* AIX */
2807685Sache
2817685Sache# if defined(_AIX)
2827685Sache#  define LDA_USE_LOCKF		1
28391141Scjc#  define LDA_USE_SETEUID	1
28491141Scjc# endif /* defined(_AIX) */
285131994Scperciva
286131994Scperciva/*
2877685Sache**  Silicon Graphics IRIX
2887685Sache**
28939139Sobrien**	Compiles on 4.0.1.
29039139Sobrien**
29139139Sobrien**	Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
29239139Sobrien**	Use IRIX5 instead of IRIX for IRIX 5.x.
29391141Scjc**
29491141Scjc**	IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
2957685Sache**	IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
2967685Sache*/
2977685Sache
2987685Sache# ifdef IRIX
29991141Scjc#  define SYSTEM5	1	/* this is a System-V derived system */
30091141Scjc#  define HASSETREUID	1	/* has setreuid(2) call */
30191141Scjc#  define HASINITGROUPS	1	/* has initgroups(3) call */
30291141Scjc#  define HASFCHMOD	1	/* has fchmod(2) syscall */
3037685Sache#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
3047685Sache#  define IP_SRCROUTE	1	/* can check IP source routing */
3057685Sache#  define setpgid	BSDsetpgrp
3067685Sache#  define GIDSET_T	gid_t
30791141Scjc#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
30891141Scjc#  define SFS_BAVAIL	f_bfree		/* alternate field name */
3097685Sache#  define SYSLOG_BUFSIZE 512
3107685Sache#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
3117685Sache    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
3127685Sache#   define _SC_NPROCESSORS_ONLN	_SC_NPROC_ONLN
3137685Sache#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
3147685Sache#  ifdef IRIX6
31591141Scjc#   define STAT64	1
31691141Scjc#   define QUAD_T	unsigned long long
3177685Sache#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
3187685Sache#   define SAFENFSPATHCONF 0	/* pathconf(2) lies on NFS filesystems */
31991141Scjc#  else /* IRIX6 */
32091141Scjc#   define LA_TYPE	LA_INT
3217685Sache
3227685Sache#   ifdef IRIX64
3237685Sache#    define STAT64	1
3247685Sache#    define QUAD_T	unsigned long long
3257685Sache#    define NAMELISTMASK	0x7fffffffffffffff	/* mask for nlist() values */
3267685Sache#   else /* IRIX64 */
3277685Sache#    define STAT64	0
3287685Sache#    define NAMELISTMASK	0x7fffffff		/* mask for nlist() values */
32991141Scjc#   endif /* IRIX64 */
33091141Scjc#  endif /* IRIX6 */
33191141Scjc#  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
33291141Scjc#   include <sys/cdefs.h>
33391141Scjc#   include <paths.h>
33491141Scjc#   define ARGV_T	char *const *
33591141Scjc#   define HASFCHOWN	1	/* has fchown(2) */
33691141Scjc#   define HASSETRLIMIT	1	/* has setrlimit(2) syscall */
3377685Sache#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
3387685Sache#   define HASSTRERROR	1	/* has strerror(3) */
3397685Sache#  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
3407685Sache#   define ARGV_T	const char **
3417685Sache#   define WAITUNION	1	/* use "union wait" as wait argument type */
3427685Sache#  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
34391141Scjc# endif /* IRIX */
34491141Scjc
3457685Sache
3467685Sache/*
34791141Scjc**  SunOS and Solaris
34891141Scjc**
3497685Sache**	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
3507685Sache**	Solaris 2.4 (a.k.a. SunOS 5.4).
3517685Sache*/
3527685Sache
3537685Sache# if defined(sun) && !defined(BSD)
3547685Sache
3557685Sache#  include <sys/time.h>
3567685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
35791141Scjc#  define HASUNAME	1	/* use System V uname(2) system call */
35891141Scjc#  define HASFCHMOD	1	/* has fchmod(2) syscall */
35939139Sobrien#  define IP_SRCROUTE	1	/* can check IP source routing */
3607685Sache#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
361215249Stuexen#  ifndef HASFCHOWN
36291141Scjc#   define HASFCHOWN	1	/* fchown(2) */
36391141Scjc#  endif /* ! HASFCHOWN */
36491141Scjc
36591141Scjc#  ifdef __svr4__
3667685Sache#   define LDA_USE_LOCKF		1
3677685Sache#   define LDA_USE_SETEUID	1
36891141Scjc#   define _PATH_MAILDIR		"/var/mail"
36991141Scjc#  endif /* __svr4__ */
3707685Sache
3717685Sache#  ifdef SOLARIS_2_3
3727685Sache#   define SOLARIS	20300	/* for back compat only -- use -DSOLARIS=20300 */
3737685Sache#  endif /* SOLARIS_2_3 */
3747685Sache
3757685Sache#  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
37691141Scjc#   define SOLARIS	1	/* unknown Solaris version */
37791141Scjc#  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
3787685Sache
3797685Sache#  ifdef SOLARIS
38091141Scjc			/* Solaris 2.x (a.k.a. SunOS 5.x) */
38191141Scjc#   ifndef __svr4__
38291141Scjc#    define __svr4__		/* use all System V Release 4 defines below */
38391141Scjc#   endif /* ! __svr4__ */
3847685Sache#   if SOLARIS >= 21100
385131994Scperciva#    include <paths.h>
38691141Scjc#   endif /* SOLARIS >= 21100 */
38791141Scjc#   ifndef _PATH_VARRUN
38891141Scjc#    define _PATH_VARRUN	"/var/run/"
38991141Scjc#   endif /* _PATH_VARRUN */
39091141Scjc#   define GIDSET_T	gid_t
39191141Scjc#   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
39291141Scjc#   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
39391141Scjc#   define HASSTRERROR	1	/* has strerror(3) */
39491141Scjc#   ifndef _PATH_UNIX
39591141Scjc#    define _PATH_UNIX		"/dev/ksyms"
3967685Sache#   endif /* ! _PATH_UNIX */
3977685Sache#   ifndef _PATH_VENDOR_CF
39891141Scjc#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
39991141Scjc#   endif /* ! _PATH_VENDOR_CF */
4007685Sache#   ifndef _PATH_SENDMAILPID
4017685Sache#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
4027685Sache#   endif /* ! _PATH_SENDMAILPID */
403705Swollman#   ifndef _PATH_HOSTS
4047685Sache#    define _PATH_HOSTS		"/etc/inet/hosts"
4057685Sache#   endif /* ! _PATH_HOSTS */
40691141Scjc#   ifndef SYSLOG_BUFSIZE
40791141Scjc#    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
40891141Scjc#   endif /* ! SYSLOG_BUFSIZE */
40991141Scjc#   ifndef TZ_TYPE
41091141Scjc#    define TZ_TYPE	TZ_TZNAME
41191141Scjc#   endif /* ! TZ_TYPE */
41291141Scjc#   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
41391141Scjc#    define USESETEUID		1	/* seteuid works as of 2.3 */
41491141Scjc#    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
41591141Scjc#   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
41691141Scjc#   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
41791141Scjc#    define HASSETREUID	1		/* setreuid works as of 2.5 */
41891141Scjc#    define HASSETREGID	1	/* use setregid(2) to set saved gid */
41991141Scjc#   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
42091141Scjc#    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
42191141Scjc#   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
422131994Scperciva#    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
423131994Scperciva#     ifndef LA_TYPE
42439139Sobrien#      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
42539139Sobrien#     endif /* ! LA_TYPE */
42639139Sobrien#     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
42739139Sobrien#      define RANDOMSHIFT	8
4287685Sache#     endif /* ! RANDOMSHIFT */
4297685Sache#    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
4307685Sache#   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
4317685Sache#    ifndef HASRANDOM
43291141Scjc#     define HASRANDOM	0		/* doesn't have random(3) */
43391141Scjc#    endif /* ! HASRANDOM */
4347685Sache#   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
435705Swollman#   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
4367685Sache#    define SM_INT32	int	/* 32bit integer */
4377685Sache#   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
4387685Sache#   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
4397685Sache#    ifndef LA_TYPE
440131994Scperciva#     include <sys/loadavg.h>
441131994Scperciva#     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
4427685Sache#      include <sys/pset.h>
4437685Sache#      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
4447685Sache#     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
4457685Sache#      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
44691141Scjc#     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
44791141Scjc#    endif /* ! LA_TYPE */
448169784Sgrog#    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
449169784Sgrog#   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
45091141Scjc#   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
45191141Scjc#    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
45291141Scjc#    define _PATH_SENDMAILPID	_PATH_VARRUN "sendmail.pid"
45391141Scjc#    ifndef SMRSH_CMDDIR
45491141Scjc#     define SMRSH_CMDDIR	"/var/adm/sm.bin"
45591141Scjc#    endif /* ! SMRSH_CMDDIR */
456169784Sgrog#    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
457169784Sgrog#    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
45839139Sobrien#   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
45939139Sobrien#   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
46091141Scjc#    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
46191141Scjc#    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
46239139Sobrien#    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
46339139Sobrien#   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
4647685Sache#   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
4657685Sache#    define HASUNSETENV 1       /* unsetenv() added in S10 */
46691141Scjc#   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
46791141Scjc#   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
46839139Sobrien#    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
46939139Sobrien#    define HAVE_NANOSLEEP	1	/* moved from librt to libc in S11 */
47039139Sobrien#    define SOCKADDR_LEN_T	socklen_t	/* arg#3 to accept, getsockname */
47139139Sobrien#    define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
472169590Sgrog#   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
47339139Sobrien#   ifndef HASGETUSERSHELL
47439139Sobrien#    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
47539139Sobrien#   endif /* ! HASGETUSERSHELL */
47639139Sobrien
47739139Sobrien#  else /* SOLARIS */
47839139Sobrien			/* SunOS 4.0.3 or 4.1.x */
47939139Sobrien#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
48039139Sobrien#   define HASSETREUID	1	/* has setreuid(2) call */
48139139Sobrien#   ifndef HASFLOCK
48239139Sobrien#    define HASFLOCK	1	/* has flock(2) call */
48339139Sobrien#   endif /* ! HASFLOCK */
48439139Sobrien#   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
48539139Sobrien#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
48639139Sobrien#   include <memory.h>
48739139Sobrien#   include <vfork.h>
48839139Sobrien#   ifdef __GNUC__
489169784Sgrog#    define strtoul	strtol	/* gcc library bogosity */
490169784Sgrog#   endif /* __GNUC__ */
491169784Sgrog#   define memmove(d, s, l)	(bcopy((s), (d), (l)))
492169784Sgrog#   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
493169784Sgrog#   define SM_INT32	int	/* 32bit integer */
494169784Sgrog#   define SM_ALIGN_SIZE (sizeof(long))
495169784Sgrog#   define GIDSET_T	int
496169784Sgrog#   define SM_CONF_SYSLOG	0
497169784Sgrog
49839139Sobrien#   ifdef SUNOS403
49939139Sobrien			/* special tweaking for SunOS 4.0.3 */
50039139Sobrien#    include <malloc.h>
50139139Sobrien#    define BSD4_3	1	/* 4.3 BSD-based */
50239139Sobrien#    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
50339139Sobrien#    define WAITUNION	1	/* use "union wait" as wait argument type */
504169784Sgrog#    undef WIFEXITED
505169784Sgrog#    undef WEXITSTATUS
506169784Sgrog#    undef HASUNAME
507169784Sgrog#    define setpgid	setpgrp
508169784Sgrog#    define MODE_T	int
509169784Sgrogtypedef int		pid_t;
510169784Sgrogextern char		*getenv();
511169784Sgrog
512169784Sgrog#   else /* SUNOS403 */
513169784Sgrog			/* 4.1.x specifics */
51439139Sobrien#    define HASSETSID	1	/* has POSIX setsid(2) call */
51539139Sobrien#    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
51639139Sobrien
51739139Sobrien#   endif /* SUNOS403 */
51839139Sobrien#  endif /* SOLARIS */
51991141Scjc
52039139Sobrien#  ifndef LA_TYPE
52139139Sobrien#   define LA_TYPE	LA_INT
52239139Sobrien#  endif /* ! LA_TYPE */
52339139Sobrien
52439139Sobrien# endif /* defined(sun) && !defined(BSD) */
52539139Sobrien
52639139Sobrien/*
52739139Sobrien**  DG/UX
52839139Sobrien**
52939139Sobrien**	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
53039139Sobrien**	older support.
53139139Sobrien**	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
53239139Sobrien*/
53339139Sobrien
534169784Sgrog# ifdef DGUX_5_4_2
535169784Sgrog#  define DGUX		1
536169784Sgrog# endif /* DGUX_5_4_2 */
537169784Sgrog
538169784Sgrog# ifdef DGUX
539169784Sgrog#  define SYSTEM5	1
54039139Sobrien#  define LA_TYPE	LA_DGUX
54139139Sobrien#  define HASSETREUID	1	/* has setreuid(2) call */
542169784Sgrog#  define HASUNAME	1	/* use System V uname(2) system call */
543169784Sgrog#  define HASSETSID	1	/* has POSIX setsid(2) call */
544169784Sgrog#  define HASINITGROUPS	1	/* has initgroups(3) call */
545169784Sgrog#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
546169784Sgrog#  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
547169784Sgrog#  ifndef IDENTPROTO
5487685Sache#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
5497685Sache#  endif /* ! IDENTPROTO */
5507685Sache#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
5517685Sache#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
5527685Sache#  define LDA_USE_LOCKF		1
5537685Sache
5547685Sache/* these include files must be included early on DG/UX */
5557685Sache#  include <netinet/in.h>
5567685Sache#  include <arpa/inet.h>
5577685Sache
55839139Sobrien/* compiler doesn't understand const? */
55939139Sobrien#  define const
56039139Sobrien
56139139Sobrien#  ifdef DGUX_5_4_2
56239139Sobrien#   define inet_addr	dgux_inet_addr
56339139Sobrienextern long	dgux_inet_addr();
56439139Sobrien#  endif /* DGUX_5_4_2 */
565131994Scperciva# endif /* DGUX */
56639139Sobrien
56739139Sobrien
568131994Scperciva/*
569131994Scperciva**  Digital Ultrix 4.2 - 4.5
57039139Sobrien**
57139139Sobrien**	Apparently, fcntl locking is broken on 4.2A, in that locks are
57239139Sobrien**	not dropped when the process exits.  This causes major problems,
57339139Sobrien**	so flock is the only alternative.
57439139Sobrien*/
57539139Sobrien
57639139Sobrien# ifdef ultrix
57739139Sobrien#  define HASSETREUID	1	/* has setreuid(2) call */
57839139Sobrien#  define HASUNSETENV	1	/* has unsetenv(3) call */
57939139Sobrien#  define HASINITGROUPS	1	/* has initgroups(3) call */
58039139Sobrien#  define HASUNAME	1	/* use System V uname(2) system call */
58139139Sobrien#  define HASFCHMOD	1	/* has fchmod(2) syscall */
58239139Sobrien#  define HASFCHOWN	1	/* has fchown(2) syscall */
58339139Sobrien#  ifndef HASFLOCK
58439139Sobrien#   define HASFLOCK	1	/* has flock(2) call */
58539139Sobrien#  endif /* ! HASFLOCK */
58639139Sobrien#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
58739139Sobrien#  ifndef BROKEN_RES_SEARCH
58839139Sobrien#   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
58939139Sobrien#  endif /* ! BROKEN_RES_SEARCH */
59039139Sobrien#  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
59139139Sobrien#   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
59239139Sobrien#  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
59339139Sobrien#  ifdef vax
594131994Scperciva#   define LA_TYPE	LA_FLOAT
595131994Scperciva#  else /* vax */
59639139Sobrien#   define LA_TYPE	LA_INT
59739139Sobrien#   define LA_AVENRUN	"avenrun"
59839139Sobrien#  endif /* vax */
59939139Sobrien#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
60039139Sobrien#  ifndef IDENTPROTO
60139139Sobrien#   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
60239139Sobrien#  endif /* ! IDENTPROTO */
60339139Sobrien#  define SYSLOG_BUFSIZE	256
60439139Sobrien#  define SM_CONF_SYSLOG	0
60539139Sobrien# endif /* ultrix */
6067685Sache
6077685Sache
60839139Sobrien/*
60939139Sobrien**  OSF/1 for KSR.
61039139Sobrien**
61139139Sobrien**	Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
61239139Sobrien*/
61339139Sobrien
6147685Sache# ifdef __ksr__
6157685Sache#  define __osf__	1	/* get OSF/1 defines below */
61691141Scjc#  ifndef TZ_TYPE
6177685Sache#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
6187685Sache#  endif /* ! TZ_TYPE */
6197685Sache# endif /* __ksr__ */
6207685Sache
6217685Sache
6227685Sache/*
6237685Sache**  OSF/1 for Intel Paragon.
6247685Sache**
6257685Sache**	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
6267685Sache**	of Intel Scalable Systems Divison.
6277685Sache*/
62891141Scjc
62991141Scjc# ifdef __PARAGON__
6307685Sache#  define __osf__	1	/* get OSF/1 defines below */
6317685Sache#  ifndef TZ_TYPE
6327685Sache#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
6337685Sache#  endif /* ! TZ_TYPE */
6347685Sache#  define GIDSET_T	gid_t
63534344Ssteve#  define MAXNAMLEN	NAME_MAX
6367685Sache# endif /* __PARAGON__ */
6377685Sache
6387685Sache
6397685Sache/*
6407685Sache**  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
6417685Sache**
6427685Sache**	Tested for 3.2 and 4.0.
6437685Sache*/
6447685Sache
6457685Sache# ifdef __osf__
6467685Sache#  define HASUNAME	1	/* has uname(2) call */
6477685Sache#  define HASUNSETENV	1	/* has unsetenv(3) call */
64891141Scjc#  define USESETEUID	1	/* has usable seteuid(2) call */
64991141Scjc#  define HASINITGROUPS	1	/* has initgroups(3) call */
6507685Sache#  define HASFCHMOD	1	/* has fchmod(2) syscall */
6517685Sache#  define HASFCHOWN	1	/* has fchown(2) syscall */
6527685Sache#  define HASSETLOGIN	1	/* has setlogin(2) */
6537685Sache#  define IP_SRCROUTE	1	/* can check IP source routing */
6547685Sache#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
6557685Sache#  define GIDSET_T	gid_t
6567685Sache#  define SM_INT32	int	/* 32bit integer */
6577685Sache#  ifndef HASFLOCK
6587685Sache#   include <standards.h>
6597685Sache#   if _XOPEN_SOURCE+0 >= 400
6607685Sache#    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
6617685Sache#   else /* _XOPEN_SOURCE+0 >= 400 */
6627685Sache#    define HASFLOCK	1	/* has flock(2) call */
6637685Sache#   endif /* _XOPEN_SOURCE+0 >= 400 */
6647685Sache#  endif /* ! HASFLOCK */
6657685Sache#  define LA_TYPE	LA_ALPHAOSF
6667685Sache#  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
6677685Sache#  ifndef _PATH_VENDOR_CF
6687685Sache#   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
6697685Sache#  endif /* ! _PATH_VENDOR_CF */
6707685Sache#  ifndef _PATH_SENDMAILPID
6717685Sache#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
6727685Sache#  endif /* ! _PATH_SENDMAILPID */
6737685Sache#  if _FFR_DIGUNIX_SAFECHOWN
6747685Sache/*
6757685Sache**  Testing on a Digital UNIX 4.0a system showed this to be the correct
6767685Sache**  setting but given the security consequences, more testing and
6777685Sache**  verification is needed.  Unfortunately, the man page offers no
6787685Sache**  assistance.
6797685Sache*/
6807685Sache#   define IS_SAFE_CHOWN >= 0
6817685Sache#  endif /* _FFR_DIGUNIX_SAFECHOWN */
6827685Sache# endif /* __osf__ */
6837685Sache
6847685Sache
6857685Sache/*
6867685Sache**  NeXTstep
6877685Sache*/
6887685Sache
6897685Sache# ifdef NeXT
6907685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
6917685Sache#  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
6927685Sache#  ifndef HASFLOCK
6937685Sache#   define HASFLOCK	1	/* has flock(2) call */
6947685Sache#  endif /* ! HASFLOCK */
6957685Sache#  define UID_T		int	/* compiler gripes on uid_t */
6967685Sache#  define GID_T		int	/* ditto for gid_t */
6977685Sache#  define MODE_T	int	/* and mode_t */
6987685Sache#  define setpgid	setpgrp
6997685Sache#  ifndef NOT_SENDMAIL
7007685Sache#   define sleep		sleepX
7017685Sache#  endif /* ! NOT_SENDMAIL */
7027685Sache#  ifndef LA_TYPE
7037685Sache#   define LA_TYPE	LA_MACH
7047685Sache#  endif /* ! LA_TYPE */
7057685Sache#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
7067685Sache#  ifdef _POSIX_SOURCE
7077685Sacheextern struct passwd	*getpwent();
7087685Sache#  else /* _POSIX_SOURCE */
7097685Sache#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
7107685Sache#   define WAITUNION	1	/* use "union wait" as wait argument type */
7117685Sachetypedef int		pid_t;
7127685Sache#   undef WEXITSTATUS
7137685Sache#   undef WIFEXITED
7147685Sache#   undef WIFSTOPPED
7157685Sache#   undef WTERMSIG
7167685Sache#  endif /* _POSIX_SOURCE */
7177685Sache#  ifndef _PATH_VENDOR_CF
7187685Sache#   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
7197685Sache#  endif /* ! _PATH_VENDOR_CF */
7207685Sache#  ifndef _PATH_SENDMAILPID
7217685Sache#   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
7227685Sache#  endif /* ! _PATH_SENDMAILPID */
7237685Sache#  define SM_INT32	int	/* 32bit integer */
7247685Sache
7257685Sache#  ifdef TCPWRAPPERS
7267685Sache#   ifndef HASUNSETENV
7277685Sache#    define HASUNSETENV	1
7287685Sache#   endif /* ! HASUNSETENV */
7297685Sache#   undef NEEDPUTENV
7307685Sache#  endif /* TCPWRAPPERS */
7317685Sache#  ifndef __APPLE__
7327685Sache#   include <libc.h>
7337685Sache#   ifndef S_IRUSR
7347685Sache#    define S_IRUSR	S_IREAD
7357685Sache#   endif /* ! S_IRUSR */
7367685Sache#   ifndef S_IWUSR
7377685Sache#    define S_IWUSR	S_IWRITE
7387685Sache#   endif /* ! S_IWUSR */
7397685Sache#   define _PATH_MAILDIR	"/usr/spool/mail"
7407685Sache#  endif /* ! __APPLE__ */
7417685Sache#  ifndef isascii
7427685Sache#   define isascii(c)	((unsigned)(c) <= 0177)
7437685Sache#  endif /* ! isascii */
7447685Sache# endif /* NeXT */
7457685Sache
7467685Sache/*
7477685Sache**  Apple Darwin
7487685Sache**      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
7497685Sache*/
750215249Stuexen
7517685Sache# if defined(DARWIN)
7527685Sache#  define HASFCHMOD		1	/* has fchmod(2) */
7537685Sache#  define HASFCHOWN		1	/* has fchown(2) */
7547685Sache#  define HASFLOCK		1	/* has flock(2) */
7557685Sache#  define HASUNAME		1	/* has uname(2) */
7567685Sache#  define HASUNSETENV		1	/* has unsetenv(3) */
7577685Sache#  define HASSETSID		1	/* has POSIX setsid(2) call */
7587685Sache#  define HASINITGROUPS		1	/* has initgroups(3) */
7597685Sache#  define HASSETVBUF		1	/* has setvbuf (3) */
7607685Sache#  define HASSETREUID		0	/* setreuid(2) unusable */
7617685Sache#  define HASSETEUID		1	/* has seteuid(2) */
76239139Sobrien#  define USESETEUID		1	/* has seteuid(2) */
76339139Sobrien#  define HASSETEGID		1	/* has setegid(2) */
7647685Sache#  define HASSETREGID		1	/* has setregid(2) */
7657685Sache#  define HASSETRESGID		0	/* no setresgid(2) */
7667685Sache#  define HASLSTAT		1	/* has lstat(2) */
7677685Sache#  define HASSETRLIMIT		1	/* has setrlimit(2) */
7687685Sache#  define HASWAITPID		1	/* has waitpid(2) */
7697685Sache#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
7707685Sache#  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
7717685Sache#  define HASURANDOMDEV		1	/* has urandom(4) */
7727685Sache#  define HASSTRERROR		1	/* has strerror(3) */
7737685Sache#  define HASGETUSERSHELL	1	/* had getusershell(3) */
7747685Sache#  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
7757685Sache#  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
7767685Sache#  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
7777685Sache#  if DARWIN >= 70000
7787685Sache#   define SOCKADDR_LEN_T	socklen_t
7797685Sache#  endif
7807685Sache#  if DARWIN >= 80000
7817685Sache#   define SPT_TYPE		SPT_REUSEARGV
7827685Sache#   define SPT_PADCHAR		'\0'
7837685Sache#   define SOCKOPT_LEN_T	socklen_t
7847685Sache#  else
7857685Sache#   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
7867685Sache#  endif
7877685Sache#  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
7887685Sache#  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
7897685Sache#  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
7907685Sache#  define HAS_IN_H		1
7917685Sache#  define NETLINK		1	/* supports AF_LINK */
7927685Sache#  ifndef NOT_SENDMAIL
7937685Sache#   define sleep sleepX
79439139Sobrienextern unsigned int sleepX __P((unsigned int seconds));
79539139Sobrien#  endif /* ! NOT_SENDMAIL */
79639139Sobrien# endif /* defined(DARWIN) */
79739139Sobrien
79839139Sobrien
799169590Sgrog/*
800169590Sgrog**  4.4 BSD
80139139Sobrien**
80239139Sobrien**	See also BSD defines.
80339139Sobrien*/
80439139Sobrien
80539139Sobrien# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
80639139Sobrien#  include <paths.h>
80739139Sobrien#  define HASUNSETENV	1	/* has unsetenv(3) call */
80839139Sobrien#  define USESETEUID	1	/* has usable seteuid(2) call */
80939139Sobrien#  define HASFCHMOD	1	/* has fchmod(2) syscall */
81039139Sobrien#  define HASFCHOWN	1	/* has fchown(2) syscall */
81139139Sobrien#  define HASSTRERROR	1	/* has strerror(3) */
81239139Sobrien#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
81339139Sobrien#  include <sys/cdefs.h>
81439139Sobrien#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
81539139Sobrien#  define BSD4_4_SOCKADDR	/* has sa_len */
81639139Sobrien#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
81739139Sobrien#  define NETLINK	1	/* supports AF_LINK */
81839139Sobrien#  ifndef LA_TYPE
81939139Sobrien#   define LA_TYPE	LA_SUBR
82039139Sobrien#  endif /* ! LA_TYPE */
82139139Sobrien#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
82239139Sobrien#  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
82339139Sobrien# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
82439139Sobrien
82539139Sobrien
82639139Sobrien/*
82739139Sobrien**  BSD/OS (was BSD/386) (all versions)
82839139Sobrien**	From Tony Sanders, BSDI
82939139Sobrien*/
83039139Sobrien
83139139Sobrien# ifdef __bsdi__
83239139Sobrien#  include <paths.h>
83339139Sobrien#  define HASUNSETENV	1	/* has the unsetenv(3) call */
83439139Sobrien#  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
83539139Sobrien#  define HASSETSID	1	/* has POSIX setsid(2) call */
83639139Sobrien#  define USESETEUID	1	/* has usable seteuid(2) call */
83739139Sobrien#  define HASFCHMOD	1	/* has fchmod(2) syscall */
83839139Sobrien#  define HASSETLOGIN	1	/* has setlogin(2) */
83939139Sobrien#  define HASUNAME	1	/* has uname(2) syscall */
84039139Sobrien#  define HASSTRERROR	1	/* has strerror(3) */
84139139Sobrien#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
84239139Sobrien#  include <sys/cdefs.h>
84339139Sobrien#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
84439139Sobrien#  define BSD4_4_SOCKADDR	/* has sa_len */
84539139Sobrien#  define NETLINK	1	/* supports AF_LINK */
84639139Sobrien#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
84739139Sobrien#  ifndef LA_TYPE
84839139Sobrien#   define LA_TYPE	LA_SUBR
84939139Sobrien#  endif /* ! LA_TYPE */
85039139Sobrien#  define GIDSET_T	gid_t
85139139Sobrien#  define QUAD_T		quad_t
85239139Sobrien#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
85339139Sobrien			/* version 1.1 or later */
85439139Sobrien#   undef SPT_TYPE
85539139Sobrien#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
85639139Sobrien#  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
85739139Sobrien			/* version 1.0 or earlier */
85839139Sobrien#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
85939139Sobrien#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
86039139Sobrien#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
86139139Sobrien#   define HASSETUSERCONTEXT 1	/* has setusercontext */
86239139Sobrien#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
86339139Sobrien#  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
86439139Sobrien#   define MODE_T	int	/* va_arg() can't handle less than int */
86539139Sobrien#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
86639139Sobrien#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
86739139Sobrien#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
86839139Sobrien#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
86939139Sobrien# endif /* __bsdi__ */
87039139Sobrien
87139139Sobrien
87239139Sobrien# if defined(__QNX__)
87339139Sobrien#  if defined(__QNXNTO__)
87439139Sobrien/* QNX 6 */
87539139Sobrien#   include <unix.h>
87639139Sobrien#   define HASUNSETENV	1	/* has unsetenv(3) call */
87739139Sobrien#   define HASINITGROUPS	1	/* has initgroups(3) call */
87839139Sobrien#   define HASSETSID	1	/* has POSIX setsid(2) call */
87939139Sobrien#   define USESETEUID	1	/* has usable seteuid(2) call */
88039139Sobrien#   define HASFCHMOD	1	/* has fchmod(2) syscall */
88139139Sobrien#   define HASFCHOWN	1	/* has fchown(2) syscall */
88239139Sobrien#   define HASUNAME	1	/* has uname(2) syscall */
88339139Sobrien#   define HASSTRERROR	1	/* has strerror(3) */
88439139Sobrien#   define BSD4_4_SOCKADDR	/* has sa_len */
88539139Sobrien#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
88639139Sobrien#   define NETLINK	1	/* supports AF_LINK */
88739139Sobrien#   define GIDSET_T	gid_t
88839139Sobrien#   define QUAD_T	uint64_t
88939139Sobrien#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
89039139Sobrien#   define HASGETUSERSHELL 0
89139139Sobrien
89239139Sobrien/*
89339139Sobrien**  We have a strrev() that doesn't allocate anything.
89439139Sobrien**  Make sure the one here is used.
89539139Sobrien*/
89637Srgrimes
8971088Swollman#   define strrev strrev_sendmail
89837Srgrimes
8997685Sache#  else /* defined(__QNXNTO__) */
9007685Sache
90168690Sben/*
9027685Sache**  QNX 4.2x
9037685Sache**	Contributed by Glen McCready <glen@qnx.com>.
9047685Sache**
9057685Sache**	Should work with all versions of QNX 4.
9067685Sache*/
9077685Sache
9087685Sache#   include <unix.h>
9097685Sache#   include <sys/select.h>
9107685Sache#   undef NGROUPS_MAX
9117685Sache#   define HASSETSID	1	/* has POSIX setsid(2) call */
9127685Sache#   define USESETEUID	1	/* has usable seteuid(2) call */
9137685Sache#   define HASFCHMOD	1	/* has fchmod(2) syscall */
9147685Sache#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
91539139Sobrien#   define HASSETREUID	1	/* has setreuid(2) call */
9167685Sache#   define HASSTRERROR	1	/* has strerror(3) */
9177685Sache#   define HASFLOCK	0
91837Srgrimes#   undef HASINITGROUPS		/* has initgroups(3) call */
9197685Sache#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
9207685Sache#   define IP_SRCROUTE	1	/* can check IP source routing */
92139139Sobrien#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
92239139Sobrien#   define GIDSET_T	gid_t
9237685Sache#   define LA_TYPE	LA_ZERO
9247685Sache#   define SFS_TYPE	SFS_NONE
9257685Sache#   define SPT_TYPE	SPT_REUSEARGV
9267685Sache#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
9277685Sache#   define HASGETUSERSHELL 0
9287685Sache#   define _FILE_H_INCLUDED
9297685Sache#  endif /* defined(__QNXNTO__) */
9307685Sache# endif /* defined(__QNX__) */
9317685Sache
9327685Sache
9337685Sache/*
93437Srgrimes**  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
9357685Sache**
9367685Sache**  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
9377685Sache**  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
938131994Scperciva**
9397685Sache**	See also BSD defines.
9407685Sache*/
94139139Sobrien
94239139Sobrien# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
94339139Sobrien#  include <paths.h>
94439139Sobrien#  define HASUNSETENV	1	/* has unsetenv(3) call */
94539139Sobrien#  define HASSETSID	1	/* has POSIX setsid(2) call */
94639139Sobrien#  define USESETEUID	1	/* has usable seteuid(2) call */
94739139Sobrien#  define HASFCHMOD	1	/* has fchmod(2) syscall */
94839139Sobrien#  define HASFCHOWN	1	/* has fchown(2) syscall */
9497685Sache#  define HASUNAME	1	/* has uname(2) syscall */
9507685Sache#  define HASSTRERROR	1	/* has strerror(3) */
9517685Sache#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
9527685Sache#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
95339139Sobrien#  include <sys/cdefs.h>
95439139Sobrien#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
95539139Sobrien#  define BSD4_4_SOCKADDR	/* has sa_len */
95639139Sobrien#  define NETLINK	1	/* supports AF_LINK */
95739139Sobrien#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
95839139Sobrien#  define GIDSET_T	gid_t
9597685Sache#  define QUAD_T	unsigned long long
9607685Sache#  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
9617685Sache#  ifndef LA_TYPE
9627685Sache#   define LA_TYPE	LA_SUBR
9637685Sache#  endif /* ! LA_TYPE */
9647685Sache#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
9657685Sache    ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
9667685Sache    (__NetBSD_Version__ >= 299000900))
96739139Sobrien#   undef SFS_TYPE
96839139Sobrien#   define SFS_TYPE	SFS_STATVFS
96939139Sobrien#  else
97039139Sobrien#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
97139139Sobrien#  endif
97239139Sobrien#  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
97339139Sobrien#   undef SPT_TYPE
97439139Sobrien#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
97539139Sobrien#  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
97639139Sobrien#  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
9777685Sache#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
9787685Sache#  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
9797685Sache#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
9807685Sache#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
9817685Sache#  endif
9827685Sache#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
98339139Sobrien    ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
98439139Sobrien    (__NetBSD_Version__ >= 299000900))
985131994Scperciva#   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
986131994Scperciva#  endif
9877685Sache#  if defined(__NetBSD__)
9887685Sache#   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
9897685Sache#   include <sys/param.h>
9907685Sache#   include <sys/sysctl.h>
99191141Scjc#  endif
99291141Scjc#  if defined(__DragonFly__)
99391141Scjc#   define HASSETLOGIN		1	/* has setlogin(2) */
99491141Scjc#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
99539139Sobrien#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
99639139Sobrien#   undef SPT_TYPE
99739139Sobrien#   include <libutil.h>
99839139Sobrien#   define SPT_TYPE		SPT_BUILTIN
9997685Sache#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
10007685Sache#   ifndef SMRSH_CMDDIR
10017685Sache#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
10027685Sache#   endif /* ! SMRSH_CMDDIR */
10037685Sache#   ifndef SMRSH_PATH
10047685Sache#    define SMRSH_PATH		"/bin:/usr/bin"
10057685Sache#   endif /* ! SMRSH_PATH */
10067685Sache#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
100739139Sobrien#  include <sys/sysctl.h>
100839139Sobrien#  endif /* defined(__DragonFly__) */
10097685Sache#  if defined(__FreeBSD__)
10107685Sache#   define HASSETLOGIN	1	/* has setlogin(2) */
10117685Sache#   if __FreeBSD_version >= 227001
10127685Sache#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
10137685Sache#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
10147685Sache#   endif /* __FreeBSD_version >= 227001 */
10157685Sache#   undef SPT_TYPE
10167685Sache#   if __FreeBSD__ >= 2
10177685Sache#    include <osreldate.h>
10187685Sache#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
10197685Sache#     include <libutil.h>
10207685Sache#     define SPT_TYPE	SPT_BUILTIN
10217685Sache#    endif /* __FreeBSD_version >= 199512 */
10227685Sache#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
10237685Sache#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
10247685Sache#    endif /* __FreeBSD_version >= 222000 */
102539139Sobrien#    if __FreeBSD_version >= 300000	/* 3.0.0-release and later */
102639139Sobrien#     define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
10277685Sache#    endif /* __FreeBSD_version >= 300000 */
10287685Sache#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
10297685Sache#     ifndef SMRSH_CMDDIR
10307685Sache#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
103139139Sobrien#     endif /* ! SMRSH_CMDDIR */
1032169784Sgrog#     ifndef SMRSH_PATH
103339139Sobrien#      define SMRSH_PATH	"/bin:/usr/bin"
103439139Sobrien#     endif /* ! SMRSH_PATH */
103539139Sobrien#    endif /* __FreeBSD_version >= 330000 */
103639139Sobrien#    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
103739139Sobrien#     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
103839139Sobrien#     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
10397685Sache#    endif /* __FreeBSD_version >= 430000 */
10407685Sache#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
10417685Sache#    include <sys/sysctl.h>
10427685Sache#   endif /* __FreeBSD__ >= 2 */
104339139Sobrien#   ifndef SPT_TYPE
104439139Sobrien#    define SPT_TYPE	SPT_REUSEARGV
104539139Sobrien#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
104639139Sobrien#   endif /* ! SPT_TYPE */
104739139Sobrien#  endif /* defined(__FreeBSD__) */
104839139Sobrien#  if defined(__OpenBSD__)
104939139Sobrien#   undef SPT_TYPE
105039139Sobrien#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
105139139Sobrien#   define HASSETLOGIN	1	/* has setlogin(2) */
105239139Sobrien#   if OpenBSD < 200305
105339139Sobrien#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
105439139Sobrien#   endif /* OpenBSD < 200305 */
105539139Sobrien#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
105639139Sobrien#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
105739139Sobrien#   if OpenBSD >= 200006
105839139Sobrien#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
105939139Sobrien#   endif /* OpenBSD >= 200006 */
106039139Sobrien#   if OpenBSD >= 200012
106139139Sobrien#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
106239139Sobrien#   endif /* OpenBSD >= 200012 */
106339139Sobrien#   if OpenBSD >= 200405
106439139Sobrien#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
106539139Sobrien#   endif /* OpenBSD >= 200405 */
106639139Sobrien#   if OpenBSD >= 200505
106739139Sobrien#    undef NETISO	/* iso.h removed in 3.7 */
106839139Sobrien#   endif /* OpenBSD >= 200505 */
1069108664Sschweikh#   if OpenBSD >= 200800
1070108664Sschweikh#    define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1071108664Sschweikh#   endif /* OpenBSD >= 200800 */
107291141Scjc#  endif /* defined(__OpenBSD__) */
107339139Sobrien# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
107439139Sobrien
107539139Sobrien
107639139Sobrien/*
107739139Sobrien**  Mach386
107839139Sobrien**
107939139Sobrien**	For mt Xinu's Mach386 system.
108039139Sobrien*/
108139139Sobrien
108239139Sobrien# if defined(MACH) && defined(i386) && !defined(__GNU__)
108339139Sobrien#  define MACH386	1
108439139Sobrien#  define HASUNSETENV	1	/* has unsetenv(3) call */
108539139Sobrien#  define HASINITGROUPS	1	/* has initgroups(3) call */
108639139Sobrien#  ifndef HASFLOCK
108739139Sobrien#   define HASFLOCK	1	/* has flock(2) call */
108839139Sobrien#  endif /* ! HASFLOCK */
108939139Sobrien#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
109039139Sobrien#  define NEEDSTRTOL	1	/* need the strtol() function */
109139139Sobrien#  define setpgid	setpgrp
109239139Sobrien#  ifndef LA_TYPE
109339139Sobrien#   define LA_TYPE	LA_FLOAT
109439139Sobrien#  endif /* ! LA_TYPE */
109539139Sobrien#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
109639139Sobrien#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
109739139Sobrien#  undef WEXITSTATUS
109839139Sobrien#  undef WIFEXITED
109939139Sobrien#  ifndef _PATH_VENDOR_CF
11007685Sache#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
11017685Sache#  endif /* ! _PATH_VENDOR_CF */
1102169784Sgrog#  ifndef _PATH_SENDMAILPID
1103169784Sgrog#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1104169784Sgrog#  endif /* ! _PATH_SENDMAILPID */
1105169784Sgrog# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
1106169784Sgrog
1107169784Sgrog
1108169784Sgrog
1109169784Sgrog/*
1110169784Sgrog**  GNU OS (hurd)
1111169784Sgrog**	Largely BSD & posix compatible.
1112131732Scperciva**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
1113131732Scperciva**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
11147685Sache*/
11157685Sache
111691141Scjc# if defined(__GNU__) && !defined(NeXT)
11177685Sache#  include <paths.h>
11187685Sache#  define HASFCHMOD	1	/* has fchmod(2) call */
11197685Sache#  define HASFCHOWN	1	/* has fchown(2) call */
11207685Sache#  define HASUNAME	1	/* has uname(2) call */
11217685Sache#  define HASUNSETENV	1	/* has unsetenv(3) call */
11227685Sache#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
11237685Sache#  define HASSTRERROR	1	/* has strerror(3) */
1124169784Sgrog#  define GIDSET_T	gid_t
1125169784Sgrog#  define SOCKADDR_LEN_T	socklen_t
1126169784Sgrog#  define SOCKOPT_LEN_T	socklen_t
1127169784Sgrog#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
112880266Sdougb#   define LA_TYPE	LA_SUBR
112980266Sdougb#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1130169784Sgrog#   define LA_TYPE	LA_MACH
1131169784Sgrog   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
1132169784Sgrog#   define host_self	mach_host_self
1133169784Sgrog#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1134169784Sgrog#  define SFS_TYPE	SFS_STATFS
1135169784Sgrog#  define SPT_TYPE	SPT_CHANGEARGV
1136169784Sgrog#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
1137169784Sgrog#  define BSD4_4_SOCKADDR	1	/* has sa_len */
1138169784Sgrog#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
1139169784Sgrog#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
1140169784Sgrog/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
1141169784Sgrog#  define MAXPATHLEN	2048
1142169784Sgrog# endif /* defined(__GNU__) && !defined(NeXT) */
1143169784Sgrog
1144169784Sgrog/*
1145169784Sgrog**  4.3 BSD -- this is for very old systems
1146169784Sgrog**
1147169784Sgrog**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
1148169784Sgrog**
1149169784Sgrog**	You'll also have to install a new resolver library.
1150169784Sgrog**	I don't guarantee that support for this environment is complete.
1151169784Sgrog*/
1152169784Sgrog
1153169784Sgrog# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
1154169784Sgrog#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
1155169784Sgrog#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1156169784Sgrog#  define ARBPTR_T	char *
1157169784Sgrog#  define setpgid	setpgrp
1158169784Sgrog#  ifndef LA_TYPE
1159169784Sgrog#   define LA_TYPE	LA_FLOAT
1160169784Sgrog#  endif /* ! LA_TYPE */
1161169784Sgrog#  ifndef _PATH_VENDOR_CF
1162131994Scperciva#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1163131994Scperciva#  endif /* ! _PATH_VENDOR_CF */
1164169784Sgrog#  ifndef IDENTPROTO
1165169784Sgrog#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1166169784Sgrog#  endif /* ! IDENTPROTO */
1167169784Sgrog#  undef WEXITSTATUS
11687685Sache#  undef WIFEXITED
11697685Sachetypedef short		pid_t;
1170169784Sgrog# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
1171169784Sgrog
1172131994Scperciva
1173131994Scperciva/*
1174169784Sgrog**  SCO Unix
1175169784Sgrog**
1176169784Sgrog**	This includes three parts:
1177169784Sgrog**
1178169784Sgrog**	The first is for SCO OpenServer 5.
1179169784Sgrog**	(Contributed by Keith Reynolds <keithr@sco.COM>).
1180169784Sgrog**
1181169784Sgrog**		SCO OpenServer 5 has a compiler version number macro,
1182169784Sgrog**		which we can use to figure out what version we're on.
1183169784Sgrog**		This may have to change in future releases.
1184169784Sgrog**
1185169784Sgrog**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
1186169784Sgrog**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
1187169784Sgrog**
1188169784Sgrog**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
1189169784Sgrog*/
1190169784Sgrog
1191169784Sgrog/* SCO OpenServer 5 */
1192169784Sgrog# if _SCO_DS >= 1
1193169784Sgrog#  include <paths.h>
1194169784Sgrog#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
1195169784Sgrog#  define HASFCHMOD	1	/* has fchmod(2) call */
1196169784Sgrog#  define HASFCHOWN	1	/* has fchown(2) call */
1197169784Sgrog#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
1198169784Sgrog#  define USESETEUID	1	/* has seteuid(2) call */
1199169784Sgrog#  define HASINITGROUPS	1	/* has initgroups(3) call */
1200169784Sgrog#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
1201169784Sgrog#  define RLIMIT_NEEDS_SYS_TIME_H	1
1202169784Sgrog#  define LDA_USE_LOCKF	1
1203169784Sgrog#  ifndef LA_TYPE
1204169784Sgrog#   define LA_TYPE	LA_DEVSHORT
1205169784Sgrog#  endif /* ! LA_TYPE */
1206169784Sgrog#  define _PATH_AVENRUN	"/dev/table/avenrun"
1207169784Sgrog#  ifndef _SCO_unix_4_2
1208131994Scperciva#   define _SCO_unix_4_2
1209131994Scperciva#  else /* ! _SCO_unix_4_2 */
1210169784Sgrog#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1211169784Sgrog#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
1212169784Sgrog#  endif /* ! _SCO_unix_4_2 */
1213169784Sgrog# endif /* _SCO_DS >= 1 */
1214169784Sgrog
1215169784Sgrog/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
1216169784Sgrog# ifdef _SCO_unix_4_2
1217169784Sgrog#  define _SCO_unix_
1218169784Sgrog#  define HASSETREUID	1	/* has setreuid(2) call */
1219169784Sgrog# endif /* _SCO_unix_4_2 */
1220169784Sgrog
1221169784Sgrog/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
1222169784Sgrog# ifdef _SCO_unix_
1223169784Sgrog#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1224169784Sgrog#  define SYSTEM5	1	/* include all the System V defines */
1225169784Sgrog#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1226169784Sgrog#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
1227169784Sgrog#  ifndef USE_SIGLONGJMP
1228169784Sgrog#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1229169784Sgrog#  endif /* ! USE_SIGLONGJMP */
123091141Scjc#  define MAXPATHLEN	PATHSIZE
123191141Scjc#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
12327685Sache#  define SFS_BAVAIL	f_bfree		/* alternate field name */
12337685Sache#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
12347685Sache#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
12357685Sache#  define UID_T		uid_t
1236169784Sgrog#  define GID_T		gid_t
1237169784Sgrog#  define GIDSET_T	gid_t
1238169784Sgrog#  define _PATH_UNIX		"/unix"
1239169784Sgrog#  ifndef _PATH_VENDOR_CF
1240169784Sgrog#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1241169784Sgrog#  endif /* ! _PATH_VENDOR_CF */
1242169784Sgrog#  ifndef _PATH_SENDMAILPID
1243169784Sgrog#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1244169784Sgrog#  endif /* ! _PATH_SENDMAILPID */
1245169784Sgrog
1246169784Sgrog/* stuff fixed in later releases */
1247169784Sgrog#  ifndef _SCO_unix_4_2
1248169784Sgrog#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1249169784Sgrog#  endif /* ! _SCO_unix_4_2 */
125065465Ssheldonh
125165465Ssheldonh#  ifndef _SCO_DS
1252169784Sgrog#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
1253169784Sgrog#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1254169784Sgrog#   define NETUNIX	0	/* no unix domain socket support */
1255169784Sgrog#   define LA_TYPE	LA_SHORT
1256208060Sdougb#  endif /* ! _SCO_DS */
1257208060Sdougb
1258169784Sgrog# endif /* _SCO_unix_ */
1259169784Sgrog
1260169784Sgrog/*
1261169784Sgrog**  ISC (SunSoft) Unix.
1262169784Sgrog**
1263169784Sgrog**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
1264169784Sgrog*/
1265169784Sgrog
1266169784Sgrog# ifdef ISC_UNIX
1267169784Sgrog#  include <net/errno.h>
1268208060Sdougb#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1269208060Sdougb#  include <sys/bsdtypes.h>
1270169784Sgrog#  define SYSTEM5	1	/* include all the System V defines */
1271169784Sgrog#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1272169784Sgrog#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1273169784Sgrog#  define HASSETREUID	1	/* has setreuid(2) call */
1274169784Sgrog#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1275169784Sgrog#  define NETUNIX	0	/* no unix domain socket support */
1276169784Sgrog#  define MAXPATHLEN	1024
1277169784Sgrog#  define LA_TYPE	LA_SHORT
1278169784Sgrog#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1279169784Sgrog#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1280169784Sgrog#  define _PATH_UNIX		"/unix"
1281169784Sgrog#  ifndef _PATH_VENDOR_CF
1282169784Sgrog#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1283169784Sgrog#  endif /* ! _PATH_VENDOR_CF */
1284169784Sgrog#  ifndef _PATH_SENDMAILPID
1285169784Sgrog#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1286169784Sgrog#  endif /* ! _PATH_SENDMAILPID */
1287169784Sgrog# endif /* ISC_UNIX */
1288169784Sgrog
1289169784Sgrog
1290169784Sgrog/*
1291169784Sgrog**  Altos System V (5.3.1)
1292169784Sgrog**	Contributed by Tim Rice <tim@trr.metro.net>.
1293169784Sgrog*/
1294169784Sgrog
1295169784Sgrog# ifdef ALTOS_SYSTEM_V
1296169784Sgrog#  include <sys/stream.h>
1297169784Sgrog#  include <limits.h>
1298169784Sgrog#  define SYSTEM5	1	/* include all the System V defines */
1299169784Sgrog#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1300169784Sgrog#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1301169784Sgrog#  define WAITUNION	1	/* use "union wait" as wait argument type */
1302169784Sgrog#  define NEEDFSYNC	1	/* no fsync(2) in system library */
1303169784Sgrog#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
1304169784Sgrog#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
1305169784Sgrog#  define MAXPATHLEN	PATH_MAX
1306169784Sgrog#  define LA_TYPE	LA_SHORT
1307169784Sgrog#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
13087685Sache#  define SFS_BAVAIL	f_bfree		/* alternate field name */
13097685Sache#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
1310169784Sgrog#  define NETUNIX	0	/* no unix domain socket support */
1311169784Sgrog#  undef WIFEXITED
1312169784Sgrog#  undef WEXITSTATUS
1313169784Sgrog#  define strtoul	strtol	/* gcc library bogosity */
1314169784Sgrog
1315169784Sgrogtypedef unsigned short	uid_t;
13167685Sachetypedef unsigned short	gid_t;
13177685Sachetypedef short		pid_t;
1318169784Sgrogtypedef unsigned long	mode_t;
1319169784Sgrog
1320169784Sgrog/* some stuff that should have been in the include files */
1321169784Sgrogextern char		*malloc();
1322169784Sgrogextern struct passwd	*getpwent();
1323169784Sgrogextern struct passwd	*getpwnam();
1324208060Sdougbextern struct passwd	*getpwuid();
1325208060Sdougbextern char		*getenv();
1326169784Sgrogextern struct group	*getgrgid();
1327169784Sgrogextern struct group	*getgrnam();
1328169784Sgrog
1329169784Sgrog# endif /* ALTOS_SYSTEM_V */
13307685Sache
13317685Sache
13327685Sache/*
13337685Sache**  ConvexOS 11.0 and later
13347685Sache**
13357685Sache**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
13367685Sache**	works on 9.1 as well.
13377685Sache**
13387685Sache**  ConvexOS 11.5 and later, should work on 11.0 as defined.
13397685Sache**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
13407685Sache**
13417685Sache**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
13427685Sache**		(now the CONVEX Technologies Center of Hewlett Packard)
13437685Sache*/
13447685Sache
13457685Sache# ifdef _CONVEX_SOURCE
1346131994Scperciva#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
1347131994Scperciva#  define HASINITGROUPS	1	/* has initgroups(3) */
1348131994Scperciva#  define HASUNAME	1	/* use System V uname(2) system call */
1349131994Scperciva#  define HASSETSID	1	/* has POSIX setsid(2) call */
13507685Sache#  define HASUNSETENV	1	/* has unsetenv(3) */
135129928Smarkm#  define HASFLOCK	1	/* has flock(2) */
135229928Smarkm#  define HASSETRLIMIT	1	/* has setrlimit(2) */
13537685Sache#  define HASSETREUID	1	/* has setreuid(2) */
135491141Scjc#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
135591141Scjc#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
13567685Sache#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
13577685Sache#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
13587685Sache#  define LA_TYPE	LA_FLOAT
13597685Sache#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
13607685Sache#  ifndef _PATH_VENDOR_CF
13617685Sache#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
13627685Sache#  endif /* ! _PATH_VENDOR_CF */
13637685Sache#  ifndef S_IREAD
1364131994Scperciva#   define S_IREAD	_S_IREAD
13659882Sache#   define S_IWRITE	_S_IWRITE
1366131994Scperciva#   define S_IEXEC	_S_IEXEC
13679882Sache#   define S_IFMT	_S_IFMT
1368131994Scperciva#   define S_IFCHR	_S_IFCHR
13697685Sache#   define S_IFBLK	_S_IFBLK
13707685Sache#  endif /* ! S_IREAD */
13717685Sache#  ifndef TZ_TYPE
13727685Sache#   define TZ_TYPE	TZ_TIMEZONE
1373131994Scperciva#  endif /* ! TZ_TYPE */
13747685Sache#  ifndef IDENTPROTO
13757685Sache#   define IDENTPROTO	1
13767685Sache#  endif /* ! IDENTPROTO */
13777685Sache#  ifndef SHARE_V1
1378131994Scperciva#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
13797685Sache#  endif /* ! SHARE_V1 */
13807685Sache#  if !defined(__GNUC__ )
13817685Sache#   define UID_T	int		/* GNUC gets it right, ConvexC botches */
13827685Sache#   define GID_T	int		/* GNUC gets it right, ConvexC botches */
13837685Sache#  endif /* !defined(__GNUC__ ) */
13847685Sache#  if SECUREWARE
13857685Sache#   define FORK	fork		/* SecureWare wants the real fork! */
13867685Sache#  else /* SECUREWARE */
13877685Sache#   define FORK	vfork		/* the rest of the OS versions don't care */
13887685Sache#  endif /* SECUREWARE */
13897685Sache# endif /* _CONVEX_SOURCE */
1390705Swollman
13917685Sache
13927685Sache/*
13937685Sache**  RISC/os 4.52
13947685Sache**
13957685Sache**	Gives a ton of warning messages, but otherwise compiles.
13967685Sache*/
13977685Sache
13987685Sache# ifdef RISCOS
13997685Sache
14007685Sache#  define HASUNSETENV	1	/* has unsetenv(3) call */
14017685Sache#  ifndef HASFLOCK
14027685Sache#   define HASFLOCK	1	/* has flock(2) call */
14037685Sache#  endif /* ! HASFLOCK */
14047685Sache#  define WAITUNION	1	/* use "union wait" as wait argument type */
14057685Sache#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
14067685Sache#  define NEEDPUTENV	1	/* need putenv(3) call */
14077685Sache#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
14087685Sache#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1409169784Sgrog#  define LA_TYPE	LA_INT
1410169784Sgrog#  define LA_AVENRUN	"avenrun"
14117685Sache#  define _PATH_UNIX	"/unix"
14127685Sache#  undef WIFEXITED
141391141Scjc
141491141Scjc#  define setpgid	setpgrp
14157685Sache
14167685Sachetypedef int		pid_t;
1417169784Sgrog#  define SIGFUNC_DEFINED
1418169784Sgrog#  define SIGFUNC_RETURN	(0)
1419169784Sgrog#  define SIGFUNC_DECL	int
1420169784Sgrogtypedef int		(*sigfunc_t)();
1421169784Sgrogextern char		*getenv();
1422169784Sgrogextern void		*malloc();
1423169784Sgrog
1424169784Sgrog/* added for RISC/os 4.01...which is dumber than 4.50 */
1425208060Sdougb#  ifdef RISCOS_4_0
1426169784Sgrog#   ifndef ARBPTR_T
1427169784Sgrog#    define ARBPTR_T	char *
1428169784Sgrog#   endif /* ! ARBPTR_T */
1429169784Sgrog#   undef HASFLOCK
1430169784Sgrog#   define HASFLOCK	0
1431169784Sgrog#  endif /* RISCOS_4_0 */
1432169784Sgrog
1433169784Sgrog#  include <sys/time.h>
1434169784Sgrog
1435169784Sgrog# endif /* RISCOS */
1436169784Sgrog
1437169784Sgrog
1438169784Sgrog/*
1439131994Scperciva**  Linux 0.99pl10 and above...
144080266Sdougb**
144180266Sdougb**  Thanks to, in reverse order of contact:
1442169784Sgrog**
1443169784Sgrog**	John Kennedy <warlock@csuchico.edu>
1444169784Sgrog**	Andrew Pam <avatar@aus.xanadu.com>
1445169784Sgrog**	Florian La Roche <rzsfl@rz.uni-sb.de>
14467685Sache**	Karl London <karl@borg.demon.co.uk>
14477685Sache**
1448169784Sgrog**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
1449169784Sgrog**	file locking is no longer allowed.  In particular, make sure
1450131994Scperciva**	your DBM library and sendmail are both using either flock(2)
1451169784Sgrog**	*or* fcntl(2) file locking, but not both.
1452169784Sgrog*/
1453169784Sgrog
1454169784Sgrog# ifdef __linux__
1455169784Sgrog#  include <linux/version.h>
1456169784Sgrog#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
1457208060Sdougb#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
1458169784Sgrog#  endif /* !defined(KERNEL_VERSION) */
1459169784Sgrog#  define BSD		1	/* include BSD defines */
1460169784Sgrog#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
1461169784Sgrog#  ifndef REQUIRES_DIR_FSYNC
1462169784Sgrog#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
1463169784Sgrog#  endif /* REQUIRES_DIR_FSYNC */
1464208060Sdougb#  ifndef USESETEUID
1465131994Scperciva#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
1466131994Scperciva#  endif /* USESETEUID */
146780266Sdougb#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1468131994Scperciva#  define HASUNAME	1	/* use System V uname(2) system call */
146980266Sdougb#  define HASUNSETENV	1	/* has unsetenv(3) call */
1470169784Sgrog#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
1471169784Sgrog#  define GIDSET_T	gid_t	/* from <linux/types.h> */
1472131994Scperciva#  ifndef HASGETUSERSHELL
147380266Sdougb#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
1474131994Scperciva#  endif /* HASGETUSERSHELL */
147580266Sdougb#  ifndef IP_SRCROUTE
1476131994Scperciva#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
147780266Sdougb#  endif /* ! IP_SRCROUTE */
1478131994Scperciva#  ifndef HAS_IN_H
1479131994Scperciva#   define HAS_IN_H	1	/* use netinet/in.h */
14807685Sache#  endif /* ! HAS_IN_H */
14817685Sache#  ifndef USE_SIGLONGJMP
14827685Sache#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
14837685Sache#  endif /* ! USE_SIGLONGJMP */
14847685Sache#  ifndef HASFLOCK
14857685Sache#   if LINUX_VERSION_CODE < 66399
14867685Sache#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
1487131994Scperciva#   else /* LINUX_VERSION_CODE < 66399 */
14887685Sache#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
14897685Sache#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1490120910Sbms#     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1491120910Sbms#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1492169784Sgrog#     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1493169784Sgrog#   endif /* LINUX_VERSION_CODE < 66399 */
1494169784Sgrog#  endif /* ! HASFLOCK */
1495169784Sgrog#  ifndef LA_TYPE
1496169784Sgrog#   define LA_TYPE	LA_PROCSTR
1497169784Sgrog#  endif /* ! LA_TYPE */
1498705Swollman#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
14997685Sache#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
1500705Swollman#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
15017685Sache#   ifndef HASURANDOMDEV
15027685Sache#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
15037685Sache#   endif /* ! HASURANDOMDEV */
15047685Sache#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
15057685Sache#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
15067685Sache#   define HASSTRERROR	1	/* has strerror(3) */
15077685Sache#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
15087685Sache#  ifndef TZ_TYPE
15097685Sache#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
15107685Sache#  endif /* ! TZ_TYPE */
15117685Sache#  if (__GLIBC__ >= 2)
15127685Sache#   include <paths.h>
151391141Scjc#  endif /* (__GLIBC__ >= 2) */
151491141Scjc#  ifndef _PATH_SENDMAILPID
151591141Scjc#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
151691141Scjc#  endif /* ! _PATH_SENDMAILPID */
15177685Sache#  include <sys/sysmacros.h>
15187685Sache#  undef atol			/* wounded in <stdlib.h> */
15197685Sache#  if NETINET6
15207685Sache   /*
15217685Sache   **  Linux doesn't have a good way to tell userland what interfaces are
15227685Sache   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
1523108008Seric   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
1524108008Seric   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
152580662Sdougb   */
152680662Sdougb#   define ADDRCONFIG_IS_BROKEN	1
15277685Sache
15287685Sache   /*
1529131994Scperciva   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
153091141Scjc   **  in 2.1 and later, but the APIs appear before the functions.
153191141Scjc   */
1532215249Stuexen#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1533215249Stuexen#    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
1534215249Stuexen#    if (GLIBC_VERSION >= 0x201)
153517771Sasami#     define SOCKADDR_LEN_T     socklen_t
1536197728Srpaulo#     define SOCKOPT_LEN_T      socklen_t
1537197728Srpaulo#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
15387685Sache#    else /* (GLIBC_VERSION >= 0x201) */
15397685Sache#     include <linux/in6.h>	/* IPv6 support */
154091141Scjc#    endif /* (GLIBC_VERSION >= 0x201) */
154191141Scjc#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
15427685Sache     /* Have APIs in <netdb.h>, but no support in glibc */
15437685Sache#     define NEEDSGETIPNODE	1
154466668Ssheldonh#    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
154566668Ssheldonh#    undef GLIBC_VERSION
154691141Scjc#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
154791141Scjc#  endif /* NETINET6 */
15487685Sache#  ifndef HASFCHOWN
15497685Sache#   define HASFCHOWN	1	/* fchown(2) */
15507685Sache#  endif /* ! HASFCHOWN */
15517685Sache#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
155291141Scjc#    define HASFCHMOD	1	/* fchmod(2) */
155391141Scjc#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
155491141Scjc# endif /* __linux__ */
155591141Scjc
155691141Scjc
155791141Scjc/*
155891141Scjc**  DELL SVR4 Issue 2.2, and others
155991141Scjc**	From Kimmo Suominen <kim@grendel.lut.fi>
156091141Scjc**
156191141Scjc**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
156291141Scjc**	defined, and the definitions conflict.
156391141Scjc**
15647685Sache**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
15657685Sache**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
156691141Scjc**	(SVR4.0/386 version 3.0).
156791141Scjc*/
156891141Scjc
156991141Scjc# ifdef DELL_SVR4
15707685Sache				/* no changes necessary */
15717685Sache				/* see general __svr4__ defines below */
15727685Sache# endif /* DELL_SVR4 */
15737685Sache
15747685Sache
15757685Sache/*
15767685Sache**  Apple A/UX 3.0
15777685Sache*/
15787685Sache
15797685Sache# ifdef _AUX_SOURCE
15807685Sache#  include <sys/sysmacros.h>
15817685Sache#  define BSD			/* has BSD routines */
158291141Scjc#  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
158391141Scjc#  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
15847685Sache#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
15857685Sache#  define HASUNAME	1	/* use System V uname(2) system call */
15867685Sache#  define HASFCHMOD	1	/* has fchmod(2) syscall */
15877685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
15887685Sache#  define HASSETVBUF	1	/* has setvbuf(3) in libc */
15897685Sache#  define HASSTRERROR	1	/* has strerror(3) */
15907685Sache#  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
15917685Sache#  define SIGFUNC_RETURN		/* POSIX-mode */
159291141Scjc#  define SIGFUNC_DECL	void	/* POSIX-mode */
159391141Scjc#  define ERRLIST_PREDEFINED	1
159491141Scjc#  ifndef IDENTPROTO
159591141Scjc#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
159691141Scjc#  endif /* ! IDENTPROTO */
159791141Scjc#  ifndef LA_TYPE
159891141Scjc#   define LA_TYPE	LA_INT
159991141Scjc#   define FSHIFT	16
16007685Sache#  endif /* ! LA_TYPE */
16017685Sache#  define LA_AVENRUN	"avenrun"
160291141Scjc#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
160391141Scjc#  define TZ_TYPE	TZ_TZNAME
16047685Sache#  ifndef _PATH_UNIX
16057685Sache#   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
160691141Scjc#  endif /* ! _PATH_UNIX */
160791141Scjc#  ifndef _PATH_VENDOR_CF
160891141Scjc#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
160991141Scjc#  endif /* ! _PATH_VENDOR_CF */
161091141Scjc#  undef WIFEXITED
161191141Scjc#  undef WEXITSTATUS
161291141Scjc# endif /* _AUX_SOURCE */
161391141Scjc
161491141Scjc
161591141Scjc/*
161691141Scjc**  Encore UMAX V
161791141Scjc**
161891141Scjc**	Not extensively tested.
161991141Scjc*/
16207685Sache
16217685Sache# ifdef UMAXV
162291141Scjc#  define HASUNAME	1	/* use System V uname(2) system call */
162391141Scjc#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
16247685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
16257685Sache#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
162691141Scjc#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
162791141Scjc#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
162891141Scjc#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
162991141Scjc#  define MAXPATHLEN	PATH_MAX
16307685Sacheextern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
16317685Sacheextern struct group	*getgrent(), *getgrnam(), *getgrgid();
163291141Scjc#  undef WIFEXITED
163391141Scjc#  undef WEXITSTATUS
163491141Scjc# endif /* UMAXV */
163591141Scjc
163691141Scjc
163791141Scjc/*
163891141Scjc**  Stardent Titan 3000 running TitanOS 4.2.
163991141Scjc**
164091141Scjc**	Must be compiled in "cc -43" mode.
164191141Scjc**
164291141Scjc**	From Kate Hedstrom <kate@ahab.rutgers.edu>.
164391141Scjc**
164491141Scjc**	Note the tweaking below after the BSD defines are set.
164591141Scjc*/
164691141Scjc
164791141Scjc# ifdef titan
164891141Scjc#  define setpgid	setpgrp
164991141Scjctypedef int		pid_t;
165091141Scjc#  undef WIFEXITED
165191141Scjc#  undef WEXITSTATUS
165291141Scjc# endif /* titan */
165391141Scjc
165491141Scjc
165591141Scjc/*
165691141Scjc**  Sequent DYNIX 3.2.0
165791141Scjc**
16587685Sache**	From Jim Davis <jdavis@cs.arizona.edu>.
16597685Sache*/
16607685Sache
16617685Sache# ifdef sequent
16627685Sache
16637685Sache#  define BSD		1
16647685Sache#  define HASUNSETENV	1
16657685Sache#  define BSD4_3		1	/* to get signal() in conf.c */
16667685Sache#  define WAITUNION	1
16677685Sache#  define LA_TYPE	LA_FLOAT
166891141Scjc#  ifdef _POSIX_VERSION
166991141Scjc#   undef _POSIX_VERSION		/* set in <unistd.h> */
167091141Scjc#  endif /* _POSIX_VERSION */
167191141Scjc#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
167291141Scjc#  define setpgid	setpgrp
167391141Scjc
167491141Scjc/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
167591141Scjc#  undef	WIFEXITED
167691141Scjc#  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
167791141Scjc			 ((union wait*)&(s))->w_termsig == 0)
16787685Sache#  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
16797685Sachetypedef int		pid_t;
16807685Sache#  define isgraph(c)	(isprint(c) && (c != ' '))
16817685Sache
168291141Scjc#  ifndef IDENTPROTO
168391141Scjc#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
16847685Sache#  endif /* ! IDENTPROTO */
16857685Sache
168691141Scjc#  ifndef _PATH_UNIX
168791141Scjc#   define _PATH_UNIX		"/dynix"
168891141Scjc#  endif /* ! _PATH_UNIX */
168991141Scjc#  ifndef _PATH_VENDOR_CF
169091141Scjc#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
169191141Scjc#  endif /* ! _PATH_VENDOR_CF */
169291141Scjc# endif /* sequent */
169391141Scjc
169491141Scjc
169591141Scjc/*
16967685Sache**  Sequent DYNIX/ptx v2.0 (and higher)
16977685Sache**
169891141Scjc**	For DYNIX/ptx v1.x, undefine HASSETREUID.
169991141Scjc**
170091141Scjc**	From Tim Wright <timw@sequent.com>.
170191141Scjc**	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
170291141Scjc**		for DYNIX/ptx 4.0.2.
170391141Scjc*/
170491141Scjc
170591141Scjc# ifdef _SEQUENT_
17067685Sache#  include <sys/stream.h>
17077685Sache#  define SYSTEM5	1	/* include all the System V defines */
170891141Scjc#  define HASSETSID	1	/* has POSIX setsid(2) call */
170991141Scjc#  define HASINITGROUPS	1	/* has initgroups(3) call */
17107685Sache#  define HASSETREUID	1	/* has setreuid(2) call */
17117685Sache#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
171291141Scjc#  define GIDSET_T	gid_t
171391141Scjc#  define LA_TYPE	LA_INT
171491141Scjc#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
171591141Scjc#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
17167685Sache#  ifndef IDENTPROTO
17177685Sache#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
171891141Scjc#  endif /* ! IDENTPROTO */
171991141Scjc#  ifndef _PATH_VENDOR_CF
172091141Scjc#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
172191141Scjc#  endif /* ! _PATH_VENDOR_CF */
17227685Sache#  ifndef _PATH_SENDMAILPID
172391141Scjc#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
17247685Sache#  endif /* ! _PATH_SENDMAILPID */
17257685Sache# endif /* _SEQUENT_ */
17267685Sache
17277685Sache/*
17287685Sache**  Cray UNICOS, UNICOS/mk, and UNICOS/mp
17297685Sache**
173091141Scjc**    UNICOS:
173191141Scjc**	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
173291141Scjc**	Update Brian Ginsbach <ginsbach@cray.com>
173391141Scjc**    UNICOS/mk (Cray T3E):
173491141Scjc**	Contributed by Manu Mahonen <mailadm@csc.fi>
173591141Scjc**	of Center for Scientific Computing.
173691141Scjc**	Update Brian Ginsbach <ginsbach@cray.com>
173791141Scjc**    UNICOS/mp:
173891141Scjc**	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
173991141Scjc*/
174091141Scjc
174191141Scjc# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
174291141Scjc#  define SYSTEM5	1	/* include all the System V defines */
174391141Scjc#  define HASFCHMOD	1	/* has fchmod(2) syscall */
174491141Scjc#  define HASFCHOWN	1	/* has fchown(2) */
174591141Scjc#  define HASUNSETENV	1	/* has unsetenv(3) call */
17467685Sache#  define HASINITGROUPS	1	/* has initgroups(3) call */
17477685Sache#  define HASSETREUID	1	/* has setreuid(2) call */
17487685Sache#  define USESETEUID	1	/* has usable seteuid(2) call */
17497685Sache#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
17507685Sache#  define HASSTRERROR	1	/* has strerror(3) */
17517685Sache#  define GIDSET_T	gid_t
17527685Sache#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
17537685Sache#  define SFS_BAVAIL	f_bfree	/* alternate field name */
175491141Scjc#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
175591141Scjc#  ifdef UNICOS
17567685Sache#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
17577685Sache#   define LA_TYPE	LA_ZERO
175891141Scjc#   define _PATH_MAILDIR	"/usr/spool/mail"
175991141Scjc#   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
176091141Scjc#   ifndef MAXPATHLEN
176191141Scjc#    define MAXPATHLEN PATHSIZE
176291141Scjc#   endif /* ! MAXPATHLEN */
176391141Scjc#   ifndef _PATH_UNIX
176491141Scjc#    ifdef UNICOSMK
176591141Scjc#     define _PATH_UNIX		"/unicosmk.ar"
17667685Sache#    else
17677685Sache#     define _PATH_UNIX		"/unicos"
1768131994Scperciva#    endif /* UNICOSMK */
1769131994Scperciva#   endif /* ! _PATH_UNIX */
1770131994Scperciva#   ifndef _PATH_VENDOR_CF
1771131994Scperciva#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1772131994Scperciva#   endif /* ! _PATH_VENDOR_CF */
1773131994Scperciva#  endif /* UNICOS */
1774131994Scperciva#  ifdef _UNICOSMP
1775131994Scperciva#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1776131994Scperciva    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1777131994Scperciva#   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1778131994Scperciva#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
1779131994Scperciva#   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
17807685Sache#   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
17817685Sache#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1782131994Scperciva#   include <sys/cdefs.h>
1783131994Scperciva#   include <paths.h>
1784131994Scperciva#   define ARGV_T char *const *
1785131994Scperciva#  endif /* _UNICOSMP */
1786131994Scperciva# endif /* _CRAY */
1787131994Scperciva
17887685Sache/*
17897685Sache**  Apollo DomainOS
17907685Sache**
17917685Sache**  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
1792131994Scperciva**
1793131994Scperciva**  15 Jan 1994; updated 2 Aug 1995
1794131994Scperciva**
1795131994Scperciva*/
17967685Sache
17977685Sache# ifdef apollo
17987685Sache#  define HASSETREUID	1	/* has setreuid(2) call */
17997685Sache#  define HASINITGROUPS	1	/* has initgroups(2) call */
18007685Sache#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
18017685Sache#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
18027685Sache#  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
18037685Sache#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1804131994Scperciva#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1805131994Scperciva#  define TZ_TYPE	TZ_TZNAME
18067685Sache#  ifndef _PATH_VENDOR_CF
18077685Sache#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
18087685Sache#  endif /* ! _PATH_VENDOR_CF */
18097685Sache#  ifndef _PATH_SENDMAILPID
18107685Sache#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
18117685Sache#  endif /* ! _PATH_SENDMAILPID */
18127685Sache#  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
18137685Sache#  undef	 S_IFIFO
18147685Sache#  define S_IFIFO	0010000
18157685Sache#  ifndef IDENTPROTO
18167685Sache#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
18177685Sache#  endif /* ! IDENTPROTO */
1818131994Scperciva#  define RLIMIT_NEEDS_SYS_TIME_H	1
1819131994Scperciva#  if defined(NGROUPS_MAX) && !NGROUPS_MAX
1820131994Scperciva#   undef NGROUPS_MAX
1821131994Scperciva#  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
1822131994Scperciva# endif /* apollo */
1823131994Scperciva
18247685Sache/*
18257685Sache**  MPE-iX
18267685Sache**
18277685Sache**	Requires MPE 6.0 or greater.  See sendmail/README for more info.
18287685Sache**
18297685Sache**	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
18307685Sache*/
18317685Sache
18327685Sache# ifdef MPE
18337685Sache
18347685Sache#  include <sys/sysmacros.h>
18357685Sache#  include <fcntl.h>
18367685Sache
18377685Sache/* Sendmail stuff */
18387685Sache#  define HASFCHOWN		0	/* lacks fchown() */
18397685Sache#  define HASGETUSERSHELL	0	/* lacks getusershell() */
18407685Sache#  ifdef HASNICE
18417685Sache#   undef  HASNICE
18427685Sache#  endif /* HASNICE */
18437685Sache#  define HASNICE		0	/* lacks nice() */
18447685Sache#  define HASRANDOM		0	/* lacks random() */
18457685Sache#  ifdef HASRRESVPORT
18467685Sache#   undef HASRRESVPORT
18477685Sache#  endif /* HASRRESVPORT */
18487685Sache#  define HASRRESVPORT		0	/* lacks rresvport() */
18497685Sache#  define IP_SRCROUTE		0	/* lacks IP source routing fields */
18507685Sache#  ifdef MATCHGECOS
18517685Sache#   undef MATCHGECOS
1852131994Scperciva#  endif /* MATCHGECOS */
1853131994Scperciva#  define MATCHGECOS		0	/* lacks an initialized GECOS field */
1854131994Scperciva#  define NEEDFSYNC		1	/* use sendmail's fsync() */
1855131994Scperciva#  define NEEDLINK		1	/* use sendmail's link() */
1856131994Scperciva#  define NOFTRUNCATE		1	/* lacks ftruncate() */
1857131994Scperciva#  define SFS_TYPE		SFS_NONE /* can't determine disk space */
1858131994Scperciva#  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
1859131994Scperciva#  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
1860131994Scperciva#  define USE_ENVIRON		1	/* use environ instead of envp */
1861131994Scperciva
1862131994Scperciva/* Missing header stuff */
1863131994Scperciva#  define AF_UNSPEC		0
1864131994Scperciva#  define AF_MAX		AF_INET
1865131994Scperciva#  define IFF_LOOPBACK		0x8
1866131994Scperciva#  define IN_LOOPBACKNET	127
1867131994Scperciva#  define MAXNAMLEN		NAME_MAX
18687685Sache#  define S_IEXEC		S_IXUSR
18697685Sache#  define S_IREAD		S_IRUSR
18707685Sache#  define S_IWRITE		S_IWUSR
18717685Sache
1872131994Scperciva/* Present header stuff that needs to be missing */
1873131994Scperciva#  undef NGROUPS_MAX
1874131994Scperciva
1875131994Scperciva/* Shadow functions */
18767685Sache#  define bind		sendmail_mpe_bind
18777685Sache#  define _exit		sendmail_mpe__exit
1878131994Scperciva#  define exit		sendmail_mpe_exit
1879131994Scperciva#  define fcntl		sendmail_mpe_fcntl
1880131994Scperciva#  define getegid	sendmail_mpe_getegid
1881131994Scperciva#  define geteuid	sendmail_mpe_geteuid
1882131994Scperciva#  define getpwnam	sendmail_mpe_getpwnam
1883131994Scperciva#  define getpwuid	sendmail_mpe_getpwuid
18847685Sache#  define setgid	sendmail_mpe_setgid
18857685Sache#  define setuid	sendmail_mpe_setuid
1886131994Scpercivaextern int		sendmail_mpe_fcntl __P((int, int, ...));
1887131994Scpercivaextern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
1888131994Scpercivaextern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
1889131994Scperciva# endif /* MPE */
1890131994Scperciva
1891131994Scperciva/*
1892131994Scperciva**  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
1893131994Scperciva**
1894131994Scperciva**	Contributed by Paul Gampe <paulg@apnic.net>
1895131994Scperciva*/
1896131994Scperciva
1897131994Scperciva# ifdef __svr5__
1898131994Scperciva#  include <sys/mkdev.h>
1899131994Scperciva#  define __svr4__
19007685Sache#  define SYS5SIGNALS		1
19017685Sache#  define HASFCHOWN		1	/* has fchown(2) call */
1902131994Scperciva#  define HASSETSID	1	/* has POSIX setsid(2) call */
1903131994Scperciva#  define HASSETREUID		1
1904131994Scperciva#  define HASWAITPID		1
1905131994Scperciva#  define HASGETDTABLESIZE	1
19067685Sache#  define GIDSET_T		gid_t
1907131994Scperciva#  define SOCKADDR_LEN_T	size_t
1908131994Scperciva#  define SOCKOPT_LEN_T		size_t
19097685Sache#  ifndef _PATH_UNIX
1910131994Scperciva#   define _PATH_UNIX		"/stand/unix"
1911131994Scperciva#  endif /* ! _PATH_UNIX */
1912131994Scperciva#  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
1913131994Scperciva#  ifndef SYSLOG_BUFSIZE
19147685Sache#   define SYSLOG_BUFSIZE	1024	/* unsure */
19157685Sache#  endif /* ! SYSLOG_BUFSIZE */
1916131994Scperciva#  ifndef _PATH_VENDOR_CF
1917131994Scperciva#   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
1918131994Scperciva#  endif /* ! _PATH_VENDOR_CF */
19197685Sache#  ifndef _PATH_SENDMAILPID
19207685Sache#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
19217685Sache#  endif /* ! _PATH_SENDMAILPID */
19227685Sache#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
19237685Sache#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
19247685Sache# define SM_SET_H_ERRNO(err)	set_h_errno((err))
1925131994Scperciva#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
1926131994Scperciva# endif /* __svr5__ */
19277685Sache
19287685Sache/* ###################################################################### */
19297685Sache
19307685Sache/*
19317685Sache**  UnixWare 2.x
19327685Sache*/
19337685Sache
19347685Sache# ifdef UNIXWARE2
19357685Sache#  define UNIXWARE	1
19367685Sache#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
1937131994Scperciva# endif /* UNIXWARE2 */
1938131994Scperciva
19397685Sache
19407685Sache/*
19417685Sache**  UnixWare 1.1.2.
19427685Sache**
19437685Sache**	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
19447685Sache**	From Evan Champion <evanc@spatial.synapse.org>.
19457685Sache*/
19467685Sache
19477685Sache# ifdef UNIXWARE
19487685Sache#  include <sys/mkdev.h>
19497685Sache#  define SYSTEM5		1
19507685Sache#  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
19517685Sache#  define HASSETREUID		1
19527685Sache#  define HASSETSID	1	/* has POSIX setsid(2) call */
19537685Sache#  define HASINITGROUPS		1
19547685Sache#  define GIDSET_T		gid_t
1955131994Scperciva#  define SLEEP_T		unsigned
1956131994Scperciva#  define SFS_TYPE		SFS_STATVFS
1957131994Scperciva#  define LA_TYPE		LA_ZERO
1958131994Scperciva#  undef WIFEXITED
1959131994Scperciva#  undef WEXITSTATUS
1960131994Scperciva#  ifndef _PATH_UNIX
19617685Sache#   define _PATH_UNIX		"/unix"
19627685Sache#  endif /* ! _PATH_UNIX */
19637685Sache#  ifndef _PATH_VENDOR_CF
19647685Sache#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
19657685Sache#  endif /* ! _PATH_VENDOR_CF */
19667685Sache#  ifndef _PATH_SENDMAILPID
196748384Sjkh#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
196848384Sjkh#  endif /* ! _PATH_SENDMAILPID */
196948384Sjkh#  define SYSLOG_BUFSIZE	128
197048384Sjkh# endif /* UNIXWARE */
197148384Sjkh
197248384Sjkh
19737685Sache/*
19747685Sache**  Intergraph CLIX 3.1
19757685Sache**
19767685Sache**	From Paul Southworth <pauls@locust.cic.net>
19777685Sache*/
19787685Sache
19797685Sache# ifdef CLIX
19807685Sache#  define SYSTEM5	1	/* looks like System V */
19817685Sache#  ifndef HASGETUSERSHELL
19827685Sache#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
19837685Sache#  endif /* ! HASGETUSERSHELL */
19847685Sache#  define DEV_BSIZE	512	/* device block size not defined */
19857685Sache#  define GIDSET_T	gid_t
19867685Sache#  undef LOG			/* syslog not available */
19877685Sache#  define NEEDFSYNC	1	/* no fsync in system library */
19887685Sache#  define GETSHORT	_getshort
19897685Sache# endif /* CLIX */
19907685Sache
19917685Sache
19927685Sache/*
19937685Sache**  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
19947685Sache**
19957685Sache**	From Kevin Darcy <kevin@tech.mis.cfc.com>.
19967685Sache*/
19977685Sache
19987685Sache# ifdef NCR_MP_RAS2
19997685Sache#  include <sys/sockio.h>
20007685Sache#  define __svr4__
20017685Sache#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
20027685Sache#  define SYSLOG_BUFSIZE	1024
2003108661Sschweikh#  define SPT_TYPE  SPT_NONE
2004108661Sschweikh# endif /* NCR_MP_RAS2 */
2005108661Sschweikh
2006108661Sschweikh
200733734Sjulian/*
200848384Sjkh**  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
200948388Sjkh**
201048388Sjkh**	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
20117685Sache*/
20127685Sache
20137685Sache# ifdef NCR_MP_RAS3
20147685Sache#  define __svr4__
20157685Sache#  define HASFCHOWN		1	/* has fchown(2) call */
20167685Sache#  define LDA_USE_LOCKF		1
20177685Sache#  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
20187685Sache#  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
20197685Sache#  define SYSLOG_BUFSIZE	1024
20207685Sache#  define SPT_TYPE	SPT_NONE
20217685Sache#  define _PATH_MAILDIR	"/var/mail"
20227685Sache#  ifndef _XOPEN_SOURCE
20237685Sache#   define _XOPEN_SOURCE
20247685Sache#   define _XOPEN_SOURCE_EXTENDED 1
20257685Sache#   include <sys/resource.h>
20267685Sache#   undef _XOPEN_SOURCE
20277685Sache#   undef _XOPEN_SOURCE_EXTENDED
20287685Sache#  endif /* ! _XOPEN_SOURCE */
20297685Sache# endif /* NCR_MP_RAS3 */
20307685Sache
20317685Sache
20327685Sache/*
20337685Sache**  Tandem NonStop-UX SVR4
20347685Sache**
20357685Sache**	From Rick McCarty <mccarty@mpd.tandem.com>.
20367685Sache*/
20377685Sache
20387685Sache# ifdef NonStop_UX_BXX
20397685Sache#  define __svr4__
20407685Sache# endif /* NonStop_UX_BXX */
20417685Sache
20427685Sache
20437685Sache/*
20447685Sache**  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
20457685Sache**
20467685Sache**	Tested for 1.04, 1.03
20477685Sache**	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
20487685Sache**
20497685Sache**	Tested for 4.02, 6.10 and 7.10
20507685Sache**	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
20517685Sache*/
20527685Sache
2053131994Scperciva# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
20547685Sache#  define SYSTEM5	1	/* include all the System V defines */
2055131994Scperciva#  define HASINITGROUPS	1	/* has initgroups(3) call */
20567685Sache#  define HASFCHMOD	1	/* has fchmod(2) syscall */
20577685Sache#  define setreuid(r, e)	setresuid(r, e, -1)
20587685Sache#  define LA_TYPE	LA_FLOAT
2059131994Scperciva#  define SPT_TYPE	SPT_PSTAT
20607685Sache#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
20617685Sache#  ifndef HASSETVBUF
20627685Sache#   define HASSETVBUF	/* HI-UX has no setlinebuf */
20637685Sache#  endif /* ! HASSETVBUF */
20647685Sache#  ifndef GIDSET_T
20657685Sache#   define GIDSET_T	gid_t
20667685Sache#  endif /* ! GIDSET_T */
20677685Sache#  ifndef _PATH_UNIX
2068131994Scperciva#   define _PATH_UNIX		"/HI-UX"
20697685Sache#  endif /* ! _PATH_UNIX */
20707685Sache#  ifndef _PATH_VENDOR_CF
20717685Sache#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
20727685Sache#  endif /* ! _PATH_VENDOR_CF */
20737685Sache#  ifndef IDENTPROTO
20747685Sache#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
20757685Sache#  endif /* ! IDENTPROTO */
20767685Sache#  ifndef HASGETUSERSHELL
20777685Sache#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
20787685Sache#  endif /* ! HASGETUSERSHELL */
20797685Sache#  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
20807685Sache
20817685Sache/*
20827685Sache**  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
20837685Sache**  on HIUX 3050
20847685Sache*/
20857685Sache#  undef m_flags
20867685Sache
20877685Sache#  define SM_CONF_SYSLOG	0
20887685Sache
20897685Sache# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
20907685Sache
20917685Sache
20927685Sache/*
20937685Sache**  Amdahl UTS System V 2.1.5 (SVr3-based)
20947685Sache**
20957685Sache**    From: Janet Jackson <janet@dialix.oz.au>.
20967685Sache*/
20977685Sache
20987685Sache# ifdef _UTS
20997685Sache#  include <sys/sysmacros.h>
21007685Sache#  undef HASLSTAT		/* has symlinks, but they cause problems */
21017685Sache#  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
21027685Sache#  define SYS5SIGNALS	1	/* System V signal semantics */
21037685Sache#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
21047685Sache#  define HASUNAME	1	/* use System V uname(2) system call */
21057685Sache#  define HASINITGROUPS	1	/* has initgroups(3) function */
21067685Sache#  define HASSETVBUF	1	/* has setvbuf(3) function */
21077685Sache#  ifndef HASGETUSERSHELL
21087685Sache#   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
21097685Sache#  endif /* ! HASGETUSERSHELL */
21107685Sache#  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
21117685Sache#  define LA_TYPE	LA_ZERO		/* doesn't have load average */
21127685Sache#  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
21137685Sache#  define SFS_BAVAIL	f_bfree		/* alternate field name */
21147685Sache#  define _PATH_UNIX		"/unix"
21157685Sache#  ifndef _PATH_VENDOR_CF
21167685Sache#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
21177685Sache#  endif /* ! _PATH_VENDOR_CF */
21187685Sache# endif /* _UTS */
21197685Sache
21207685Sache/*
21217685Sache**  Cray Computer Corporation's CSOS
21227685Sache**
21237685Sache**	From Scott Bolte <scott@craycos.com>.
21247685Sache*/
21257685Sache
21267685Sache# ifdef _CRAYCOM
21277685Sache#  define SYSTEM5	1	/* include all the System V defines */
21287685Sache#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
21297685Sache#  define NEEDFSYNC	1	/* no fsync in system library */
213091141Scjc#  define MAXPATHLEN	PATHSIZE
213191141Scjc#  define LA_TYPE	LA_ZERO
21327685Sache#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
21337685Sache#  define SFS_BAVAIL	f_bfree		/* alternate field name */
2134215249Stuexen#  define _POSIX_CHOWN_RESTRICTED	-1
2135131994Scpercivaextern struct group	*getgrent(), *getgrnam(), *getgrgid();
2136131994Scperciva# endif /* _CRAYCOM */
21377685Sache
213829928Smarkm
213929928Smarkm/*
21407685Sache**  Sony NEWS-OS 4.2.1R and 6.0.3
21417685Sache**
21427685Sache**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
21437685Sache*/
21447685Sache
214591141Scjc# ifdef sony_news
214691141Scjc#  ifndef __svr4
214729928Smarkm			/* NEWS-OS 4.2.1R */
214829928Smarkm#   ifndef BSD
214929928Smarkm#    define BSD			/* has BSD routines */
215010808Sgibbs#   endif /* ! BSD */
215129928Smarkm#   define HASUNSETENV	1	/* has unsetenv(2) call */
215229928Smarkm#   undef HASSETVBUF		/* don't actually have setvbuf(3) */
215329928Smarkm#   define WAITUNION	1	/* use "union wait" as wait argument type */
215410808Sgibbs#   define LA_TYPE	LA_INT
215529928Smarkm#   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
21567685Sache#   ifndef HASFLOCK
21577685Sache#    define HASFLOCK	1	/* has flock(2) call */
2158168625Sstas#   endif /* ! HASFLOCK */
2159168625Sstas#   define setpgid	setpgrp
2160168625Sstas#   undef WIFEXITED
2161168625Sstas#   undef WEXITSTATUS
2162215249Stuexen#   define MODE_T	int	/* system include files have no mode_t */
2163215249Stuexentypedef int		pid_t;
21647685Sachetypedef int		(*sigfunc_t)();
21657685Sache#   define SIGFUNC_DEFINED
21667685Sache#   define SIGFUNC_RETURN	(0)
21677685Sache#   define SIGFUNC_DECL		int
21687685Sache
21697685Sache#  else /* ! __svr4 */
217027017Speter			/* NEWS-OS 6.0.3 with /bin/cc */
217127017Speter#   ifndef __svr4__
217291141Scjc#    define __svr4__		/* use all System V Release 4 defines below */
217391141Scjc#   endif /* ! __svr4__ */
217491141Scjc#   define HASSETSID	1	/* has POSIX setsid(2) call */
217591141Scjc#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
217691141Scjc#   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
217791141Scjc#   ifndef SPT_TYPE
217891141Scjc#    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
217991141Scjc#   endif /* ! SPT_TYPE */
21807685Sache#   define GIDSET_T	gid_t
21817685Sache#   undef WIFEXITED
21827685Sache#   undef WEXITSTATUS
21837685Sache#   ifndef SYSLOG_BUFSIZE
21847685Sache#    define SYSLOG_BUFSIZE	256
218536489Sandreas#   endif /* ! SYSLOG_BUFSIZE */
218636489Sandreas#   define _PATH_UNIX		"/stand/unix"
218736489Sandreas#   ifndef _PATH_VENDOR_CF
218836489Sandreas#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
218936489Sandreas#   endif /* ! _PATH_VENDOR_CF */
219036489Sandreas#   ifndef _PATH_SENDMAILPID
219175694Sume#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2192131732Scperciva#   endif /* ! _PATH_SENDMAILPID */
2193131732Scperciva
219436489Sandreas#  endif /* ! __svr4 */
21957685Sache# endif /* sony_news */
21967685Sache
2197215249Stuexen
2198215249Stuexen/*
2199215249Stuexen**  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
2200215249Stuexen**
2201215249Stuexen**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2202215249Stuexen*/
2203215249Stuexen
2204215249Stuexen# ifdef luna
2205215249Stuexen#  ifndef IDENTPROTO
2206215249Stuexen#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2207215249Stuexen#  endif /* ! IDENTPROTO */
2208107765Seric#  define HASUNSETENV	1	/* has unsetenv(2) call */
2209107765Seric#  define NEEDPUTENV	1	/* need putenv(3) call */
22107685Sache#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
22117685Sache#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
2212154822Smaxim#  define WAITUNION	1	/* use "union wait" as wait argument type */
2213154822Smaxim#  ifdef uniosb
221417771Sasami#   include <sys/time.h>
2215215249Stuexen#   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
22167685Sache#   define LA_TYPE	LA_INT
22177685Sache#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2218172089Smr#  endif /* uniosb */
2219172089Smr#  ifdef luna2
22207685Sache#   define LA_TYPE	LA_SUBR
22217685Sache#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2222233772Sivoras#  endif /* luna2 */
2223233772Sivoras#  ifdef luna88k
22247685Sache#   define LA_TYPE	LA_INT
22257685Sache#  endif /* luna88k */
2226120136Sobrien#  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
22277685Sache#  define setpgid	setpgrp
22287685Sache#  undef WIFEXITED
22297685Sache#  undef WEXITSTATUS
2230131994Scpercivatypedef int		pid_t;
22317685Sachetypedef int		(*sigfunc_t)();
22327685Sache#  define SIGFUNC_DEFINED
22337685Sache#  define SIGFUNC_RETURN	(0)
22347685Sache#  define SIGFUNC_DECL	int
2235131732Scpercivaextern char	*getenv();
2236131732Scperciva#  ifndef _PATH_VENDOR_CF
2237215249Stuexen#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2238215249Stuexen#  endif /* ! _PATH_VENDOR_CF */
2239133847Scperciva# endif /* luna */
2240133847Scperciva
2241120909Sbms
2242120909Sbms/*
2243215249Stuexen**  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
2244215249Stuexen**
2245215249Stuexen**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2246215249Stuexen*/
2247215249Stuexen
2248215249Stuexen# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
2249215249Stuexen#  ifndef __svr4__
22507685Sache#   define __svr4__		/* use all System V Release 4 defines below */
22517685Sache#  endif /* ! __svr4__ */
2252131732Scperciva#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2253131732Scperciva#  define HASSETSID	1	/* has POSIX setsid(2) call */
2254131732Scperciva#  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
2255131732Scperciva#  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2256131732Scperciva#  define GIDSET_T	gid_t
2257131732Scperciva#  undef WIFEXITED
225891141Scjc#  undef WEXITSTATUS
225991141Scjc#  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
2260131994Scperciva#  ifndef _PATH_VENDOR_CF
22617685Sache#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
22627685Sache#  endif /* ! _PATH_VENDOR_CF */
22637685Sache#  ifndef _PATH_SENDMAILPID
22647685Sache#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
22657685Sache#  endif /* ! _PATH_SENDMAILPID */
2266203342Sume#  ifndef SYSLOG_BUFSIZE
2267203342Sume#   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
22687685Sache#  endif /* ! SYSLOG_BUFSIZE */
22697685Sache# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
22707685Sache
22717685Sache
2272203067Sedwin/*
2273203067Sedwin**  Fujitsu/ICL UXP/DS (For the DS/90 Series)
22747685Sache**
22757685Sache**	From Diego R. Lopez <drlopez@cica.es>.
227691141Scjc**	Additional changes from Fumio Moriya and Toshiaki Nomura of the
22777685Sache**		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
22787685Sache*/
22797685Sache
22807685Sache# ifdef __uxp__
22817685Sache#  include <arpa/nameser.h>
228218270Spst#  include <sys/sysmacros.h>
228318270Spst#  include <sys/mkdev.h>
22847685Sache#  define __svr4__
22857685Sache#  define HASGETUSERSHELL	0
2286215249Stuexen#  define HASFLOCK		0
2287215249Stuexen#  define _PATH_UNIX		"/stand/unix"
2288215249Stuexen#  ifndef _PATH_VENDOR_CF
2289215249Stuexen#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2290215249Stuexen#  endif /* ! _PATH_VENDOR_CF */
2291215249Stuexen#  ifndef _PATH_SENDMAILPID
22927685Sache#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
22937685Sache#  endif /* ! _PATH_SENDMAILPID */
22947685Sache# endif /* __uxp__ */
22957685Sache
22967685Sache/*
22977685Sache**  Pyramid DC/OSx
22987685Sache**
22997685Sache**	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
230091141Scjc*/
230191141Scjc
23027685Sache# ifdef DCOSx
23037685Sache#  define GIDSET_T	gid_t
2304169591Sgrog#  ifndef IDENTPROTO
2305169591Sgrog#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2306169591Sgrog#  endif /* ! IDENTPROTO */
2307169591Sgrog# endif /* DCOSx */
2308169591Sgrog
2309169591Sgrog/*
2310215249Stuexen**  Concurrent Computer Corporation Maxion
2311215249Stuexen**
231291141Scjc**	From Donald R. Laster Jr. <laster@access.digex.net>.
231391141Scjc*/
23147685Sache
23157685Sache# ifdef __MAXION__
23167685Sache
23177685Sache#  include <sys/stream.h>
23187685Sache#  define __svr4__		1	/* SVR4.2MP */
23197685Sache#  define HASSETREUID		1	/* have setreuid(2) */
23207685Sache#  define HASLSTAT		1	/* have lstat(2) */
23217685Sache#  define HASSETRLIMIT		1	/* have setrlimit(2) */
2322168618Sstas#  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
2323168618Sstas#  define HASGETUSERSHELL	1	/* have getusershell(3) */
23247685Sache#  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
23257685Sache#  define SLEEP_T		unsigned
2326168618Sstas#  define SFS_TYPE		SFS_STATVFS
2327168618Sstas#  define SFS_BAVAIL		f_bavail
23287685Sache#  ifndef SYSLOG_BUFSIZE
23297685Sache#   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
23307685Sache#  endif /* ! SYSLOG_BUFSIZE */
23317685Sache
23327685Sache#  undef WUNTRACED
23337685Sache#  undef WIFEXITED
23347685Sache#  undef WIFSIGNALED
23357685Sache#  undef WIFSTOPPED
233691141Scjc#  undef WEXITSTATUS
233791141Scjc#  undef WTERMSIG
233891141Scjc#  undef WSTOPSIG
233991141Scjc
234034638Sjseger# endif /* __MAXION__ */
234134638Sjseger
2342114209Smdodd/*
2343114209Smdodd**  Harris Nighthawk PowerUX (nh6000 box)
234491273Scjc**
234591273Scjc**  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
234615084Sjoerg*/
2347215249Stuexen
2348215249Stuexen# ifdef _PowerUX
2349215249Stuexen#  ifndef __svr4__
2350215249Stuexen#   define __svr4__
2351215249Stuexen#  endif /* ! __svr4__ */
2352215249Stuexen#  ifndef _PATH_VENDOR_CF
235329571Sasami#   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
23547685Sache#  endif /* ! _PATH_VENDOR_CF */
23557685Sache#  ifndef _PATH_SENDMAILPID
23567685Sache#   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
23577685Sache#  endif /* ! _PATH_SENDMAILPID */
235891141Scjc#  define SYSLOG_BUFSIZE		1024
235991141Scjc#  define LA_TYPE		LA_ZERO
236091141Scjctypedef struct msgb		mblk_t;
236191141Scjc#  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
236291141Scjc# endif /* _PowerUX */
236391141Scjc
236448968Sobrien/*
236580961Sdougb**  Siemens Nixdorf Informationssysteme AG SINIX
236680961Sdougb**
236780961Sdougb**	Contributed by Gerald Rinske of Siemens Business Services VAS.
236880961Sdougb*/
23697685Sache# ifdef sinix
23707685Sache#  define HASRANDOM		0	/* has random(3) */
23717685Sache#  define SYSLOG_BUFSIZE	1024
23727685Sache#  define SM_INT32		int	/* 32bit integer */
23737685Sache# endif /* sinix */
23747685Sache
23757685Sache
23767685Sache/*
23777685Sache**  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
23787685Sache**
23797685Sache**	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
23807685Sache*/
23817685Sache
23827685Sache# ifdef MOTO
23837685Sache#  define HASFCHMOD		1
23847685Sache#  define HASSETRLIMIT		0
23857685Sache#  define HASSETSID	1	/* has POSIX setsid(2) call */
23867685Sache#  define HASSETREUID		1
23877685Sache#  define HASULIMIT		1
23887685Sache#  define HASWAITPID		1
2389172065Sbrooks#  define HASGETDTABLESIZE	1
2390172065Sbrooks#  define HASGETUSERSHELL	1
2391172065Sbrooks#  define IP_SRCROUTE		0
2392172260Sbrooks#  define IDENTPROTO		0
239391141Scjc#  define RES_DNSRCH_VARIABLE	_res_dnsrch
239491141Scjc#  define _PATH_UNIX		"/unix"
2395203574Sbms#  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
2396203574Sbms#  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
239786699Sobrien# endif /* MOTO */
2398215249Stuexen
2399215249Stuexen/*
2400215249Stuexen**  Interix
24017685Sache**	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
24027685Sache**
240391141Scjc**	Used for Interix support.
240491141Scjc*/
24057685Sache
24067685Sache# if defined(__INTERIX)
24077685Sache#  define HASURANDOMDEV		1
24087685Sache#  define HASGETUSERSHELL	0
24097685Sache#  define HASSTRERROR		1
24107685Sache#  define HASUNSETENV		1
24117685Sache#  define HASFCHOWN		1
24127685Sache#  undef HAVE_SYS_ERRLIST
241362630Ssheldonh#  define sys_errlist		__sys_errlist
241462630Ssheldonh#  define sys_nerr		__sys_nerr
24157685Sache#  include <sys/mkdev.h>
24167685Sache#  ifndef major
24177685Sache#   define major(dev)		((int)(((dev) >> 8) & 0xff))
24187685Sache#  endif /* ! major */
24197685Sache#  ifndef minor
24207685Sache#   define minor(dev)		((int)((dev) & 0xff))
24217685Sache#  endif /* ! minor */
24227685Sache# endif /* defined(__INTERIX) */
242379093Sassar
242479093Sassar
2425131732Scperciva/**********************************************************************
2426131732Scperciva**  End of Per-Operating System defines
242779093Sassar**********************************************************************/
242879093Sassar/**********************************************************************
24297685Sache**  More general defines
24307685Sache**********************************************************************/
243191141Scjc
243291141Scjc/* general BSD defines */
24337685Sache# ifdef BSD
24347685Sache#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
2435215249Stuexen#  ifndef HASSETREUID
2436215249Stuexen#   define HASSETREUID	1	/* has setreuid(2) call */
2437129789Smlaier#  endif /* ! HASSETREUID */
2438215249Stuexen#  define HASINITGROUPS	1	/* has initgroups(3) call */
2439215249Stuexen#  ifndef IP_SRCROUTE
244037370Sbrian#   define IP_SRCROUTE	1	/* can check IP source routing */
2441215249Stuexen#  endif /* ! IP_SRCROUTE */
2442215249Stuexen#  ifndef HASSETRLIMIT
2443215249Stuexen#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2444215249Stuexen#  endif /* ! HASSETRLIMIT */
244535850Sphk#  ifndef HASFLOCK
2446203066Sedwin#   define HASFLOCK	1	/* has flock(2) call */
2447203066Sedwin#  endif /* ! HASFLOCK */
24487685Sache#  ifndef TZ_TYPE
24497685Sache#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
24507685Sache#  endif /* ! TZ_TYPE */
24517685Sache# endif /* BSD */
2452215249Stuexen
2453215249Stuexen/* general System V Release 4 defines */
2454215249Stuexen# ifdef __svr4__
2455215249Stuexen#  define SYSTEM5	1
2456215249Stuexen#  define USESETEUID	1	/* has usable seteuid(2) call */
2457215249Stuexen#  define HASINITGROUPS	1	/* has initgroups(3) call */
2458168624Sstas#  define BSD_COMP	1	/* get BSD ioctl calls */
245917106Spst#  ifndef HASSETRLIMIT
246024473Spst#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
246124473Spst#  endif /* ! HASSETRLIMIT */
2462215249Stuexen#  ifndef HASGETUSERSHELL
2463215249Stuexen#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2464215249Stuexen#  endif /* ! HASGETUSERSHELL */
2465215249Stuexen#  ifndef HASFCHMOD
2466215249Stuexen#   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
24677685Sache#  endif /* ! HASFCHMOD */
24687685Sache
2469131994Scperciva#  ifndef _PATH_UNIX
2470131994Scperciva#   define _PATH_UNIX		"/unix"
2471215249Stuexen#  endif /* ! _PATH_UNIX */
2472215249Stuexen#  ifndef _PATH_VENDOR_CF
2473215249Stuexen#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2474131994Scperciva#  endif /* ! _PATH_VENDOR_CF */
2475131994Scperciva#  ifndef _PATH_SENDMAILPID
2476131994Scperciva#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2477131994Scperciva#  endif /* ! _PATH_SENDMAILPID */
247829606Sasami#  ifndef SYSLOG_BUFSIZE
2479215249Stuexen#   define SYSLOG_BUFSIZE	128
2480215249Stuexen#  endif /* ! SYSLOG_BUFSIZE */
2481215249Stuexen#  ifndef SFS_TYPE
2482215249Stuexen#   define SFS_TYPE		SFS_STATVFS
2483215249Stuexen#  endif /* ! SFS_TYPE */
2484131994Scperciva
2485131994Scperciva#  ifndef USE_SIGLONGJMP
2486#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
2487#  endif /* ! USE_SIGLONGJMP */
2488# endif /* __svr4__ */
2489
2490# ifdef __SVR4
2491#  define LDA_USE_LOCKF		1
2492#  define LDA_USE_SETEUID	1
2493#  define _PATH_MAILDIR		"/var/mail"
2494# endif /* __SVR4 */
2495
2496/* general System V defines */
2497# ifdef SYSTEM5
2498#  include <sys/sysmacros.h>
2499#  define HASUNAME	1	/* use System V uname(2) system call */
2500#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
2501#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
2502#  ifndef HASULIMIT
2503#   define HASULIMIT	1	/* has the ulimit(2) syscall */
2504#  endif /* ! HASULIMIT */
2505#  ifndef LA_TYPE
2506#   ifdef MIOC_READKSYM
2507#    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2508#   else /* MIOC_READKSYM */
2509#    define LA_TYPE	LA_INT		/* assume integer load average */
2510#   endif /* MIOC_READKSYM */
2511#  endif /* ! LA_TYPE */
2512#  ifndef SFS_TYPE
2513#   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2514#  endif /* ! SFS_TYPE */
2515#  ifndef TZ_TYPE
2516#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2517#  endif /* ! TZ_TYPE */
2518# endif /* SYSTEM5 */
2519
2520/* general POSIX defines */
2521# ifdef _POSIX_VERSION
2522#  define HASSETSID	1	/* has POSIX setsid(2) call */
2523#  define HASWAITPID	1	/* has POSIX waitpid(2) call */
2524#  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
2525#   define USESETEUID	1	/* has usable seteuid(2) call */
2526#  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
2527# endif /* _POSIX_VERSION */
2528/*
2529**  Tweaking for systems that (for example) claim to be BSD or POSIX
2530**  but don't have all the standard BSD or POSIX routines (boo hiss).
2531*/
2532
2533# ifdef titan
2534#  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
2535# endif /* titan */
2536
2537# ifdef _CRAYCOM
2538#  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
2539# endif /* _CRAYCOM */
2540
2541# ifdef MOTO
2542#  undef USESETEUID
2543# endif /* MOTO */
2544
2545/*
2546**  Due to a "feature" in some operating systems such as Ultrix 4.3 and
2547**  HPUX 8.0, if you receive a "No route to host" message (ICMP message
2548**  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
2549**  are closed.  Some firewalls return this error if you try to connect
2550**  to the IDENT port (113), so you can't receive email from these hosts
2551**  on these systems.  The firewall really should use a more specific
2552**  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
2553**  not explicitly set to zero above, default it on.
2554*/
2555
2556# ifndef IDENTPROTO
2557#  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
2558# endif /* ! IDENTPROTO */
2559
2560# ifndef IP_SRCROUTE
2561#  define IP_SRCROUTE	1	/* Detect IP source routing */
2562# endif /* ! IP_SRCROUTE */
2563
2564# ifndef HASGETUSERSHELL
2565#  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
2566# endif /* ! HASGETUSERSHELL */
2567
2568# ifndef NETUNIX
2569#  define NETUNIX	1	/* include unix domain support */
2570# endif /* ! NETUNIX */
2571
2572# ifndef HASRANDOM
2573#  define HASRANDOM	1	/* has random(3) support */
2574# endif /* ! HASRANDOM */
2575
2576# ifndef HASFLOCK
2577#  define HASFLOCK	0	/* assume no flock(2) support */
2578# endif /* ! HASFLOCK */
2579
2580# ifndef HASSETREUID
2581#  define HASSETREUID	0	/* assume no setreuid(2) call */
2582# endif /* ! HASSETREUID */
2583
2584# ifndef HASFCHMOD
2585#  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
2586# endif /* ! HASFCHMOD */
2587
2588# ifndef USESETEUID
2589#  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
2590# endif /* ! USESETEUID */
2591
2592# ifndef HASSETRLIMIT
2593#  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
2594# endif /* ! HASSETRLIMIT */
2595
2596# ifndef HASULIMIT
2597#  define HASULIMIT	0	/* assume no ulimit(2) support */
2598# endif /* ! HASULIMIT */
2599
2600# ifndef SECUREWARE
2601#  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
2602# endif /* ! SECUREWARE */
2603
2604# ifndef USE_DOUBLE_FORK
2605#  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
2606# endif /* ! USE_DOUBLE_FORK */
2607
2608# ifndef USE_ENVIRON
2609#  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
2610# endif /* ! USE_ENVIRON */
2611
2612# ifndef USE_SIGLONGJMP
2613#  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
2614# endif /* ! USE_SIGLONGJMP */
2615
2616# ifndef FDSET_CAST
2617#  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
2618# endif /* ! FDSET_CAST */
2619
2620/*
2621**  Pick a mailer setuid method for changing the current uid
2622*/
2623
2624# define USE_SETEUID	0
2625# define USE_SETREUID	1
2626# define USE_SETUID	2
2627
2628# if USESETEUID
2629#  define MAILER_SETUID_METHOD	USE_SETEUID
2630# else /* USESETEUID */
2631#  if HASSETREUID
2632#   define MAILER_SETUID_METHOD	USE_SETREUID
2633#  else /* HASSETREUID */
2634#   define MAILER_SETUID_METHOD	USE_SETUID
2635#  endif /* HASSETREUID */
2636# endif /* USESETEUID */
2637
2638/*
2639**  If no type for argument two of getgroups call is defined, assume
2640**  it's an integer -- unfortunately, there seem to be several choices
2641**  here.
2642*/
2643
2644# ifndef GIDSET_T
2645#  define GIDSET_T	int
2646# endif /* ! GIDSET_T */
2647
2648# ifndef UID_T
2649#  define UID_T		uid_t
2650# endif /* ! UID_T */
2651
2652# ifndef GID_T
2653#  define GID_T		gid_t
2654# endif /* ! GID_T */
2655
2656# ifndef MODE_T
2657#  define MODE_T		mode_t
2658# endif /* ! MODE_T */
2659
2660# ifndef ARGV_T
2661#  define ARGV_T		char **
2662# endif /* ! ARGV_T */
2663
2664# ifndef SOCKADDR_LEN_T
2665#  define SOCKADDR_LEN_T	int
2666# endif /* ! SOCKADDR_LEN_T */
2667
2668# ifndef SOCKOPT_LEN_T
2669#  define SOCKOPT_LEN_T	int
2670# endif /* ! SOCKOPT_LEN_T */
2671
2672# ifndef QUAD_T
2673#  define QUAD_T	unsigned long
2674# endif /* ! QUAD_T */
2675/**********************************************************************
2676**  Remaining definitions should never have to be changed.  They are
2677**  primarily to provide back compatibility for older systems -- for
2678**  example, it includes some POSIX compatibility definitions
2679**********************************************************************/
2680
2681/* System 5 compatibility */
2682# ifndef S_ISREG
2683#  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
2684# endif /* ! S_ISREG */
2685# ifndef S_ISDIR
2686#  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
2687# endif /* ! S_ISDIR */
2688# if !defined(S_ISLNK) && defined(S_IFLNK)
2689#  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
2690# endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
2691# if !defined(S_ISFIFO)
2692#  if defined(S_IFIFO)
2693#   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
2694#  else /* defined(S_IFIFO) */
2695#   define S_ISFIFO(foo)	false
2696#  endif /* defined(S_IFIFO) */
2697# endif /* !defined(S_ISFIFO) */
2698# ifndef S_IRUSR
2699#  define S_IRUSR		0400
2700# endif /* ! S_IRUSR */
2701# ifndef S_IWUSR
2702#  define S_IWUSR		0200
2703# endif /* ! S_IWUSR */
2704# ifndef S_IRGRP
2705#  define S_IRGRP		0040
2706# endif /* ! S_IRGRP */
2707# ifndef S_IWGRP
2708#  define S_IWGRP		0020
2709# endif /* ! S_IWGRP */
2710# ifndef S_IROTH
2711#  define S_IROTH		0004
2712# endif /* ! S_IROTH */
2713# ifndef S_IWOTH
2714#  define S_IWOTH		0002
2715# endif /* ! S_IWOTH */
2716
2717/* close-on-exec flag */
2718# ifndef FD_CLOEXEC
2719#  define FD_CLOEXEC	1
2720# endif /* ! FD_CLOEXEC */
2721
2722/*
2723**  Older systems don't have this error code -- it should be in
2724**  /usr/include/sysexits.h.
2725*/
2726
2727# ifndef EX_CONFIG
2728#  define EX_CONFIG	78	/* configuration error */
2729# endif /* ! EX_CONFIG */
2730
2731/* pseudo-codes */
2732# define EX_QUIT	22	/* drop out of server immediately */
2733# define EX_RESTART	23	/* restart sendmail daemon */
2734# define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
2735
2736#ifndef EX_NOTFOUND
2737# define EX_NOTFOUND	EX_NOHOST
2738#endif /* ! EX_NOTFOUND */
2739
2740/* pseudo-code used for mci_setstat */
2741# define EX_NOTSTICKY	(-5)	/* don't save persistent status */
2742
2743
2744/*
2745**  An "impossible" file mode to indicate that the file does not exist.
2746*/
2747
2748# define ST_MODE_NOFILE	0171147		/* unlikely to occur */
2749
2750
2751/* type of arbitrary pointer */
2752# ifndef ARBPTR_T
2753#  define ARBPTR_T	void *
2754# endif /* ! ARBPTR_T */
2755
2756# ifndef __P
2757#  include "sm/cdefs.h"
2758# endif /* ! __P */
2759
2760# if HESIOD && !defined(NAMED_BIND)
2761#  define NAMED_BIND	1	/* not one without the other */
2762# endif /* HESIOD && !defined(NAMED_BIND) */
2763
2764#  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
2765extern int	h_errno;
2766#  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
2767
2768# if NEEDPUTENV
2769extern int	putenv __P((char *));
2770# endif /* NEEDPUTENV */
2771
2772#if !HASUNSETENV
2773extern void	unsetenv __P((char *));
2774#endif /* !HASUNSETENV */
2775
2776# ifdef LDAPMAP
2777#  include <sys/time.h>
2778#  include <lber.h>
2779#  include <ldap.h>
2780
2781/* Some LDAP constants */
2782#  define LDAPMAP_FALSE		0
2783#  define LDAPMAP_TRUE		1
2784
2785/*
2786**  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
2787**  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
2788**  and assume (falsely) that all old API implementations are broken.
2789**  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
2790*/
2791
2792#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
2793#   define USE_LDAP_INIT	1
2794#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
2795
2796/*
2797**  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
2798**  hence ldap_set_option() must not exist.
2799*/
2800
2801#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
2802#   define USE_LDAP_SET_OPTION	1
2803#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
2804
2805# endif /* LDAPMAP */
2806
2807# if HASUNAME
2808#  include <sys/utsname.h>
2809#  ifdef newstr
2810#   undef newstr
2811#  endif /* newstr */
2812# else /* HASUNAME */
2813#  define NODE_LENGTH 32
2814struct utsname
2815{
2816	char nodename[NODE_LENGTH + 1];
2817};
2818# endif /* HASUNAME */
2819
2820# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
2821#  define MAXHOSTNAMELEN	256
2822# endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
2823
2824
2825# if _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255
2826   /*
2827   **  override Linux weirdness: a FQHN can be 255 chars long
2828   **  SUSv3 requires HOST_NAME_MAX ("Maximum length of a host
2829   **  name (not including the terminating null) as returned from the
2830   **  gethostname() function.") to be at least 255.  c.f.:
2831   **  http://www.opengroup.org/onlinepubs/009695399
2832   **  but Linux defines that to 64 too.
2833   */
2834#  undef MAXHOSTNAMELEN
2835#  define MAXHOSTNAMELEN	256
2836# endif /* _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 */
2837
2838# if !defined(SIGCHLD) && defined(SIGCLD)
2839#  define SIGCHLD	SIGCLD
2840# endif /* !defined(SIGCHLD) && defined(SIGCLD) */
2841
2842# ifndef STDIN_FILENO
2843#  define STDIN_FILENO	0
2844# endif /* ! STDIN_FILENO */
2845
2846# ifndef STDOUT_FILENO
2847#  define STDOUT_FILENO	1
2848# endif /* ! STDOUT_FILENO */
2849
2850# ifndef STDERR_FILENO
2851#  define STDERR_FILENO	2
2852# endif /* ! STDERR_FILENO */
2853
2854# ifndef LOCK_SH
2855#  define LOCK_SH	0x01	/* shared lock */
2856#  define LOCK_EX	0x02	/* exclusive lock */
2857#  define LOCK_NB	0x04	/* non-blocking lock */
2858#  define LOCK_UN	0x08	/* unlock */
2859# endif /* ! LOCK_SH */
2860
2861# ifndef S_IXOTH
2862#  define S_IXOTH	(S_IEXEC >> 6)
2863# endif /* ! S_IXOTH */
2864
2865# ifndef S_IXGRP
2866#  define S_IXGRP	(S_IEXEC >> 3)
2867# endif /* ! S_IXGRP */
2868
2869# ifndef S_IXUSR
2870#  define S_IXUSR	(S_IEXEC)
2871# endif /* ! S_IXUSR */
2872
2873#ifndef O_ACCMODE
2874# define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
2875#endif /* ! O_ACCMODE */
2876
2877# ifndef SEEK_SET
2878#  define SEEK_SET	0
2879#  define SEEK_CUR	1
2880#  define SEEK_END	2
2881# endif /* ! SEEK_SET */
2882
2883# ifndef SIG_ERR
2884#  define SIG_ERR	((void (*)()) -1)
2885# endif /* ! SIG_ERR */
2886
2887# ifndef WEXITSTATUS
2888#  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
2889# endif /* ! WEXITSTATUS */
2890# ifndef WIFEXITED
2891#  define WIFEXITED(st)		(((st) & 0377) == 0)
2892# endif /* ! WIFEXITED */
2893# ifndef WIFSTOPPED
2894#  define WIFSTOPPED(st)		(((st) & 0100) == 0)
2895# endif /* ! WIFSTOPPED */
2896# ifndef WCOREDUMP
2897#  define WCOREDUMP(st)		(((st) & 0200) != 0)
2898# endif /* ! WCOREDUMP */
2899# ifndef WTERMSIG
2900#  define WTERMSIG(st)		(((st) & 0177))
2901# endif /* ! WTERMSIG */
2902
2903# ifndef SIGFUNC_DEFINED
2904typedef void		(*sigfunc_t) __P((int));
2905# endif /* ! SIGFUNC_DEFINED */
2906# ifndef SIGFUNC_RETURN
2907#  define SIGFUNC_RETURN
2908# endif /* ! SIGFUNC_RETURN */
2909# ifndef SIGFUNC_DECL
2910#  define SIGFUNC_DECL	void
2911# endif /* ! SIGFUNC_DECL */
2912
2913/* size of syslog buffer */
2914# ifndef SYSLOG_BUFSIZE
2915#  define SYSLOG_BUFSIZE	1024
2916# endif /* ! SYSLOG_BUFSIZE */
2917
2918/* for FD_SET() */
2919#ifndef FD_SETSIZE
2920# define FD_SETSIZE	256
2921#endif /* ! FD_SETSIZE */
2922
2923/*
2924**  Size of prescan buffer.
2925**	Despite comments in the _sendmail_ book, this probably should
2926**	not be changed; there are some hard-to-define dependencies.
2927*/
2928
2929# define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
2930
2931/* fork routine -- set above using #ifdef _osname_ or in Makefile */
2932# ifndef FORK
2933#  define FORK		fork		/* function to call to fork mailer */
2934# endif /* ! FORK */
2935
2936/* setting h_errno */
2937# ifndef SM_SET_H_ERRNO
2938#  define SM_SET_H_ERRNO(err)	h_errno = (err)
2939# endif /* SM_SET_H_ERRNO */
2940
2941# ifndef SM_CONF_GETOPT
2942#  define SM_CONF_GETOPT	1
2943# endif /* ! SM_CONF_GETOPT */
2944
2945/* random routine -- set above using #ifdef _osname_ or in Makefile */
2946# if HASRANDOM
2947#  define get_random()	random()
2948# else /* HASRANDOM */
2949#  define get_random()	((long) rand())
2950#  ifndef RANDOMSHIFT
2951#   define RANDOMSHIFT	8
2952#  endif /* ! RANDOMSHIFT */
2953# endif /* HASRANDOM */
2954
2955/*
2956**  Default to using scanf in readcf.
2957*/
2958
2959# ifndef SCANF
2960#  define SCANF		1
2961# endif /* ! SCANF */
2962
2963/* XXX  32 bit type */
2964# ifndef SM_INT32
2965#  define SM_INT32	int32_t
2966# endif /* ! SM_INT32 */
2967
2968/* XXX  16 bit type */
2969# ifndef SM_UINT16
2970#  define SM_UINT16	uint16_t
2971# endif /* ! SM_UINT16 */
2972
2973/*
2974**  SVr4 and similar systems use different routines for setjmp/longjmp
2975**  with signal support
2976*/
2977
2978# if USE_SIGLONGJMP
2979#  ifdef jmp_buf
2980#   undef jmp_buf
2981#  endif /* jmp_buf */
2982#  define jmp_buf		sigjmp_buf
2983#  ifdef setjmp
2984#   undef setjmp
2985#  endif /* setjmp */
2986#  define setjmp(env)		sigsetjmp(env, 1)
2987#  ifdef longjmp
2988#   undef longjmp
2989#  endif /* longjmp */
2990#  define longjmp(env, val)	siglongjmp(env, val)
2991# endif /* USE_SIGLONGJMP */
2992
2993# if !defined(NGROUPS_MAX) && defined(NGROUPS)
2994#  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
2995# endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
2996
2997/*
2998**  Some snprintf() implementations are rumored not to NUL terminate.
2999*/
3000# if SNPRINTF_IS_BROKEN
3001#  ifdef snprintf
3002#   undef snprintf
3003#  endif /* snprintf */
3004#  define snprintf	sm_snprintf
3005#  ifdef vsnprintf
3006#   undef vsnprintf
3007#  endif /* vsnprintf */
3008#  define vsnprintf	sm_vsnprintf
3009# endif /* SNPRINTF_IS_BROKEN */
3010
3011/*
3012**  If we don't have a system syslog, simulate it.
3013*/
3014
3015# if !LOG
3016#  define LOG_EMERG	0	/* system is unusable */
3017#  define LOG_ALERT	1	/* action must be taken immediately */
3018#  define LOG_CRIT	2	/* critical conditions */
3019#  define LOG_ERR	3	/* error conditions */
3020#  define LOG_WARNING	4	/* warning conditions */
3021#  define LOG_NOTICE	5	/* normal but significant condition */
3022#  define LOG_INFO	6	/* informational */
3023#  define LOG_DEBUG	7	/* debug-level messages */
3024# endif /* !LOG */
3025
3026# ifndef SM_CONF_SYSLOG
3027#  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
3028# endif /* SM_CONF_SYSLOG */
3029
3030# if !SM_CONF_SYSLOG
3031#   ifdef __STDC__
3032extern void	syslog(int, const char *, ...);
3033#   else /* __STDC__ */
3034extern void	syslog();
3035#   endif /* __STDC__ */
3036# endif /* !SM_CONF_SYSLOG */
3037
3038/* portable(?) definition for alignment */
3039# ifndef SM_ALIGN_SIZE
3040struct sm_align
3041{
3042	char al_c;
3043	union
3044	{
3045		long	al_l;
3046		void	*al_p;
3047		double	al_d;
3048		void	(*al_f) __P((void));
3049	} al_u;
3050};
3051#  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
3052# endif /* ! SM_ALIGN_SIZE */
3053# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
3054
3055char *sm_inet6_ntop __P((const void *, char *, size_t));
3056
3057#endif /* ! SM_CONF_H */
3058