conf.h revision 203004
190792Sgshapiro/*
2203004Sgshapiro * Copyright (c) 1998-2009 Sendmail, Inc. and its suppliers.
390792Sgshapiro *	All rights reserved.
490792Sgshapiro * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
590792Sgshapiro * Copyright (c) 1988, 1993
690792Sgshapiro *	The Regents of the University of California.  All rights reserved.
790792Sgshapiro *
890792Sgshapiro * By using this file, you agree to the terms and conditions set
990792Sgshapiro * forth in the LICENSE file which can be found at the top level of
1090792Sgshapiro * the sendmail distribution.
1190792Sgshapiro *
1290792Sgshapiro *
13203004Sgshapiro *	$Id: conf.h,v 1.139 2009/06/16 23:41:32 ca Exp $
1490792Sgshapiro */
1590792Sgshapiro
1690792Sgshapiro/*
1790792Sgshapiro**  CONF.H -- All user-configurable parameters for sendmail
1890792Sgshapiro**
19168515Sgshapiro**	Send updates to Sendmail.ORG so they will be
20168515Sgshapiro**	included in the next release; see
21168515Sgshapiro**	http://www.sendmail.org/email-addresses.html
22168515Sgshapiro**	for current e-mail address.
2390792Sgshapiro*/
2490792Sgshapiro
2590792Sgshapiro#ifndef SM_CONF_H
2690792Sgshapiro# define SM_CONF_H 1
2790792Sgshapiro
2890792Sgshapiro
2990792Sgshapiro# include <sm/config.h>
3090792Sgshapiro# include <sm/varargs.h>
3190792Sgshapiro
3290792Sgshapiro/*
3390792Sgshapiro**  General "standard C" defines.
3490792Sgshapiro**
3590792Sgshapiro**	These may be undone later, to cope with systems that claim to
3690792Sgshapiro**	be Standard C but aren't.  Gcc is the biggest offender -- it
3790792Sgshapiro**	doesn't realize that the library is part of the language.
3890792Sgshapiro**
3990792Sgshapiro**	Life would be much easier if we could get rid of this sort
4090792Sgshapiro**	of bozo problems.
4190792Sgshapiro*/
4290792Sgshapiro
4390792Sgshapiro# ifdef __STDC__
4490792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
4590792Sgshapiro# endif /* __STDC__ */
4690792Sgshapiro
4790792Sgshapiro/*
4890792Sgshapiro**  Assume you have standard calls; can be #undefed below if necessary.
4990792Sgshapiro*/
5090792Sgshapiro
5190792Sgshapiro# ifndef HASLSTAT
5290792Sgshapiro#  define HASLSTAT	1	/* has lstat(2) call */
5390792Sgshapiro# endif /* ! HASLSTAT */
5490792Sgshapiro
5590792Sgshapiro# ifndef HASNICE
5690792Sgshapiro#  define HASNICE	1	/* has nice(2) call */
5790792Sgshapiro# endif /* ! HASNICE */
5890792Sgshapiro
5990792Sgshapiro# ifndef HASRRESVPORT
6090792Sgshapiro#  define HASRRESVPORT	1	/* has rrsevport(3) call */
6190792Sgshapiro# endif /* ! HASRRESVPORT */
6290792Sgshapiro
6390792Sgshapiro/**********************************************************************
6490792Sgshapiro**  "Hard" compilation options.
6590792Sgshapiro**	#define these if they are available; comment them out otherwise.
6690792Sgshapiro**  These cannot be overridden from the Makefile, and should really not
6790792Sgshapiro**  be turned off unless absolutely necessary.
6890792Sgshapiro**********************************************************************/
6990792Sgshapiro
7090792Sgshapiro#define LOG		1	/* enable logging -- don't turn off */
7190792Sgshapiro
7290792Sgshapiro/**********************************************************************
7390792Sgshapiro**  Operating system configuration.
7490792Sgshapiro**
7590792Sgshapiro**	Unless you are porting to a new OS, you shouldn't have to
7690792Sgshapiro**	change these.
7790792Sgshapiro**********************************************************************/
7890792Sgshapiro
7990792Sgshapiro/*
8090792Sgshapiro**  HP-UX -- tested for 8.07, 9.00, and 9.01.
8190792Sgshapiro**
8290792Sgshapiro**	If V4FS is defined, compile for HP-UX 10.0.
8390792Sgshapiro**	11.x support from Richard Allen <ra@hp.is>.
8490792Sgshapiro*/
8590792Sgshapiro
8690792Sgshapiro# ifdef __hpux
8790792Sgshapiro		/* common definitions for HP-UX 9.x and 10.x */
8890792Sgshapiro#  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
8990792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
9090792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
9190792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
9290792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
9390792Sgshapiro#  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
9490792Sgshapiro#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
9590792Sgshapiro#  define seteuid(e)	setresuid(-1, e, -1)
9690792Sgshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
9790792Sgshapiro#  define LA_TYPE	LA_HPUX
9890792Sgshapiro#  define SPT_TYPE	SPT_PSTAT
9990792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
10090792Sgshapiro#  define GIDSET_T	gid_t
10190792Sgshapiro#  define LDA_USE_LOCKF	1
10290792Sgshapiro#  ifndef HASGETUSERSHELL
10390792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
10490792Sgshapiro#  endif /* ! HASGETUSERSHELL */
10590792Sgshapiro#  ifdef HPUX10
10690792Sgshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
107120256Sgshapiro#   ifndef SMRSH_CMDDIR
108120256Sgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
109120256Sgshapiro#   endif /* ! SMRSH_CMDDIR */
11090792Sgshapiro#  endif /* HPUX10 */
11190792Sgshapiro#  ifdef HPUX11
11294334Sgshapiro#   define HASSETREUID	1	/* setreuid(2) works on HP-UX 11.x */
11390792Sgshapiro#   define HASFCHOWN	1	/* has fchown(2) */
11490792Sgshapiro#   ifndef BROKEN_RES_SEARCH
11590792Sgshapiro#    define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
11690792Sgshapiro#   endif /* ! BROKEN_RES_SEARCH */
117120256Sgshapiro#   ifndef SMRSH_CMDDIR
118120256Sgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
119120256Sgshapiro#   endif /* ! SMRSH_CMDDIR */
12090792Sgshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
12190792Sgshapiro#  else /* HPUX11 */
12290792Sgshapiro#   ifndef NOT_SENDMAIL
12390792Sgshapiro#    define syslog	hard_syslog
12490792Sgshapiro#   endif /* ! NOT_SENDMAIL */
12590792Sgshapiro#  endif /* HPUX11 */
12690792Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
12790792Sgshapiro
12890792Sgshapiro#  ifdef V4FS
12990792Sgshapiro		/* HP-UX 10.x */
13090792Sgshapiro#   define _PATH_UNIX		"/stand/vmunix"
13190792Sgshapiro#   ifndef _PATH_VENDOR_CF
13290792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
13390792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
13490792Sgshapiro#   ifndef _PATH_SENDMAILPID
13590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
13690792Sgshapiro#   endif /* ! _PATH_SENDMAILPID */
13790792Sgshapiro#   ifndef IDENTPROTO
13890792Sgshapiro#    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
13990792Sgshapiro#   endif /* ! IDENTPROTO */
14090792Sgshapiro#   include <sys/mpctl.h>	/* for mpctl() in get_num_procs_online() */
14190792Sgshapiro#  else /* V4FS */
14290792Sgshapiro		/* HP-UX 9.x */
14390792Sgshapiro#   define _PATH_UNIX		"/hp-ux"
14490792Sgshapiro#   ifndef _PATH_VENDOR_CF
14590792Sgshapiro#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
14690792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
14790792Sgshapiro#   ifndef IDENTPROTO
14890792Sgshapiro#    define IDENTPROTO	0	/* TCP/IP implementation is broken */
14990792Sgshapiro#   endif /* ! IDENTPROTO */
15090792Sgshapiro#   ifdef __STDC__
15190792Sgshapiroextern void	hard_syslog(int, char *, ...);
15290792Sgshapiro#   else /* __STDC__ */
15390792Sgshapiroextern void	hard_syslog();
15490792Sgshapiro#   endif /* __STDC__ */
15590792Sgshapiro#   define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
15690792Sgshapiro#  endif /* V4FS */
15790792Sgshapiro
15890792Sgshapiro# endif /* __hpux */
15990792Sgshapiro
16090792Sgshapiro/*
16190792Sgshapiro**  IBM AIX 5.x
16290792Sgshapiro*/
16390792Sgshapiro
16490792Sgshapiro# ifdef _AIX5
165168515Sgshapiro#  include <sys/signal.h>
166168515Sgshapiro#  include <sys/wait.h>
16790792Sgshapiro#  define _AIX4		40300
168147078Sgshapiro#  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
169147078Sgshapiro#  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
170120256Sgshapiro#  if _AIX5 >= 50200
171120256Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
172120256Sgshapiro#  endif /* _AIX5 >= 50200 */
17390792Sgshapiro# endif /* _AIX5 */
17490792Sgshapiro
17590792Sgshapiro/*
17690792Sgshapiro**  IBM AIX 4.x
17790792Sgshapiro*/
17890792Sgshapiro
17990792Sgshapiro# ifdef _AIX4
18090792Sgshapiro#  define _AIX3		1	/* pull in AIX3 stuff */
18190792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
18290792Sgshapiro#  define USESETEUID	1	/* seteuid(2) works */
18390792Sgshapiro#  define TZ_TYPE	TZ_NAME	/* use tzname[] vector */
184147078Sgshapiro#  ifndef SOCKOPT_LEN_T
185147078Sgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
186147078Sgshapiro#  endif /* SOCKOPT_LEN_T */
18790792Sgshapiro#  if _AIX4 >= 40200
18890792Sgshapiro#   define HASSETREUID	1	/* setreuid(2) works as of AIX 4.2 */
189147078Sgshapiro#   ifndef SOCKADDR_LEN_T
190147078Sgshapiro#    define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
191147078Sgshapiro#   endif /* SOCKADDR_LEN_T */
19290792Sgshapiro#  endif /* _AIX4 >= 40200 */
19390792Sgshapiro#  if defined(_ILS_MACROS)	/* IBM versions aren't side-effect clean */
19490792Sgshapiro#   undef isascii
19590792Sgshapiro#   define isascii(c)		!(c & ~0177)
19690792Sgshapiro#   undef isdigit
19790792Sgshapiro#   define isdigit(__a)		(_IS(__a,_ISDIGIT))
19890792Sgshapiro#   undef isspace
19990792Sgshapiro#   define isspace(__a)		(_IS(__a,_ISSPACE))
20090792Sgshapiro#  endif /* defined(_ILS_MACROS) */
20190792Sgshapiro# endif /* _AIX4 */
20290792Sgshapiro
20390792Sgshapiro
20490792Sgshapiro/*
20590792Sgshapiro**  IBM AIX 3.x -- actually tested for 3.2.3
20690792Sgshapiro*/
20790792Sgshapiro
20890792Sgshapiro# ifdef _AIX3
20990792Sgshapiro#  include <paths.h>
21090792Sgshapiro#  include <sys/machine.h>	/* to get byte order */
21190792Sgshapiro#  include <sys/select.h>
21290792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) */
21390792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
21490792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
21590792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
21690792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
21790792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
21890792Sgshapiro#  define GIDSET_T	gid_t
21990792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
22090792Sgshapiro#  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
221147078Sgshapiro#  ifndef LA_TYPE
222147078Sgshapiro#   define LA_TYPE	LA_INT
223147078Sgshapiro#  endif /* LA_TYPE */
22490792Sgshapiro#  define FSHIFT	16
22590792Sgshapiro#  define LA_AVENRUN	"avenrun"
22690792Sgshapiro#  if !defined(_AIX4) || _AIX4 < 40300
22790792Sgshapiro#   ifndef __BIT_TYPES_DEFINED__
22890792Sgshapiro#    define SM_INT32	int
22990792Sgshapiro#   endif /* __BIT_TYPES_DEFINED__ */
23090792Sgshapiro#  endif /* !defined(_AIX4) || _AIX4 < 40300 */
23190792Sgshapiro#  if !defined(_AIX4) || _AIX4 < 40200
23290792Sgshapiro#   define SM_CONF_SYSLOG	0
23390792Sgshapiro#  endif /* !defined(_AIX4) || _AIX4 < 40200 */
23490792Sgshapiro# endif /* _AIX3 */
23590792Sgshapiro
23690792Sgshapiro
23790792Sgshapiro/*
23890792Sgshapiro**  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
23990792Sgshapiro**
24090792Sgshapiro**	From Mark Whetzel <markw@wg.waii.com>.
24190792Sgshapiro*/
24290792Sgshapiro
24390792Sgshapiro# ifdef AIX			/* AIX/RT compiler pre-defines this */
24490792Sgshapiro#  include <paths.h>
24590792Sgshapiro#  include <sys/time.h>		/* AIX/RT resource.h does NOT include this */
24690792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
24790792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
24890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
24990792Sgshapiro#  define HASFCHMOD	0	/* does not have fchmod(2) syscall */
25090792Sgshapiro#  define HASSETREUID	1	/* use setreuid(2) -lbsd system call */
25190792Sgshapiro#  define HASSETVBUF	1	/* use setvbuf(2) system call */
25290792Sgshapiro#  define HASSETRLIMIT	0	/* does not have setrlimit call */
25390792Sgshapiro#  define HASFLOCK	0	/* does not have flock call - use fcntl */
25490792Sgshapiro#  define HASULIMIT	1	/* use ulimit instead of setrlimit call */
25590792Sgshapiro#  define SM_CONF_GETOPT	0	/* Do we need theirs or ours */
25690792Sgshapiro#  define SYS5SETPGRP	1	/* don't have setpgid on AIX/RT */
25790792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
25890792Sgshapiro#  define BSD4_3		1	/* NOT bsd 4.4 or posix signals */
25990792Sgshapiro#  define GIDSET_T	int
26090792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
26190792Sgshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
26290792Sgshapiro#  define LA_TYPE	LA_SUBR		/* use our ported loadavgd daemon */
26390792Sgshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
26490792Sgshapiro#  define ARBPTR_T	int *
26590792Sgshapiro#  define void		int
26690792Sgshapirotypedef int		pid_t;
26790792Sgshapiro/* RTisms for BSD compatibility, specified in the Makefile
26890792Sgshapiro  define BSD		1
26990792Sgshapiro  define BSD_INCLUDES		1
27090792Sgshapiro  define BSD_REMAP_SIGNAL_TO_SIGVEC
27190792Sgshapiro    RTisms needed above */
27290792Sgshapiro/* make this sendmail in a completely different place */
27390792Sgshapiro#  ifndef _PATH_VENDOR_CF
27490792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/local/newmail/sendmail.cf"
27590792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
27690792Sgshapiro#  ifndef _PATH_SENDMAILPID
27790792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
27890792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
27990792Sgshapiro# endif /* AIX */
28090792Sgshapiro
28190792Sgshapiro# if defined(_AIX)
28290792Sgshapiro#  define LDA_USE_LOCKF		1
28390792Sgshapiro#  define LDA_USE_SETEUID	1
28490792Sgshapiro# endif /* defined(_AIX) */
28590792Sgshapiro
28690792Sgshapiro/*
28790792Sgshapiro**  Silicon Graphics IRIX
28890792Sgshapiro**
28990792Sgshapiro**	Compiles on 4.0.1.
29090792Sgshapiro**
29190792Sgshapiro**	Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
29290792Sgshapiro**	Use IRIX5 instead of IRIX for IRIX 5.x.
29390792Sgshapiro**
29490792Sgshapiro**	IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
29590792Sgshapiro**	IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
29690792Sgshapiro*/
29790792Sgshapiro
29890792Sgshapiro# ifdef IRIX
29990792Sgshapiro#  define SYSTEM5	1	/* this is a System-V derived system */
30090792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
30190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
30290792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
30390792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
30490792Sgshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
30590792Sgshapiro#  define setpgid	BSDsetpgrp
30690792Sgshapiro#  define GIDSET_T	gid_t
30790792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
30890792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
30990792Sgshapiro#  define SYSLOG_BUFSIZE 512
310110560Sgshapiro#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
311110560Sgshapiro    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
312110560Sgshapiro#   define _SC_NPROCESSORS_ONLN	_SC_NPROC_ONLN
313110560Sgshapiro#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
31490792Sgshapiro#  ifdef IRIX6
31590792Sgshapiro#   define STAT64	1
31690792Sgshapiro#   define QUAD_T	unsigned long long
31790792Sgshapiro#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
31890792Sgshapiro#   define SAFENFSPATHCONF 0	/* pathconf(2) lies on NFS filesystems */
31990792Sgshapiro#  else /* IRIX6 */
32090792Sgshapiro#   define LA_TYPE	LA_INT
32190792Sgshapiro
32290792Sgshapiro#   ifdef IRIX64
32390792Sgshapiro#    define STAT64	1
32490792Sgshapiro#    define QUAD_T	unsigned long long
32590792Sgshapiro#    define NAMELISTMASK	0x7fffffffffffffff	/* mask for nlist() values */
32690792Sgshapiro#   else /* IRIX64 */
32790792Sgshapiro#    define STAT64	0
32890792Sgshapiro#    define NAMELISTMASK	0x7fffffff		/* mask for nlist() values */
32990792Sgshapiro#   endif /* IRIX64 */
33090792Sgshapiro#  endif /* IRIX6 */
33190792Sgshapiro#  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
33290792Sgshapiro#   include <sys/cdefs.h>
33390792Sgshapiro#   include <paths.h>
33490792Sgshapiro#   define ARGV_T	char *const *
33590792Sgshapiro#   define HASFCHOWN	1	/* has fchown(2) */
33690792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) syscall */
33790792Sgshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
33890792Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
33990792Sgshapiro#  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
34090792Sgshapiro#   define ARGV_T	const char **
34190792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
34290792Sgshapiro#  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
34390792Sgshapiro# endif /* IRIX */
34490792Sgshapiro
34590792Sgshapiro
34690792Sgshapiro/*
34790792Sgshapiro**  SunOS and Solaris
34890792Sgshapiro**
34990792Sgshapiro**	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
35090792Sgshapiro**	Solaris 2.4 (a.k.a. SunOS 5.4).
35190792Sgshapiro*/
35290792Sgshapiro
35390792Sgshapiro# if defined(sun) && !defined(BSD)
35490792Sgshapiro
35590792Sgshapiro#  include <sys/time.h>
35690792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
35790792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
35890792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
35990792Sgshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
36090792Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
36190792Sgshapiro#  ifndef HASFCHOWN
36290792Sgshapiro#   define HASFCHOWN	1	/* fchown(2) */
36390792Sgshapiro#  endif /* ! HASFCHOWN */
36490792Sgshapiro
36590792Sgshapiro#  ifdef __svr4__
36690792Sgshapiro#   define LDA_USE_LOCKF		1
36790792Sgshapiro#   define LDA_USE_SETEUID	1
36890792Sgshapiro#   define _PATH_MAILDIR		"/var/mail"
36990792Sgshapiro#  endif /* __svr4__ */
37090792Sgshapiro
37190792Sgshapiro#  ifdef SOLARIS_2_3
37290792Sgshapiro#   define SOLARIS	20300	/* for back compat only -- use -DSOLARIS=20300 */
37390792Sgshapiro#  endif /* SOLARIS_2_3 */
37490792Sgshapiro
37590792Sgshapiro#  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
37690792Sgshapiro#   define SOLARIS	1	/* unknown Solaris version */
37790792Sgshapiro#  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
37890792Sgshapiro
37990792Sgshapiro#  ifdef SOLARIS
38090792Sgshapiro			/* Solaris 2.x (a.k.a. SunOS 5.x) */
38190792Sgshapiro#   ifndef __svr4__
38290792Sgshapiro#    define __svr4__		/* use all System V Release 4 defines below */
38390792Sgshapiro#   endif /* ! __svr4__ */
38490792Sgshapiro#   define GIDSET_T	gid_t
38590792Sgshapiro#   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
38690792Sgshapiro#   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
38790792Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
38890792Sgshapiro#   ifndef _PATH_UNIX
38990792Sgshapiro#    define _PATH_UNIX		"/dev/ksyms"
39090792Sgshapiro#   endif /* ! _PATH_UNIX */
39190792Sgshapiro#   ifndef _PATH_VENDOR_CF
39290792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
39390792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
39490792Sgshapiro#   ifndef _PATH_SENDMAILPID
39590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
39690792Sgshapiro#   endif /* ! _PATH_SENDMAILPID */
39790792Sgshapiro#   ifndef _PATH_HOSTS
39890792Sgshapiro#    define _PATH_HOSTS		"/etc/inet/hosts"
39990792Sgshapiro#   endif /* ! _PATH_HOSTS */
40090792Sgshapiro#   ifndef SYSLOG_BUFSIZE
40190792Sgshapiro#    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
40290792Sgshapiro#   endif /* ! SYSLOG_BUFSIZE */
40390792Sgshapiro#   ifndef TZ_TYPE
40490792Sgshapiro#    define TZ_TYPE	TZ_TZNAME
40590792Sgshapiro#   endif /* ! TZ_TYPE */
40690792Sgshapiro#   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
40790792Sgshapiro#    define USESETEUID		1	/* seteuid works as of 2.3 */
40890792Sgshapiro#    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
40990792Sgshapiro#   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
41090792Sgshapiro#   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
41190792Sgshapiro#    define HASSETREUID	1		/* setreuid works as of 2.5 */
41290792Sgshapiro#    define HASSETREGID	1	/* use setregid(2) to set saved gid */
413157001Sgshapiro#   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
414157001Sgshapiro#    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
415157001Sgshapiro#   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
41690792Sgshapiro#    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
41790792Sgshapiro#     ifndef LA_TYPE
41890792Sgshapiro#      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
41990792Sgshapiro#     endif /* ! LA_TYPE */
42090792Sgshapiro#     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
42190792Sgshapiro#      define RANDOMSHIFT	8
42290792Sgshapiro#     endif /* ! RANDOMSHIFT */
42390792Sgshapiro#    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
42490792Sgshapiro#   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
42590792Sgshapiro#    ifndef HASRANDOM
42690792Sgshapiro#     define HASRANDOM	0		/* doesn't have random(3) */
42790792Sgshapiro#    endif /* ! HASRANDOM */
42890792Sgshapiro#   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
42990792Sgshapiro#   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
43090792Sgshapiro#    define SM_INT32	int	/* 32bit integer */
43190792Sgshapiro#   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
43290792Sgshapiro#   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
43390792Sgshapiro#    ifndef LA_TYPE
43490792Sgshapiro#     include <sys/loadavg.h>
43590792Sgshapiro#     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
43690792Sgshapiro#      include <sys/pset.h>
43790792Sgshapiro#      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
43890792Sgshapiro#     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
43990792Sgshapiro#      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
44090792Sgshapiro#     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
44190792Sgshapiro#    endif /* ! LA_TYPE */
44290792Sgshapiro#    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
44390792Sgshapiro#   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
44490792Sgshapiro#   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
44590792Sgshapiro#    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
44690792Sgshapiro#    define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
447120256Sgshapiro#    ifndef SMRSH_CMDDIR
448120256Sgshapiro#     define SMRSH_CMDDIR	"/var/adm/sm.bin"
449120256Sgshapiro#    endif /* ! SMRSH_CMDDIR */
45090792Sgshapiro#    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
451168515Sgshapiro#    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
45290792Sgshapiro#   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
45390792Sgshapiro#   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
45490792Sgshapiro#    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
455132943Sgshapiro#    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
456132943Sgshapiro#    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
45790792Sgshapiro#   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
458125820Sgshapiro#   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
459125820Sgshapiro#    define HASUNSETENV 1       /* unsetenv() added in S10 */
460125820Sgshapiro#   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
461173340Sgshapiro#   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
462173340Sgshapiro#    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
463203004Sgshapiro#    define HAVE_NANOSLEEP	1	/* moved from librt to libc in S11 */
464173340Sgshapiro#   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
46590792Sgshapiro#   ifndef HASGETUSERSHELL
46690792Sgshapiro#    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
46790792Sgshapiro#   endif /* ! HASGETUSERSHELL */
46890792Sgshapiro
46990792Sgshapiro#  else /* SOLARIS */
47090792Sgshapiro			/* SunOS 4.0.3 or 4.1.x */
47190792Sgshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
47290792Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
47390792Sgshapiro#   ifndef HASFLOCK
47490792Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
47590792Sgshapiro#   endif /* ! HASFLOCK */
47690792Sgshapiro#   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
47790792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
47890792Sgshapiro#   include <memory.h>
47990792Sgshapiro#   include <vfork.h>
48090792Sgshapiro#   ifdef __GNUC__
48190792Sgshapiro#    define strtoul	strtol	/* gcc library bogosity */
48290792Sgshapiro#   endif /* __GNUC__ */
48390792Sgshapiro#   define memmove(d, s, l)	(bcopy((s), (d), (l)))
48490792Sgshapiro#   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
48590792Sgshapiro#   define SM_INT32	int	/* 32bit integer */
48690792Sgshapiro#   define SM_ALIGN_SIZE (sizeof(long))
48790792Sgshapiro#   define GIDSET_T	int
48890792Sgshapiro#   define SM_CONF_SYSLOG	0
48990792Sgshapiro
49090792Sgshapiro#   ifdef SUNOS403
49190792Sgshapiro			/* special tweaking for SunOS 4.0.3 */
49290792Sgshapiro#    include <malloc.h>
49390792Sgshapiro#    define BSD4_3	1	/* 4.3 BSD-based */
49490792Sgshapiro#    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
49590792Sgshapiro#    define WAITUNION	1	/* use "union wait" as wait argument type */
49690792Sgshapiro#    undef WIFEXITED
49790792Sgshapiro#    undef WEXITSTATUS
49890792Sgshapiro#    undef HASUNAME
49990792Sgshapiro#    define setpgid	setpgrp
50090792Sgshapiro#    define MODE_T	int
50190792Sgshapirotypedef int		pid_t;
50290792Sgshapiroextern char		*getenv();
50390792Sgshapiro
50490792Sgshapiro#   else /* SUNOS403 */
50590792Sgshapiro			/* 4.1.x specifics */
506132943Sgshapiro#    define HASSETSID	1	/* has POSIX setsid(2) call */
50790792Sgshapiro#    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
50890792Sgshapiro
50990792Sgshapiro#   endif /* SUNOS403 */
51090792Sgshapiro#  endif /* SOLARIS */
51190792Sgshapiro
51290792Sgshapiro#  ifndef LA_TYPE
51390792Sgshapiro#   define LA_TYPE	LA_INT
51490792Sgshapiro#  endif /* ! LA_TYPE */
51590792Sgshapiro
51690792Sgshapiro# endif /* defined(sun) && !defined(BSD) */
51790792Sgshapiro
51890792Sgshapiro/*
51990792Sgshapiro**  DG/UX
52090792Sgshapiro**
52190792Sgshapiro**	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
52290792Sgshapiro**	older support.
52390792Sgshapiro**	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
52490792Sgshapiro*/
52590792Sgshapiro
52690792Sgshapiro# ifdef DGUX_5_4_2
52790792Sgshapiro#  define DGUX		1
52890792Sgshapiro# endif /* DGUX_5_4_2 */
52990792Sgshapiro
53090792Sgshapiro# ifdef DGUX
53190792Sgshapiro#  define SYSTEM5	1
53290792Sgshapiro#  define LA_TYPE	LA_DGUX
53390792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
53490792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
535132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
53690792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
53790792Sgshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
53890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
53990792Sgshapiro#  ifndef IDENTPROTO
54090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
54190792Sgshapiro#  endif /* ! IDENTPROTO */
54290792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
54390792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
54490792Sgshapiro#  define LDA_USE_LOCKF		1
54590792Sgshapiro
54690792Sgshapiro/* these include files must be included early on DG/UX */
54790792Sgshapiro#  include <netinet/in.h>
54890792Sgshapiro#  include <arpa/inet.h>
54990792Sgshapiro
55090792Sgshapiro/* compiler doesn't understand const? */
55190792Sgshapiro#  define const
55290792Sgshapiro
55390792Sgshapiro#  ifdef DGUX_5_4_2
55490792Sgshapiro#   define inet_addr	dgux_inet_addr
55590792Sgshapiroextern long	dgux_inet_addr();
55690792Sgshapiro#  endif /* DGUX_5_4_2 */
55790792Sgshapiro# endif /* DGUX */
55890792Sgshapiro
55990792Sgshapiro
56090792Sgshapiro/*
56190792Sgshapiro**  Digital Ultrix 4.2 - 4.5
56290792Sgshapiro**
56390792Sgshapiro**	Apparently, fcntl locking is broken on 4.2A, in that locks are
56490792Sgshapiro**	not dropped when the process exits.  This causes major problems,
56590792Sgshapiro**	so flock is the only alternative.
56690792Sgshapiro*/
56790792Sgshapiro
56890792Sgshapiro# ifdef ultrix
56990792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
57090792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
57190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
57290792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
57390792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
57490792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
57590792Sgshapiro#  ifndef HASFLOCK
57690792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
57790792Sgshapiro#  endif /* ! HASFLOCK */
57890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
57990792Sgshapiro#  ifndef BROKEN_RES_SEARCH
58090792Sgshapiro#   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
58190792Sgshapiro#  endif /* ! BROKEN_RES_SEARCH */
58290792Sgshapiro#  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
58390792Sgshapiro#   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
58490792Sgshapiro#  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
58590792Sgshapiro#  ifdef vax
58690792Sgshapiro#   define LA_TYPE	LA_FLOAT
58790792Sgshapiro#  else /* vax */
58890792Sgshapiro#   define LA_TYPE	LA_INT
58990792Sgshapiro#   define LA_AVENRUN	"avenrun"
59090792Sgshapiro#  endif /* vax */
59190792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
59290792Sgshapiro#  ifndef IDENTPROTO
59390792Sgshapiro#   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
59490792Sgshapiro#  endif /* ! IDENTPROTO */
59590792Sgshapiro#  define SYSLOG_BUFSIZE	256
59690792Sgshapiro#  define SM_CONF_SYSLOG	0
59790792Sgshapiro# endif /* ultrix */
59890792Sgshapiro
59990792Sgshapiro
60090792Sgshapiro/*
60190792Sgshapiro**  OSF/1 for KSR.
60290792Sgshapiro**
60390792Sgshapiro**	Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
60490792Sgshapiro*/
60590792Sgshapiro
60690792Sgshapiro# ifdef __ksr__
60790792Sgshapiro#  define __osf__	1	/* get OSF/1 defines below */
60890792Sgshapiro#  ifndef TZ_TYPE
60990792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
61090792Sgshapiro#  endif /* ! TZ_TYPE */
61190792Sgshapiro# endif /* __ksr__ */
61290792Sgshapiro
61390792Sgshapiro
61490792Sgshapiro/*
61590792Sgshapiro**  OSF/1 for Intel Paragon.
61690792Sgshapiro**
61790792Sgshapiro**	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
61890792Sgshapiro**	of Intel Scalable Systems Divison.
61990792Sgshapiro*/
62090792Sgshapiro
62190792Sgshapiro# ifdef __PARAGON__
62290792Sgshapiro#  define __osf__	1	/* get OSF/1 defines below */
62390792Sgshapiro#  ifndef TZ_TYPE
62490792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
62590792Sgshapiro#  endif /* ! TZ_TYPE */
62690792Sgshapiro#  define GIDSET_T	gid_t
62790792Sgshapiro#  define MAXNAMLEN	NAME_MAX
62890792Sgshapiro# endif /* __PARAGON__ */
62990792Sgshapiro
63090792Sgshapiro
63190792Sgshapiro/*
63290792Sgshapiro**  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
63390792Sgshapiro**
63490792Sgshapiro**	Tested for 3.2 and 4.0.
63590792Sgshapiro*/
63690792Sgshapiro
63790792Sgshapiro# ifdef __osf__
63890792Sgshapiro#  define HASUNAME	1	/* has uname(2) call */
63990792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
64090792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
64190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
64290792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
64390792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
64490792Sgshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
64590792Sgshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
64690792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
64790792Sgshapiro#  define GIDSET_T	gid_t
64890792Sgshapiro#  define SM_INT32	int	/* 32bit integer */
64990792Sgshapiro#  ifndef HASFLOCK
65098121Sgshapiro#   include <standards.h>
65198121Sgshapiro#   if _XOPEN_SOURCE+0 >= 400
65298121Sgshapiro#    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
65398121Sgshapiro#   else /* _XOPEN_SOURCE+0 >= 400 */
65498121Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
65598121Sgshapiro#   endif /* _XOPEN_SOURCE+0 >= 400 */
65690792Sgshapiro#  endif /* ! HASFLOCK */
65790792Sgshapiro#  define LA_TYPE	LA_ALPHAOSF
65890792Sgshapiro#  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
65990792Sgshapiro#  ifndef _PATH_VENDOR_CF
66090792Sgshapiro#   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
66190792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
66290792Sgshapiro#  ifndef _PATH_SENDMAILPID
66390792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
66490792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
66594334Sgshapiro#  if _FFR_DIGUNIX_SAFECHOWN
66694334Sgshapiro/*
66794334Sgshapiro**  Testing on a Digital UNIX 4.0a system showed this to be the correct
66894334Sgshapiro**  setting but given the security consequences, more testing and
66994334Sgshapiro**  verification is needed.  Unfortunately, the man page offers no
67094334Sgshapiro**  assistance.
67194334Sgshapiro*/
67294334Sgshapiro#   define IS_SAFE_CHOWN >= 0
67394334Sgshapiro#  endif /* _FFR_DIGUNIX_SAFECHOWN */
67490792Sgshapiro# endif /* __osf__ */
67590792Sgshapiro
67690792Sgshapiro
67790792Sgshapiro/*
67890792Sgshapiro**  NeXTstep
67990792Sgshapiro*/
68090792Sgshapiro
68190792Sgshapiro# ifdef NeXT
68290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
68390792Sgshapiro#  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
68490792Sgshapiro#  ifndef HASFLOCK
68590792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
68690792Sgshapiro#  endif /* ! HASFLOCK */
68790792Sgshapiro#  define UID_T		int	/* compiler gripes on uid_t */
68890792Sgshapiro#  define GID_T		int	/* ditto for gid_t */
68990792Sgshapiro#  define MODE_T	int	/* and mode_t */
69090792Sgshapiro#  define setpgid	setpgrp
69190792Sgshapiro#  ifndef NOT_SENDMAIL
69290792Sgshapiro#   define sleep		sleepX
69390792Sgshapiro#  endif /* ! NOT_SENDMAIL */
69490792Sgshapiro#  ifndef LA_TYPE
69590792Sgshapiro#   define LA_TYPE	LA_MACH
69690792Sgshapiro#  endif /* ! LA_TYPE */
69790792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
69890792Sgshapiro#  ifdef _POSIX_SOURCE
69990792Sgshapiroextern struct passwd	*getpwent();
70090792Sgshapiro#  else /* _POSIX_SOURCE */
70190792Sgshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
70290792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
70390792Sgshapirotypedef int		pid_t;
70490792Sgshapiro#   undef WEXITSTATUS
70590792Sgshapiro#   undef WIFEXITED
70690792Sgshapiro#   undef WIFSTOPPED
70790792Sgshapiro#   undef WTERMSIG
70890792Sgshapiro#  endif /* _POSIX_SOURCE */
70990792Sgshapiro#  ifndef _PATH_VENDOR_CF
71090792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
71190792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
71290792Sgshapiro#  ifndef _PATH_SENDMAILPID
71390792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
71490792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
71590792Sgshapiro#  define SM_INT32	int	/* 32bit integer */
71690792Sgshapiro
71790792Sgshapiro#  ifdef TCPWRAPPERS
71890792Sgshapiro#   ifndef HASUNSETENV
71990792Sgshapiro#    define HASUNSETENV	1
72090792Sgshapiro#   endif /* ! HASUNSETENV */
72190792Sgshapiro#   undef NEEDPUTENV
72290792Sgshapiro#  endif /* TCPWRAPPERS */
72390792Sgshapiro#  ifndef __APPLE__
72490792Sgshapiro#   include <libc.h>
72590792Sgshapiro#   ifndef S_IRUSR
72690792Sgshapiro#    define S_IRUSR	S_IREAD
72790792Sgshapiro#   endif /* ! S_IRUSR */
72890792Sgshapiro#   ifndef S_IWUSR
72990792Sgshapiro#    define S_IWUSR	S_IWRITE
73090792Sgshapiro#   endif /* ! S_IWUSR */
73190792Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
73290792Sgshapiro#  endif /* ! __APPLE__ */
73390792Sgshapiro#  ifndef isascii
73490792Sgshapiro#   define isascii(c)	((unsigned)(c) <= 0177)
73590792Sgshapiro#  endif /* ! isascii */
73690792Sgshapiro# endif /* NeXT */
73790792Sgshapiro
73890792Sgshapiro/*
739132943Sgshapiro**  Apple Darwin
740110560Sgshapiro**      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
74190792Sgshapiro*/
74290792Sgshapiro
74390792Sgshapiro# if defined(DARWIN)
744110560Sgshapiro#  define HASFCHMOD		1	/* has fchmod(2) */
745110560Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) */
746110560Sgshapiro#  define HASFLOCK		1	/* has flock(2) */
747110560Sgshapiro#  define HASUNAME		1	/* has uname(2) */
748110560Sgshapiro#  define HASUNSETENV		1	/* has unsetenv(3) */
749157001Sgshapiro#  define HASSETSID		1	/* has POSIX setsid(2) call */
750157001Sgshapiro#  define HASINITGROUPS		1	/* has initgroups(3) */
751110560Sgshapiro#  define HASSETVBUF		1	/* has setvbuf (3) */
752110560Sgshapiro#  define HASSETREUID		0	/* setreuid(2) unusable */
753110560Sgshapiro#  define HASSETEUID		1	/* has seteuid(2) */
754110560Sgshapiro#  define USESETEUID		1	/* has seteuid(2) */
755110560Sgshapiro#  define HASSETEGID		1	/* has setegid(2) */
756110560Sgshapiro#  define HASSETREGID		1	/* has setregid(2) */
757110560Sgshapiro#  define HASSETRESGID		0	/* no setresgid(2) */
758110560Sgshapiro#  define HASLSTAT		1	/* has lstat(2) */
759110560Sgshapiro#  define HASSETRLIMIT		1	/* has setrlimit(2) */
760110560Sgshapiro#  define HASWAITPID		1	/* has waitpid(2) */
761110560Sgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
762110560Sgshapiro#  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
763157001Sgshapiro#  define HASURANDOMDEV		1	/* has urandom(4) */
764110560Sgshapiro#  define HASSTRERROR		1	/* has strerror(3) */
765110560Sgshapiro#  define HASGETUSERSHELL	1	/* had getusershell(3) */
766110560Sgshapiro#  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
767110560Sgshapiro#  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
768110560Sgshapiro#  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
769157001Sgshapiro#  if DARWIN >= 70000
770157001Sgshapiro#   define SOCKADDR_LEN_T	socklen_t
771157001Sgshapiro#  endif
772157001Sgshapiro#  if DARWIN >= 80000
773157001Sgshapiro#   define SPT_TYPE		SPT_REUSEARGV
774157001Sgshapiro#   define SPT_PADCHAR		'\0'
775157001Sgshapiro#   define SOCKOPT_LEN_T	socklen_t
776157001Sgshapiro#  else
777157001Sgshapiro#   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
778157001Sgshapiro#  endif
779110560Sgshapiro#  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
780110560Sgshapiro#  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
781110560Sgshapiro#  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
782110560Sgshapiro#  define HAS_IN_H		1
783110560Sgshapiro#  define NETLINK		1	/* supports AF_LINK */
78494334Sgshapiro#  ifndef NOT_SENDMAIL
785110560Sgshapiro#   define sleep sleepX
786102528Sgshapiroextern unsigned int sleepX __P((unsigned int seconds));
78794334Sgshapiro#  endif /* ! NOT_SENDMAIL */
78890792Sgshapiro# endif /* defined(DARWIN) */
78990792Sgshapiro
79090792Sgshapiro
79190792Sgshapiro/*
79290792Sgshapiro**  4.4 BSD
79390792Sgshapiro**
79490792Sgshapiro**	See also BSD defines.
79590792Sgshapiro*/
79690792Sgshapiro
797157001Sgshapiro# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
79890792Sgshapiro#  include <paths.h>
79990792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
80090792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
80190792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
80290792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
80390792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
80490792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
80590792Sgshapiro#  include <sys/cdefs.h>
80690792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
80790792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
80890792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
80990792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
81090792Sgshapiro#  ifndef LA_TYPE
81190792Sgshapiro#   define LA_TYPE	LA_SUBR
81290792Sgshapiro#  endif /* ! LA_TYPE */
81390792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
81490792Sgshapiro#  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
815157001Sgshapiro# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
81690792Sgshapiro
81790792Sgshapiro
81890792Sgshapiro/*
81990792Sgshapiro**  BSD/OS (was BSD/386) (all versions)
82090792Sgshapiro**	From Tony Sanders, BSDI
82190792Sgshapiro*/
82290792Sgshapiro
82390792Sgshapiro# ifdef __bsdi__
82490792Sgshapiro#  include <paths.h>
82590792Sgshapiro#  define HASUNSETENV	1	/* has the unsetenv(3) call */
82690792Sgshapiro#  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
827132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
82890792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
82990792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
83090792Sgshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
83190792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
83290792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
83390792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
83490792Sgshapiro#  include <sys/cdefs.h>
83590792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
83690792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
83790792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
83890792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
83990792Sgshapiro#  ifndef LA_TYPE
84090792Sgshapiro#   define LA_TYPE	LA_SUBR
84190792Sgshapiro#  endif /* ! LA_TYPE */
84290792Sgshapiro#  define GIDSET_T	gid_t
84390792Sgshapiro#  define QUAD_T		quad_t
84490792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
84590792Sgshapiro			/* version 1.1 or later */
84690792Sgshapiro#   undef SPT_TYPE
84790792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
84890792Sgshapiro#  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
84990792Sgshapiro			/* version 1.0 or earlier */
85090792Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
85190792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
85290792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
85390792Sgshapiro#   define HASSETUSERCONTEXT 1	/* has setusercontext */
85490792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
85590792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
85690792Sgshapiro#   define MODE_T	int	/* va_arg() can't handle less than int */
85790792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
85890792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
85990792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
86090792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
86190792Sgshapiro# endif /* __bsdi__ */
86290792Sgshapiro
86390792Sgshapiro
864168515Sgshapiro# if defined(__QNX__)
865168515Sgshapiro#  if defined(__QNXNTO__)
866168515Sgshapiro/* QNX 6 */
867168515Sgshapiro#   include <unix.h>
868168515Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
869168515Sgshapiro#   define HASINITGROUPS	1	/* has initgroups(3) call */
870168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
871168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
872168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
873168515Sgshapiro#   define HASFCHOWN	1	/* has fchown(2) syscall */
874168515Sgshapiro#   define HASUNAME	1	/* has uname(2) syscall */
875168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
876168515Sgshapiro#   define BSD4_4_SOCKADDR	/* has sa_len */
877168515Sgshapiro#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
878168515Sgshapiro#   define NETLINK	1	/* supports AF_LINK */
879168515Sgshapiro#   define GIDSET_T	gid_t
880168515Sgshapiro#   define QUAD_T	uint64_t
881168515Sgshapiro#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
882168515Sgshapiro#   define HASGETUSERSHELL 0
883168515Sgshapiro
88490792Sgshapiro/*
885168515Sgshapiro**  We have a strrev() that doesn't allocate anything.
886168515Sgshapiro**  Make sure the one here is used.
887168515Sgshapiro*/
888168515Sgshapiro
889168515Sgshapiro#   define strrev strrev_sendmail
890168515Sgshapiro
891168515Sgshapiro#  else /* defined(__QNXNTO__) */
892168515Sgshapiro
893168515Sgshapiro/*
89490792Sgshapiro**  QNX 4.2x
89590792Sgshapiro**	Contributed by Glen McCready <glen@qnx.com>.
89690792Sgshapiro**
897168515Sgshapiro**	Should work with all versions of QNX 4.
89890792Sgshapiro*/
89990792Sgshapiro
900168515Sgshapiro#   include <unix.h>
901168515Sgshapiro#   include <sys/select.h>
902168515Sgshapiro#   undef NGROUPS_MAX
903168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
904168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
905168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
906168515Sgshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
907168515Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
908168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
909168515Sgshapiro#   define HASFLOCK	0
910168515Sgshapiro#   undef HASINITGROUPS		/* has initgroups(3) call */
911168515Sgshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
912168515Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
913168515Sgshapiro#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
914168515Sgshapiro#   define GIDSET_T	gid_t
915168515Sgshapiro#   define LA_TYPE	LA_ZERO
916168515Sgshapiro#   define SFS_TYPE	SFS_NONE
917168515Sgshapiro#   define SPT_TYPE	SPT_REUSEARGV
918168515Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
919168515Sgshapiro#   define HASGETUSERSHELL 0
920168515Sgshapiro#   define _FILE_H_INCLUDED
921168515Sgshapiro#  endif /* defined(__QNXNTO__) */
92290792Sgshapiro# endif /* defined(__QNX__) */
92390792Sgshapiro
92490792Sgshapiro
92590792Sgshapiro/*
926141858Sgshapiro**  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
92790792Sgshapiro**
92890792Sgshapiro**  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
92990792Sgshapiro**  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
93090792Sgshapiro**
93190792Sgshapiro**	See also BSD defines.
93290792Sgshapiro*/
93390792Sgshapiro
934141858Sgshapiro# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
93590792Sgshapiro#  include <paths.h>
93690792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
937132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
93890792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
93990792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
940132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
94190792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
94290792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
94390792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
94490792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
94590792Sgshapiro#  include <sys/cdefs.h>
94690792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
94790792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
94890792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
94990792Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
95090792Sgshapiro#  define GIDSET_T	gid_t
951157001Sgshapiro#  define QUAD_T	unsigned long long
952157001Sgshapiro#  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
95390792Sgshapiro#  ifndef LA_TYPE
95490792Sgshapiro#   define LA_TYPE	LA_SUBR
95590792Sgshapiro#  endif /* ! LA_TYPE */
956157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
957157001Sgshapiro    ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
958157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
959132943Sgshapiro#   undef SFS_TYPE
960132943Sgshapiro#   define SFS_TYPE	SFS_STATVFS
961132943Sgshapiro#  else
962132943Sgshapiro#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
963132943Sgshapiro#  endif
96490792Sgshapiro#  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
96590792Sgshapiro#   undef SPT_TYPE
96690792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
96790792Sgshapiro#  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
96890792Sgshapiro#  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
96990792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
97090792Sgshapiro#  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
971132943Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
972132943Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
973132943Sgshapiro#  endif
974157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
975157001Sgshapiro    ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
976157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
977132943Sgshapiro#   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
978132943Sgshapiro#  endif
979132943Sgshapiro#  if defined(__NetBSD__)
980132943Sgshapiro#   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
981132943Sgshapiro#   include <sys/param.h>
982132943Sgshapiro#   include <sys/sysctl.h>
983132943Sgshapiro#  endif
984141858Sgshapiro#  if defined(__DragonFly__)
985141858Sgshapiro#   define HASSETLOGIN		1	/* has setlogin(2) */
986141858Sgshapiro#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
987141858Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
988141858Sgshapiro#   undef SPT_TYPE
989141858Sgshapiro#   include <libutil.h>
990141858Sgshapiro#   define SPT_TYPE		SPT_BUILTIN
991141858Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
992141858Sgshapiro#   ifndef SMRSH_CMDDIR
993141858Sgshapiro#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
994141858Sgshapiro#   endif /* ! SMRSH_CMDDIR */
995141858Sgshapiro#   ifndef SMRSH_PATH
996141858Sgshapiro#    define SMRSH_PATH		"/bin:/usr/bin"
997141858Sgshapiro#   endif /* ! SMRSH_PATH */
998141858Sgshapiro#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
999141858Sgshapiro#  include <sys/sysctl.h>
1000141858Sgshapiro#  endif /* defined(__DragonFly__) */
100190792Sgshapiro#  if defined(__FreeBSD__)
100290792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
100390792Sgshapiro#   if __FreeBSD_version >= 227001
100490792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
100590792Sgshapiro#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
100690792Sgshapiro#   endif /* __FreeBSD_version >= 227001 */
100790792Sgshapiro#   undef SPT_TYPE
100890792Sgshapiro#   if __FreeBSD__ >= 2
100990792Sgshapiro#    include <osreldate.h>
101090792Sgshapiro#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
101190792Sgshapiro#     include <libutil.h>
101290792Sgshapiro#     define SPT_TYPE	SPT_BUILTIN
101390792Sgshapiro#    endif /* __FreeBSD_version >= 199512 */
101490792Sgshapiro#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
101590792Sgshapiro#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
101690792Sgshapiro#    endif /* __FreeBSD_version >= 222000 */
101790792Sgshapiro#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
1018120256Sgshapiro#     ifndef SMRSH_CMDDIR
1019120256Sgshapiro#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1020120256Sgshapiro#     endif /* ! SMRSH_CMDDIR */
1021120256Sgshapiro#     ifndef SMRSH_PATH
1022120256Sgshapiro#      define SMRSH_PATH	"/bin:/usr/bin"
1023120256Sgshapiro#     endif /* ! SMRSH_PATH */
102490792Sgshapiro#    endif /* __FreeBSD_version >= 330000 */
1025203004Sgshapiro#    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
1026203004Sgshapiro#     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
1027203004Sgshapiro#     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
1028203004Sgshapiro#    endif /* __FreeBSD_version >= 430000 */
102990792Sgshapiro#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
103090792Sgshapiro#    include <sys/sysctl.h>
103190792Sgshapiro#   endif /* __FreeBSD__ >= 2 */
103290792Sgshapiro#   ifndef SPT_TYPE
103390792Sgshapiro#    define SPT_TYPE	SPT_REUSEARGV
103490792Sgshapiro#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
103590792Sgshapiro#   endif /* ! SPT_TYPE */
103690792Sgshapiro#  endif /* defined(__FreeBSD__) */
103790792Sgshapiro#  if defined(__OpenBSD__)
103890792Sgshapiro#   undef SPT_TYPE
103990792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
104090792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
1041120256Sgshapiro#   if OpenBSD < 200305
1042120256Sgshapiro#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
1043120256Sgshapiro#   endif /* OpenBSD < 200305 */
104490792Sgshapiro#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
104590792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
104690792Sgshapiro#   if OpenBSD >= 200006
104790792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
104890792Sgshapiro#   endif /* OpenBSD >= 200006 */
104990792Sgshapiro#   if OpenBSD >= 200012
105090792Sgshapiro#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
105190792Sgshapiro#   endif /* OpenBSD >= 200012 */
1052132943Sgshapiro#   if OpenBSD >= 200405
1053132943Sgshapiro#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
1054132943Sgshapiro#   endif /* OpenBSD >= 200405 */
1055157001Sgshapiro#   if OpenBSD >= 200505
1056157001Sgshapiro#    undef NETISO	/* iso.h removed in 3.7 */
1057157001Sgshapiro#   endif /* OpenBSD >= 200505 */
105890792Sgshapiro#  endif /* defined(__OpenBSD__) */
1059141858Sgshapiro# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
106090792Sgshapiro
106190792Sgshapiro
106290792Sgshapiro/*
106390792Sgshapiro**  Mach386
106490792Sgshapiro**
106590792Sgshapiro**	For mt Xinu's Mach386 system.
106690792Sgshapiro*/
106790792Sgshapiro
106890792Sgshapiro# if defined(MACH) && defined(i386) && !defined(__GNU__)
106990792Sgshapiro#  define MACH386	1
107090792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
107190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
107290792Sgshapiro#  ifndef HASFLOCK
107390792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
107490792Sgshapiro#  endif /* ! HASFLOCK */
107590792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
107690792Sgshapiro#  define NEEDSTRTOL	1	/* need the strtol() function */
107790792Sgshapiro#  define setpgid	setpgrp
107890792Sgshapiro#  ifndef LA_TYPE
107990792Sgshapiro#   define LA_TYPE	LA_FLOAT
108090792Sgshapiro#  endif /* ! LA_TYPE */
108190792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
108290792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
108390792Sgshapiro#  undef WEXITSTATUS
108490792Sgshapiro#  undef WIFEXITED
108590792Sgshapiro#  ifndef _PATH_VENDOR_CF
108690792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
108790792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
108890792Sgshapiro#  ifndef _PATH_SENDMAILPID
108990792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
109090792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
109190792Sgshapiro# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
109290792Sgshapiro
109390792Sgshapiro
109490792Sgshapiro
109590792Sgshapiro/*
109690792Sgshapiro**  GNU OS (hurd)
109790792Sgshapiro**	Largely BSD & posix compatible.
109890792Sgshapiro**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
109990792Sgshapiro**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
110090792Sgshapiro*/
110190792Sgshapiro
110290792Sgshapiro# if defined(__GNU__) && !defined(NeXT)
110390792Sgshapiro#  include <paths.h>
110490792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
110590792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
110690792Sgshapiro#  define HASUNAME	1	/* has uname(2) call */
110790792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
110890792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
110990792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
111090792Sgshapiro#  define GIDSET_T	gid_t
111190792Sgshapiro#  define SOCKADDR_LEN_T	socklen_t
111290792Sgshapiro#  define SOCKOPT_LEN_T	socklen_t
111390792Sgshapiro#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
111490792Sgshapiro#   define LA_TYPE	LA_SUBR
111590792Sgshapiro#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
111690792Sgshapiro#   define LA_TYPE	LA_MACH
111790792Sgshapiro   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
111890792Sgshapiro#   define host_self	mach_host_self
111990792Sgshapiro#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
112090792Sgshapiro#  define SFS_TYPE	SFS_STATFS
112190792Sgshapiro#  define SPT_TYPE	SPT_CHANGEARGV
112290792Sgshapiro#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
112390792Sgshapiro#  define BSD4_4_SOCKADDR	1	/* has sa_len */
112490792Sgshapiro#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
112590792Sgshapiro#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
112690792Sgshapiro/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
112790792Sgshapiro#  define MAXPATHLEN	2048
112890792Sgshapiro# endif /* defined(__GNU__) && !defined(NeXT) */
112990792Sgshapiro
113090792Sgshapiro/*
113190792Sgshapiro**  4.3 BSD -- this is for very old systems
113290792Sgshapiro**
113390792Sgshapiro**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
113490792Sgshapiro**
113590792Sgshapiro**	You'll also have to install a new resolver library.
113690792Sgshapiro**	I don't guarantee that support for this environment is complete.
113790792Sgshapiro*/
113890792Sgshapiro
113990792Sgshapiro# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
114090792Sgshapiro#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
114190792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
114290792Sgshapiro#  define ARBPTR_T	char *
114390792Sgshapiro#  define setpgid	setpgrp
114490792Sgshapiro#  ifndef LA_TYPE
114590792Sgshapiro#   define LA_TYPE	LA_FLOAT
114690792Sgshapiro#  endif /* ! LA_TYPE */
114790792Sgshapiro#  ifndef _PATH_VENDOR_CF
114890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
114990792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
115090792Sgshapiro#  ifndef IDENTPROTO
115190792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
115290792Sgshapiro#  endif /* ! IDENTPROTO */
115390792Sgshapiro#  undef WEXITSTATUS
115490792Sgshapiro#  undef WIFEXITED
115590792Sgshapirotypedef short		pid_t;
115690792Sgshapiro# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
115790792Sgshapiro
115890792Sgshapiro
115990792Sgshapiro/*
116090792Sgshapiro**  SCO Unix
116190792Sgshapiro**
116290792Sgshapiro**	This includes three parts:
116390792Sgshapiro**
116490792Sgshapiro**	The first is for SCO OpenServer 5.
116590792Sgshapiro**	(Contributed by Keith Reynolds <keithr@sco.COM>).
116690792Sgshapiro**
116790792Sgshapiro**		SCO OpenServer 5 has a compiler version number macro,
116890792Sgshapiro**		which we can use to figure out what version we're on.
116990792Sgshapiro**		This may have to change in future releases.
117090792Sgshapiro**
117190792Sgshapiro**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
117290792Sgshapiro**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
117390792Sgshapiro**
117490792Sgshapiro**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
117590792Sgshapiro*/
117690792Sgshapiro
117790792Sgshapiro/* SCO OpenServer 5 */
117890792Sgshapiro# if _SCO_DS >= 1
117990792Sgshapiro#  include <paths.h>
118090792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
118190792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
118290792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
118390792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
118490792Sgshapiro#  define USESETEUID	1	/* has seteuid(2) call */
118590792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
118690792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
118790792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
118890792Sgshapiro#  define LDA_USE_LOCKF	1
118990792Sgshapiro#  ifndef LA_TYPE
119090792Sgshapiro#   define LA_TYPE	LA_DEVSHORT
119190792Sgshapiro#  endif /* ! LA_TYPE */
119290792Sgshapiro#  define _PATH_AVENRUN	"/dev/table/avenrun"
119390792Sgshapiro#  ifndef _SCO_unix_4_2
119490792Sgshapiro#   define _SCO_unix_4_2
119590792Sgshapiro#  else /* ! _SCO_unix_4_2 */
119690792Sgshapiro#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1197147078Sgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
119890792Sgshapiro#  endif /* ! _SCO_unix_4_2 */
119990792Sgshapiro# endif /* _SCO_DS >= 1 */
120090792Sgshapiro
120190792Sgshapiro/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
120290792Sgshapiro# ifdef _SCO_unix_4_2
120390792Sgshapiro#  define _SCO_unix_
120490792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
120590792Sgshapiro# endif /* _SCO_unix_4_2 */
120690792Sgshapiro
120790792Sgshapiro/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
120890792Sgshapiro# ifdef _SCO_unix_
120990792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
121090792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
121190792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
121290792Sgshapiro#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
121390792Sgshapiro#  ifndef USE_SIGLONGJMP
121490792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
121590792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
121690792Sgshapiro#  define MAXPATHLEN	PATHSIZE
121790792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
121890792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
121990792Sgshapiro#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
122090792Sgshapiro#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
122190792Sgshapiro#  define UID_T		uid_t
122290792Sgshapiro#  define GID_T		gid_t
122390792Sgshapiro#  define GIDSET_T	gid_t
122490792Sgshapiro#  define _PATH_UNIX		"/unix"
122590792Sgshapiro#  ifndef _PATH_VENDOR_CF
122690792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
122790792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
122890792Sgshapiro#  ifndef _PATH_SENDMAILPID
122990792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
123090792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
123190792Sgshapiro
123290792Sgshapiro/* stuff fixed in later releases */
123390792Sgshapiro#  ifndef _SCO_unix_4_2
123490792Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
123590792Sgshapiro#  endif /* ! _SCO_unix_4_2 */
123690792Sgshapiro
123790792Sgshapiro#  ifndef _SCO_DS
123890792Sgshapiro#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
123990792Sgshapiro#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
124090792Sgshapiro#   define NETUNIX	0	/* no unix domain socket support */
124190792Sgshapiro#   define LA_TYPE	LA_SHORT
124290792Sgshapiro#  endif /* ! _SCO_DS */
124390792Sgshapiro
124490792Sgshapiro# endif /* _SCO_unix_ */
124590792Sgshapiro
124690792Sgshapiro/*
124790792Sgshapiro**  ISC (SunSoft) Unix.
124890792Sgshapiro**
124990792Sgshapiro**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
125090792Sgshapiro*/
125190792Sgshapiro
125290792Sgshapiro# ifdef ISC_UNIX
125390792Sgshapiro#  include <net/errno.h>
125490792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
125590792Sgshapiro#  include <sys/bsdtypes.h>
125690792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
125790792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
125890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
125990792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
126090792Sgshapiro#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
126190792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
126290792Sgshapiro#  define MAXPATHLEN	1024
126390792Sgshapiro#  define LA_TYPE	LA_SHORT
126490792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
126590792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
126690792Sgshapiro#  define _PATH_UNIX		"/unix"
126790792Sgshapiro#  ifndef _PATH_VENDOR_CF
126890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
126990792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
127090792Sgshapiro#  ifndef _PATH_SENDMAILPID
127190792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
127290792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
127390792Sgshapiro# endif /* ISC_UNIX */
127490792Sgshapiro
127590792Sgshapiro
127690792Sgshapiro/*
127790792Sgshapiro**  Altos System V (5.3.1)
127890792Sgshapiro**	Contributed by Tim Rice <tim@trr.metro.net>.
127990792Sgshapiro*/
128090792Sgshapiro
128190792Sgshapiro# ifdef ALTOS_SYSTEM_V
128290792Sgshapiro#  include <sys/stream.h>
128390792Sgshapiro#  include <limits.h>
128490792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
128590792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
128690792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
128790792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
128890792Sgshapiro#  define NEEDFSYNC	1	/* no fsync(2) in system library */
128990792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
129090792Sgshapiro#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
129190792Sgshapiro#  define MAXPATHLEN	PATH_MAX
129290792Sgshapiro#  define LA_TYPE	LA_SHORT
129390792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
129490792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
129590792Sgshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
129690792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
129790792Sgshapiro#  undef WIFEXITED
129890792Sgshapiro#  undef WEXITSTATUS
129990792Sgshapiro#  define strtoul	strtol	/* gcc library bogosity */
130090792Sgshapiro
130190792Sgshapirotypedef unsigned short	uid_t;
130290792Sgshapirotypedef unsigned short	gid_t;
130390792Sgshapirotypedef short		pid_t;
130490792Sgshapirotypedef unsigned long	mode_t;
130590792Sgshapiro
130690792Sgshapiro/* some stuff that should have been in the include files */
130790792Sgshapiroextern char		*malloc();
130890792Sgshapiroextern struct passwd	*getpwent();
130990792Sgshapiroextern struct passwd	*getpwnam();
131090792Sgshapiroextern struct passwd	*getpwuid();
131190792Sgshapiroextern char		*getenv();
131290792Sgshapiroextern struct group	*getgrgid();
131390792Sgshapiroextern struct group	*getgrnam();
131490792Sgshapiro
131590792Sgshapiro# endif /* ALTOS_SYSTEM_V */
131690792Sgshapiro
131790792Sgshapiro
131890792Sgshapiro/*
131990792Sgshapiro**  ConvexOS 11.0 and later
132090792Sgshapiro**
132190792Sgshapiro**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
132290792Sgshapiro**	works on 9.1 as well.
132390792Sgshapiro**
132490792Sgshapiro**  ConvexOS 11.5 and later, should work on 11.0 as defined.
132590792Sgshapiro**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
132690792Sgshapiro**
132790792Sgshapiro**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
132890792Sgshapiro**		(now the CONVEX Technologies Center of Hewlett Packard)
132990792Sgshapiro*/
133090792Sgshapiro
133190792Sgshapiro# ifdef _CONVEX_SOURCE
133290792Sgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
133390792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) */
133490792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
133590792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
133690792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) */
133790792Sgshapiro#  define HASFLOCK	1	/* has flock(2) */
133890792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) */
133990792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) */
134090792Sgshapiro#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
134190792Sgshapiro#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
134290792Sgshapiro#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
134390792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
134490792Sgshapiro#  define LA_TYPE	LA_FLOAT
134590792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
134690792Sgshapiro#  ifndef _PATH_VENDOR_CF
134790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
134890792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
134990792Sgshapiro#  ifndef S_IREAD
135090792Sgshapiro#   define S_IREAD	_S_IREAD
135190792Sgshapiro#   define S_IWRITE	_S_IWRITE
135290792Sgshapiro#   define S_IEXEC	_S_IEXEC
135390792Sgshapiro#   define S_IFMT	_S_IFMT
135490792Sgshapiro#   define S_IFCHR	_S_IFCHR
135590792Sgshapiro#   define S_IFBLK	_S_IFBLK
135690792Sgshapiro#  endif /* ! S_IREAD */
135790792Sgshapiro#  ifndef TZ_TYPE
135890792Sgshapiro#   define TZ_TYPE	TZ_TIMEZONE
135990792Sgshapiro#  endif /* ! TZ_TYPE */
136090792Sgshapiro#  ifndef IDENTPROTO
136190792Sgshapiro#   define IDENTPROTO	1
136290792Sgshapiro#  endif /* ! IDENTPROTO */
136390792Sgshapiro#  ifndef SHARE_V1
136490792Sgshapiro#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
136590792Sgshapiro#  endif /* ! SHARE_V1 */
136690792Sgshapiro#  if !defined(__GNUC__ )
136790792Sgshapiro#   define UID_T	int		/* GNUC gets it right, ConvexC botches */
136890792Sgshapiro#   define GID_T	int		/* GNUC gets it right, ConvexC botches */
136990792Sgshapiro#  endif /* !defined(__GNUC__ ) */
137090792Sgshapiro#  if SECUREWARE
137190792Sgshapiro#   define FORK	fork		/* SecureWare wants the real fork! */
137290792Sgshapiro#  else /* SECUREWARE */
137390792Sgshapiro#   define FORK	vfork		/* the rest of the OS versions don't care */
137490792Sgshapiro#  endif /* SECUREWARE */
137590792Sgshapiro# endif /* _CONVEX_SOURCE */
137690792Sgshapiro
137790792Sgshapiro
137890792Sgshapiro/*
137990792Sgshapiro**  RISC/os 4.52
138090792Sgshapiro**
138190792Sgshapiro**	Gives a ton of warning messages, but otherwise compiles.
138290792Sgshapiro*/
138390792Sgshapiro
138490792Sgshapiro# ifdef RISCOS
138590792Sgshapiro
138690792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
138790792Sgshapiro#  ifndef HASFLOCK
138890792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
138990792Sgshapiro#  endif /* ! HASFLOCK */
139090792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
139190792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
139290792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
139390792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
139490792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
139590792Sgshapiro#  define LA_TYPE	LA_INT
139690792Sgshapiro#  define LA_AVENRUN	"avenrun"
139790792Sgshapiro#  define _PATH_UNIX	"/unix"
139890792Sgshapiro#  undef WIFEXITED
139990792Sgshapiro
140090792Sgshapiro#  define setpgid	setpgrp
140190792Sgshapiro
140290792Sgshapirotypedef int		pid_t;
140390792Sgshapiro#  define SIGFUNC_DEFINED
140490792Sgshapiro#  define SIGFUNC_RETURN	(0)
140590792Sgshapiro#  define SIGFUNC_DECL	int
140690792Sgshapirotypedef int		(*sigfunc_t)();
140790792Sgshapiroextern char		*getenv();
140890792Sgshapiroextern void		*malloc();
140990792Sgshapiro
141090792Sgshapiro/* added for RISC/os 4.01...which is dumber than 4.50 */
141190792Sgshapiro#  ifdef RISCOS_4_0
141290792Sgshapiro#   ifndef ARBPTR_T
141390792Sgshapiro#    define ARBPTR_T	char *
141490792Sgshapiro#   endif /* ! ARBPTR_T */
141590792Sgshapiro#   undef HASFLOCK
141690792Sgshapiro#   define HASFLOCK	0
141790792Sgshapiro#  endif /* RISCOS_4_0 */
141890792Sgshapiro
141990792Sgshapiro#  include <sys/time.h>
142090792Sgshapiro
142190792Sgshapiro# endif /* RISCOS */
142290792Sgshapiro
142390792Sgshapiro
142490792Sgshapiro/*
142590792Sgshapiro**  Linux 0.99pl10 and above...
142690792Sgshapiro**
142790792Sgshapiro**  Thanks to, in reverse order of contact:
142890792Sgshapiro**
142990792Sgshapiro**	John Kennedy <warlock@csuchico.edu>
143090792Sgshapiro**	Andrew Pam <avatar@aus.xanadu.com>
143190792Sgshapiro**	Florian La Roche <rzsfl@rz.uni-sb.de>
143290792Sgshapiro**	Karl London <karl@borg.demon.co.uk>
143390792Sgshapiro**
143490792Sgshapiro**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
143590792Sgshapiro**	file locking is no longer allowed.  In particular, make sure
143690792Sgshapiro**	your DBM library and sendmail are both using either flock(2)
143790792Sgshapiro**	*or* fcntl(2) file locking, but not both.
143890792Sgshapiro*/
143990792Sgshapiro
144090792Sgshapiro# ifdef __linux__
144190792Sgshapiro#  include <linux/version.h>
144290792Sgshapiro#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
144390792Sgshapiro#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
144490792Sgshapiro#  endif /* !defined(KERNEL_VERSION) */
144590792Sgshapiro#  define BSD		1	/* include BSD defines */
144690792Sgshapiro#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
144790792Sgshapiro#  ifndef REQUIRES_DIR_FSYNC
144890792Sgshapiro#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
144990792Sgshapiro#  endif /* REQUIRES_DIR_FSYNC */
145090792Sgshapiro#  ifndef USESETEUID
145190792Sgshapiro#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
145290792Sgshapiro#  endif /* USESETEUID */
1453112810Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
145490792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
145590792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
145690792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
145790792Sgshapiro#  define GIDSET_T	gid_t	/* from <linux/types.h> */
145890792Sgshapiro#  ifndef HASGETUSERSHELL
145990792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
146090792Sgshapiro#  endif /* HASGETUSERSHELL */
146190792Sgshapiro#  ifndef IP_SRCROUTE
146290792Sgshapiro#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
146390792Sgshapiro#  endif /* ! IP_SRCROUTE */
146490792Sgshapiro#  ifndef HAS_IN_H
146590792Sgshapiro#   define HAS_IN_H	1	/* use netinet/in.h */
146690792Sgshapiro#  endif /* ! HAS_IN_H */
146790792Sgshapiro#  ifndef USE_SIGLONGJMP
146890792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
146990792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
147090792Sgshapiro#  ifndef HASFLOCK
147190792Sgshapiro#   if LINUX_VERSION_CODE < 66399
147290792Sgshapiro#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
147390792Sgshapiro#   else /* LINUX_VERSION_CODE < 66399 */
1474132943Sgshapiro#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
1475132943Sgshapiro#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1476132943Sgshapiro#     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1477132943Sgshapiro#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1478132943Sgshapiro#     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
147990792Sgshapiro#   endif /* LINUX_VERSION_CODE < 66399 */
148090792Sgshapiro#  endif /* ! HASFLOCK */
148190792Sgshapiro#  ifndef LA_TYPE
148290792Sgshapiro#   define LA_TYPE	LA_PROCSTR
148390792Sgshapiro#  endif /* ! LA_TYPE */
148490792Sgshapiro#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
148590792Sgshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
148690792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
148790792Sgshapiro#   ifndef HASURANDOMDEV
148890792Sgshapiro#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
148990792Sgshapiro#   endif /* ! HASURANDOMDEV */
149090792Sgshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1491120256Sgshapiro#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1492132943Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
1493120256Sgshapiro#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
149490792Sgshapiro#  ifndef TZ_TYPE
149590792Sgshapiro#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
149690792Sgshapiro#  endif /* ! TZ_TYPE */
149798841Sgshapiro#  if (__GLIBC__ >= 2)
149898841Sgshapiro#   include <paths.h>
149998841Sgshapiro#  endif /* (__GLIBC__ >= 2) */
150090792Sgshapiro#  ifndef _PATH_SENDMAILPID
150190792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
150290792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
150390792Sgshapiro#  include <sys/sysmacros.h>
150490792Sgshapiro#  undef atol			/* wounded in <stdlib.h> */
150590792Sgshapiro#  if NETINET6
150690792Sgshapiro   /*
150790792Sgshapiro   **  Linux doesn't have a good way to tell userland what interfaces are
150890792Sgshapiro   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
150990792Sgshapiro   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
151090792Sgshapiro   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
151190792Sgshapiro   */
151290792Sgshapiro#   define ADDRCONFIG_IS_BROKEN	1
151390792Sgshapiro
151490792Sgshapiro   /*
151590792Sgshapiro   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
151690792Sgshapiro   **  in 2.1 and later, but the APIs appear before the functions.
151790792Sgshapiro   */
151890792Sgshapiro#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
151990792Sgshapiro#    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
152090792Sgshapiro#    if (GLIBC_VERSION >= 0x201)
152190792Sgshapiro#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
152290792Sgshapiro#    else /* (GLIBC_VERSION >= 0x201) */
152390792Sgshapiro#     include <linux/in6.h>	/* IPv6 support */
152490792Sgshapiro#    endif /* (GLIBC_VERSION >= 0x201) */
152590792Sgshapiro#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
152690792Sgshapiro     /* Have APIs in <netdb.h>, but no support in glibc */
152790792Sgshapiro#     define NEEDSGETIPNODE	1
152890792Sgshapiro#    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
152990792Sgshapiro#    undef GLIBC_VERSION
153090792Sgshapiro#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
153190792Sgshapiro#  endif /* NETINET6 */
153290792Sgshapiro#  ifndef HASFCHOWN
153390792Sgshapiro#   define HASFCHOWN	1	/* fchown(2) */
153490792Sgshapiro#  endif /* ! HASFCHOWN */
153590792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
153690792Sgshapiro#    define HASFCHMOD	1	/* fchmod(2) */
153790792Sgshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
153890792Sgshapiro# endif /* __linux__ */
153990792Sgshapiro
154090792Sgshapiro
154190792Sgshapiro/*
154290792Sgshapiro**  DELL SVR4 Issue 2.2, and others
154390792Sgshapiro**	From Kimmo Suominen <kim@grendel.lut.fi>
154490792Sgshapiro**
154590792Sgshapiro**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
154690792Sgshapiro**	defined, and the definitions conflict.
154790792Sgshapiro**
154890792Sgshapiro**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
154990792Sgshapiro**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
155090792Sgshapiro**	(SVR4.0/386 version 3.0).
155190792Sgshapiro*/
155290792Sgshapiro
155390792Sgshapiro# ifdef DELL_SVR4
155490792Sgshapiro				/* no changes necessary */
155590792Sgshapiro				/* see general __svr4__ defines below */
155690792Sgshapiro# endif /* DELL_SVR4 */
155790792Sgshapiro
155890792Sgshapiro
155990792Sgshapiro/*
156090792Sgshapiro**  Apple A/UX 3.0
156190792Sgshapiro*/
156290792Sgshapiro
156390792Sgshapiro# ifdef _AUX_SOURCE
156490792Sgshapiro#  include <sys/sysmacros.h>
156590792Sgshapiro#  define BSD			/* has BSD routines */
156690792Sgshapiro#  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
156790792Sgshapiro#  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
156890792Sgshapiro#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
156990792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
157090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
157190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
157290792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) in libc */
157390792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
157490792Sgshapiro#  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
157590792Sgshapiro#  define SIGFUNC_RETURN		/* POSIX-mode */
157690792Sgshapiro#  define SIGFUNC_DECL	void	/* POSIX-mode */
157790792Sgshapiro#  define ERRLIST_PREDEFINED	1
157890792Sgshapiro#  ifndef IDENTPROTO
157990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
158090792Sgshapiro#  endif /* ! IDENTPROTO */
158190792Sgshapiro#  ifndef LA_TYPE
158290792Sgshapiro#   define LA_TYPE	LA_INT
158390792Sgshapiro#   define FSHIFT	16
158490792Sgshapiro#  endif /* ! LA_TYPE */
158590792Sgshapiro#  define LA_AVENRUN	"avenrun"
158690792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
158790792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
158890792Sgshapiro#  ifndef _PATH_UNIX
158990792Sgshapiro#   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
159090792Sgshapiro#  endif /* ! _PATH_UNIX */
159190792Sgshapiro#  ifndef _PATH_VENDOR_CF
159290792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
159390792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
159490792Sgshapiro#  undef WIFEXITED
159590792Sgshapiro#  undef WEXITSTATUS
159690792Sgshapiro# endif /* _AUX_SOURCE */
159790792Sgshapiro
159890792Sgshapiro
159990792Sgshapiro/*
160090792Sgshapiro**  Encore UMAX V
160190792Sgshapiro**
160290792Sgshapiro**	Not extensively tested.
160390792Sgshapiro*/
160490792Sgshapiro
160590792Sgshapiro# ifdef UMAXV
160690792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
160790792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
160890792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
160990792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
161090792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
161190792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
161290792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
161390792Sgshapiro#  define MAXPATHLEN	PATH_MAX
161490792Sgshapiroextern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
161590792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
161690792Sgshapiro#  undef WIFEXITED
161790792Sgshapiro#  undef WEXITSTATUS
161890792Sgshapiro# endif /* UMAXV */
161990792Sgshapiro
162090792Sgshapiro
162190792Sgshapiro/*
162290792Sgshapiro**  Stardent Titan 3000 running TitanOS 4.2.
162390792Sgshapiro**
162490792Sgshapiro**	Must be compiled in "cc -43" mode.
162590792Sgshapiro**
162690792Sgshapiro**	From Kate Hedstrom <kate@ahab.rutgers.edu>.
162790792Sgshapiro**
162890792Sgshapiro**	Note the tweaking below after the BSD defines are set.
162990792Sgshapiro*/
163090792Sgshapiro
163190792Sgshapiro# ifdef titan
163290792Sgshapiro#  define setpgid	setpgrp
163390792Sgshapirotypedef int		pid_t;
163490792Sgshapiro#  undef WIFEXITED
163590792Sgshapiro#  undef WEXITSTATUS
163690792Sgshapiro# endif /* titan */
163790792Sgshapiro
163890792Sgshapiro
163990792Sgshapiro/*
164090792Sgshapiro**  Sequent DYNIX 3.2.0
164190792Sgshapiro**
164290792Sgshapiro**	From Jim Davis <jdavis@cs.arizona.edu>.
164390792Sgshapiro*/
164490792Sgshapiro
164590792Sgshapiro# ifdef sequent
164690792Sgshapiro
164790792Sgshapiro#  define BSD		1
164890792Sgshapiro#  define HASUNSETENV	1
164990792Sgshapiro#  define BSD4_3		1	/* to get signal() in conf.c */
165090792Sgshapiro#  define WAITUNION	1
165190792Sgshapiro#  define LA_TYPE	LA_FLOAT
165290792Sgshapiro#  ifdef _POSIX_VERSION
165390792Sgshapiro#   undef _POSIX_VERSION		/* set in <unistd.h> */
165490792Sgshapiro#  endif /* _POSIX_VERSION */
165590792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
165690792Sgshapiro#  define setpgid	setpgrp
165790792Sgshapiro
165890792Sgshapiro/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
165990792Sgshapiro#  undef	WIFEXITED
166090792Sgshapiro#  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
166190792Sgshapiro			 ((union wait*)&(s))->w_termsig == 0)
166290792Sgshapiro#  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
166390792Sgshapirotypedef int		pid_t;
166490792Sgshapiro#  define isgraph(c)	(isprint(c) && (c != ' '))
166590792Sgshapiro
166690792Sgshapiro#  ifndef IDENTPROTO
166790792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
166890792Sgshapiro#  endif /* ! IDENTPROTO */
166990792Sgshapiro
167090792Sgshapiro#  ifndef _PATH_UNIX
167190792Sgshapiro#   define _PATH_UNIX		"/dynix"
167290792Sgshapiro#  endif /* ! _PATH_UNIX */
167390792Sgshapiro#  ifndef _PATH_VENDOR_CF
167490792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
167590792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
167690792Sgshapiro# endif /* sequent */
167790792Sgshapiro
167890792Sgshapiro
167990792Sgshapiro/*
168090792Sgshapiro**  Sequent DYNIX/ptx v2.0 (and higher)
168190792Sgshapiro**
168290792Sgshapiro**	For DYNIX/ptx v1.x, undefine HASSETREUID.
168390792Sgshapiro**
168490792Sgshapiro**	From Tim Wright <timw@sequent.com>.
168590792Sgshapiro**	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
168690792Sgshapiro**		for DYNIX/ptx 4.0.2.
168790792Sgshapiro*/
168890792Sgshapiro
168990792Sgshapiro# ifdef _SEQUENT_
169090792Sgshapiro#  include <sys/stream.h>
169190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
169290792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
169390792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
169490792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
169590792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
169690792Sgshapiro#  define GIDSET_T	gid_t
169790792Sgshapiro#  define LA_TYPE	LA_INT
169890792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
169990792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
170090792Sgshapiro#  ifndef IDENTPROTO
170190792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
170290792Sgshapiro#  endif /* ! IDENTPROTO */
170390792Sgshapiro#  ifndef _PATH_VENDOR_CF
170490792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
170590792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
170690792Sgshapiro#  ifndef _PATH_SENDMAILPID
170790792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
170890792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
170990792Sgshapiro# endif /* _SEQUENT_ */
171090792Sgshapiro
171190792Sgshapiro/*
1712132943Sgshapiro**  Cray UNICOS, UNICOS/mk, and UNICOS/mp
171390792Sgshapiro**
1714132943Sgshapiro**    UNICOS:
171590792Sgshapiro**	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
1716132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1717132943Sgshapiro**    UNICOS/mk (Cray T3E):
1718132943Sgshapiro**	Contributed by Manu Mahonen <mailadm@csc.fi>
1719132943Sgshapiro**	of Center for Scientific Computing.
1720132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1721132943Sgshapiro**    UNICOS/mp:
1722132943Sgshapiro**	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
172390792Sgshapiro*/
172490792Sgshapiro
1725132943Sgshapiro# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
172690792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
1727132943Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1728132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) */
1729132943Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
1730132943Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
1731132943Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
1732132943Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
1733132943Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
1734132943Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
1735132943Sgshapiro#  define GIDSET_T	gid_t
173690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1737132943Sgshapiro#  define SFS_BAVAIL	f_bfree	/* alternate field name */
1738132943Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1739132943Sgshapiro#  ifdef UNICOS
1740132943Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1741132943Sgshapiro#   define LA_TYPE	LA_ZERO
1742132943Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
1743132943Sgshapiro#   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
1744132943Sgshapiro#   ifndef MAXPATHLEN
1745132943Sgshapiro#    define MAXPATHLEN PATHSIZE
1746132943Sgshapiro#   endif /* ! MAXPATHLEN */
1747132943Sgshapiro#   ifndef _PATH_UNIX
1748132943Sgshapiro#    ifdef UNICOSMK
1749132943Sgshapiro#     define _PATH_UNIX		"/unicosmk.ar"
1750132943Sgshapiro#    else
1751132943Sgshapiro#     define _PATH_UNIX		"/unicos"
1752132943Sgshapiro#    endif /* UNICOSMK */
1753132943Sgshapiro#   endif /* ! _PATH_UNIX */
1754132943Sgshapiro#   ifndef _PATH_VENDOR_CF
1755132943Sgshapiro#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1756132943Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
1757132943Sgshapiro#  endif /* UNICOS */
1758132943Sgshapiro#  ifdef _UNICOSMP
1759132943Sgshapiro#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1760132943Sgshapiro    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1761132943Sgshapiro#   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1762132943Sgshapiro#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
1763132943Sgshapiro#   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
1764132943Sgshapiro#   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
1765132943Sgshapiro#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1766132943Sgshapiro#   include <sys/cdefs.h>
1767132943Sgshapiro#   include <paths.h>
1768132943Sgshapiro#   define ARGV_T char *const *
1769132943Sgshapiro#  endif /* _UNICOSMP */
1770132943Sgshapiro# endif /* _CRAY */
177190792Sgshapiro
177290792Sgshapiro/*
177390792Sgshapiro**  Apollo DomainOS
177490792Sgshapiro**
177590792Sgshapiro**  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
177690792Sgshapiro**
177790792Sgshapiro**  15 Jan 1994; updated 2 Aug 1995
177890792Sgshapiro**
177990792Sgshapiro*/
178090792Sgshapiro
178190792Sgshapiro# ifdef apollo
178290792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
178390792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(2) call */
178490792Sgshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
178590792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
178690792Sgshapiro#  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
178790792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
178890792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
178990792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
179090792Sgshapiro#  ifndef _PATH_VENDOR_CF
179190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
179290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
179390792Sgshapiro#  ifndef _PATH_SENDMAILPID
179490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
179590792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
179690792Sgshapiro#  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
179790792Sgshapiro#  undef	 S_IFIFO
179890792Sgshapiro#  define S_IFIFO	0010000
179990792Sgshapiro#  ifndef IDENTPROTO
180090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
180190792Sgshapiro#  endif /* ! IDENTPROTO */
180290792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
180390792Sgshapiro#  if defined(NGROUPS_MAX) && !NGROUPS_MAX
180490792Sgshapiro#   undef NGROUPS_MAX
180590792Sgshapiro#  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
180690792Sgshapiro# endif /* apollo */
180790792Sgshapiro
180890792Sgshapiro/*
180990792Sgshapiro**  MPE-iX
181090792Sgshapiro**
181190792Sgshapiro**	Requires MPE 6.0 or greater.  See sendmail/README for more info.
181290792Sgshapiro**
181390792Sgshapiro**	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
181490792Sgshapiro*/
181590792Sgshapiro
181690792Sgshapiro# ifdef MPE
181790792Sgshapiro
181890792Sgshapiro#  include <sys/sysmacros.h>
181990792Sgshapiro#  include <fcntl.h>
182090792Sgshapiro
182190792Sgshapiro/* Sendmail stuff */
182290792Sgshapiro#  define HASFCHOWN		0	/* lacks fchown() */
182390792Sgshapiro#  define HASGETUSERSHELL	0	/* lacks getusershell() */
182490792Sgshapiro#  ifdef HASNICE
182590792Sgshapiro#   undef  HASNICE
182690792Sgshapiro#  endif /* HASNICE */
182790792Sgshapiro#  define HASNICE		0	/* lacks nice() */
182890792Sgshapiro#  define HASRANDOM		0	/* lacks random() */
182990792Sgshapiro#  ifdef HASRRESVPORT
183090792Sgshapiro#   undef HASRRESVPORT
183190792Sgshapiro#  endif /* HASRRESVPORT */
183290792Sgshapiro#  define HASRRESVPORT		0	/* lacks rresvport() */
183390792Sgshapiro#  define IP_SRCROUTE		0	/* lacks IP source routing fields */
183490792Sgshapiro#  ifdef MATCHGECOS
183590792Sgshapiro#   undef MATCHGECOS
183690792Sgshapiro#  endif /* MATCHGECOS */
183790792Sgshapiro#  define MATCHGECOS		0	/* lacks an initialized GECOS field */
183890792Sgshapiro#  define NEEDFSYNC		1	/* use sendmail's fsync() */
183990792Sgshapiro#  define NEEDLINK		1	/* use sendmail's link() */
184090792Sgshapiro#  define NOFTRUNCATE		1	/* lacks ftruncate() */
184190792Sgshapiro#  define SFS_TYPE		SFS_NONE /* can't determine disk space */
184290792Sgshapiro#  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
184390792Sgshapiro#  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
184490792Sgshapiro#  define USE_ENVIRON		1	/* use environ instead of envp */
184590792Sgshapiro
184690792Sgshapiro/* Missing header stuff */
184790792Sgshapiro#  define AF_UNSPEC		0
184890792Sgshapiro#  define AF_MAX		AF_INET
184990792Sgshapiro#  define IFF_LOOPBACK		0x8
185090792Sgshapiro#  define IN_LOOPBACKNET	127
185190792Sgshapiro#  define MAXNAMLEN		NAME_MAX
185290792Sgshapiro#  define S_IEXEC		S_IXUSR
185390792Sgshapiro#  define S_IREAD		S_IRUSR
185490792Sgshapiro#  define S_IWRITE		S_IWUSR
185590792Sgshapiro
185690792Sgshapiro/* Present header stuff that needs to be missing */
185790792Sgshapiro#  undef NGROUPS_MAX
185890792Sgshapiro
185990792Sgshapiro/* Shadow functions */
186090792Sgshapiro#  define bind		sendmail_mpe_bind
186190792Sgshapiro#  define _exit		sendmail_mpe__exit
186290792Sgshapiro#  define exit		sendmail_mpe_exit
186390792Sgshapiro#  define fcntl		sendmail_mpe_fcntl
186490792Sgshapiro#  define getegid	sendmail_mpe_getegid
186590792Sgshapiro#  define geteuid	sendmail_mpe_geteuid
186690792Sgshapiro#  define getpwnam	sendmail_mpe_getpwnam
186790792Sgshapiro#  define getpwuid	sendmail_mpe_getpwuid
186890792Sgshapiro#  define setgid	sendmail_mpe_setgid
186990792Sgshapiro#  define setuid	sendmail_mpe_setuid
187090792Sgshapiroextern int		sendmail_mpe_fcntl __P((int, int, ...));
187190792Sgshapiroextern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
187290792Sgshapiroextern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
187390792Sgshapiro# endif /* MPE */
187490792Sgshapiro
187590792Sgshapiro/*
187690792Sgshapiro**  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
187790792Sgshapiro**
187890792Sgshapiro**	Contributed by Paul Gampe <paulg@apnic.net>
187990792Sgshapiro*/
188090792Sgshapiro
188190792Sgshapiro# ifdef __svr5__
188290792Sgshapiro#  include <sys/mkdev.h>
188390792Sgshapiro#  define __svr4__
188490792Sgshapiro#  define SYS5SIGNALS		1
188590792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
1886132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
188790792Sgshapiro#  define HASSETREUID		1
188890792Sgshapiro#  define HASWAITPID		1
188990792Sgshapiro#  define HASGETDTABLESIZE	1
189090792Sgshapiro#  define GIDSET_T		gid_t
1891147078Sgshapiro#  define SOCKADDR_LEN_T	size_t
189290792Sgshapiro#  define SOCKOPT_LEN_T		size_t
189390792Sgshapiro#  ifndef _PATH_UNIX
189490792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
189590792Sgshapiro#  endif /* ! _PATH_UNIX */
189690792Sgshapiro#  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
189790792Sgshapiro#  ifndef SYSLOG_BUFSIZE
189890792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* unsure */
189990792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
190090792Sgshapiro#  ifndef _PATH_VENDOR_CF
190190792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
190290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
190390792Sgshapiro#  ifndef _PATH_SENDMAILPID
190490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
190590792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
190690792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
190790792Sgshapiro#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
190890792Sgshapiro# define SM_SET_H_ERRNO(err)	set_h_errno((err))
190990792Sgshapiro#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
191090792Sgshapiro# endif /* __svr5__ */
191190792Sgshapiro
191290792Sgshapiro/* ###################################################################### */
191390792Sgshapiro
191490792Sgshapiro/*
191590792Sgshapiro**  UnixWare 2.x
191690792Sgshapiro*/
191790792Sgshapiro
191890792Sgshapiro# ifdef UNIXWARE2
191990792Sgshapiro#  define UNIXWARE	1
192090792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
192190792Sgshapiro# endif /* UNIXWARE2 */
192290792Sgshapiro
192390792Sgshapiro
192490792Sgshapiro/*
192590792Sgshapiro**  UnixWare 1.1.2.
192690792Sgshapiro**
192790792Sgshapiro**	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
192890792Sgshapiro**	From Evan Champion <evanc@spatial.synapse.org>.
192990792Sgshapiro*/
193090792Sgshapiro
193190792Sgshapiro# ifdef UNIXWARE
193290792Sgshapiro#  include <sys/mkdev.h>
193390792Sgshapiro#  define SYSTEM5		1
193490792Sgshapiro#  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
193590792Sgshapiro#  define HASSETREUID		1
1936132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
193790792Sgshapiro#  define HASINITGROUPS		1
193890792Sgshapiro#  define GIDSET_T		gid_t
193990792Sgshapiro#  define SLEEP_T		unsigned
194090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
194190792Sgshapiro#  define LA_TYPE		LA_ZERO
194290792Sgshapiro#  undef WIFEXITED
194390792Sgshapiro#  undef WEXITSTATUS
194490792Sgshapiro#  ifndef _PATH_UNIX
194590792Sgshapiro#   define _PATH_UNIX		"/unix"
194690792Sgshapiro#  endif /* ! _PATH_UNIX */
194790792Sgshapiro#  ifndef _PATH_VENDOR_CF
194890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
194990792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
195090792Sgshapiro#  ifndef _PATH_SENDMAILPID
195190792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
195290792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
195390792Sgshapiro#  define SYSLOG_BUFSIZE	128
195490792Sgshapiro# endif /* UNIXWARE */
195590792Sgshapiro
195690792Sgshapiro
195790792Sgshapiro/*
195890792Sgshapiro**  Intergraph CLIX 3.1
195990792Sgshapiro**
196090792Sgshapiro**	From Paul Southworth <pauls@locust.cic.net>
196190792Sgshapiro*/
196290792Sgshapiro
196390792Sgshapiro# ifdef CLIX
196490792Sgshapiro#  define SYSTEM5	1	/* looks like System V */
196590792Sgshapiro#  ifndef HASGETUSERSHELL
196690792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
196790792Sgshapiro#  endif /* ! HASGETUSERSHELL */
196890792Sgshapiro#  define DEV_BSIZE	512	/* device block size not defined */
196990792Sgshapiro#  define GIDSET_T	gid_t
197090792Sgshapiro#  undef LOG			/* syslog not available */
197190792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
197290792Sgshapiro#  define GETSHORT	_getshort
197390792Sgshapiro# endif /* CLIX */
197490792Sgshapiro
197590792Sgshapiro
197690792Sgshapiro/*
197790792Sgshapiro**  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
197890792Sgshapiro**
197990792Sgshapiro**	From Kevin Darcy <kevin@tech.mis.cfc.com>.
198090792Sgshapiro*/
198190792Sgshapiro
198290792Sgshapiro# ifdef NCR_MP_RAS2
198390792Sgshapiro#  include <sys/sockio.h>
198490792Sgshapiro#  define __svr4__
198590792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
198690792Sgshapiro#  define SYSLOG_BUFSIZE	1024
198790792Sgshapiro#  define SPT_TYPE  SPT_NONE
198890792Sgshapiro# endif /* NCR_MP_RAS2 */
198990792Sgshapiro
199090792Sgshapiro
199190792Sgshapiro/*
199290792Sgshapiro**  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
199390792Sgshapiro**
199490792Sgshapiro**	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
199590792Sgshapiro*/
199690792Sgshapiro
199790792Sgshapiro# ifdef NCR_MP_RAS3
199890792Sgshapiro#  define __svr4__
199990792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
200090792Sgshapiro#  define LDA_USE_LOCKF		1
200190792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
200290792Sgshapiro#  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
200390792Sgshapiro#  define SYSLOG_BUFSIZE	1024
200490792Sgshapiro#  define SPT_TYPE	SPT_NONE
200590792Sgshapiro#  define _PATH_MAILDIR	"/var/mail"
200690792Sgshapiro#  ifndef _XOPEN_SOURCE
200790792Sgshapiro#   define _XOPEN_SOURCE
200890792Sgshapiro#   define _XOPEN_SOURCE_EXTENDED 1
200990792Sgshapiro#   include <sys/resource.h>
201090792Sgshapiro#   undef _XOPEN_SOURCE
201190792Sgshapiro#   undef _XOPEN_SOURCE_EXTENDED
201290792Sgshapiro#  endif /* ! _XOPEN_SOURCE */
201390792Sgshapiro# endif /* NCR_MP_RAS3 */
201490792Sgshapiro
201590792Sgshapiro
201690792Sgshapiro/*
201790792Sgshapiro**  Tandem NonStop-UX SVR4
201890792Sgshapiro**
201990792Sgshapiro**	From Rick McCarty <mccarty@mpd.tandem.com>.
202090792Sgshapiro*/
202190792Sgshapiro
202290792Sgshapiro# ifdef NonStop_UX_BXX
202390792Sgshapiro#  define __svr4__
202490792Sgshapiro# endif /* NonStop_UX_BXX */
202590792Sgshapiro
202690792Sgshapiro
202790792Sgshapiro/*
202890792Sgshapiro**  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
202990792Sgshapiro**
203090792Sgshapiro**	Tested for 1.04, 1.03
203190792Sgshapiro**	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
203290792Sgshapiro**
203390792Sgshapiro**	Tested for 4.02, 6.10 and 7.10
203490792Sgshapiro**	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
203590792Sgshapiro*/
203690792Sgshapiro
203790792Sgshapiro# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
203890792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
203990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
204090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
204190792Sgshapiro#  define setreuid(r, e)	setresuid(r, e, -1)
204290792Sgshapiro#  define LA_TYPE	LA_FLOAT
204390792Sgshapiro#  define SPT_TYPE	SPT_PSTAT
204490792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
204590792Sgshapiro#  ifndef HASSETVBUF
204690792Sgshapiro#   define HASSETVBUF	/* HI-UX has no setlinebuf */
204790792Sgshapiro#  endif /* ! HASSETVBUF */
204890792Sgshapiro#  ifndef GIDSET_T
204990792Sgshapiro#   define GIDSET_T	gid_t
205090792Sgshapiro#  endif /* ! GIDSET_T */
205190792Sgshapiro#  ifndef _PATH_UNIX
205290792Sgshapiro#   define _PATH_UNIX		"/HI-UX"
205390792Sgshapiro#  endif /* ! _PATH_UNIX */
205490792Sgshapiro#  ifndef _PATH_VENDOR_CF
205590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
205690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
205790792Sgshapiro#  ifndef IDENTPROTO
205890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
205990792Sgshapiro#  endif /* ! IDENTPROTO */
206090792Sgshapiro#  ifndef HASGETUSERSHELL
206190792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
206290792Sgshapiro#  endif /* ! HASGETUSERSHELL */
206390792Sgshapiro#  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
206490792Sgshapiro
206590792Sgshapiro/*
206690792Sgshapiro**  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
206790792Sgshapiro**  on HIUX 3050
206890792Sgshapiro*/
206990792Sgshapiro#  undef m_flags
207090792Sgshapiro
207190792Sgshapiro#  define SM_CONF_SYSLOG	0
207290792Sgshapiro
207390792Sgshapiro# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
207490792Sgshapiro
207590792Sgshapiro
207690792Sgshapiro/*
207790792Sgshapiro**  Amdahl UTS System V 2.1.5 (SVr3-based)
207890792Sgshapiro**
207990792Sgshapiro**    From: Janet Jackson <janet@dialix.oz.au>.
208090792Sgshapiro*/
208190792Sgshapiro
208290792Sgshapiro# ifdef _UTS
208390792Sgshapiro#  include <sys/sysmacros.h>
208490792Sgshapiro#  undef HASLSTAT		/* has symlinks, but they cause problems */
208590792Sgshapiro#  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
208690792Sgshapiro#  define SYS5SIGNALS	1	/* System V signal semantics */
208790792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
208890792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
208990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) function */
209090792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) function */
209190792Sgshapiro#  ifndef HASGETUSERSHELL
209290792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
209390792Sgshapiro#  endif /* ! HASGETUSERSHELL */
209490792Sgshapiro#  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
209590792Sgshapiro#  define LA_TYPE	LA_ZERO		/* doesn't have load average */
209690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
209790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
209890792Sgshapiro#  define _PATH_UNIX		"/unix"
209990792Sgshapiro#  ifndef _PATH_VENDOR_CF
210090792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
210190792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
210290792Sgshapiro# endif /* _UTS */
210390792Sgshapiro
210490792Sgshapiro/*
210590792Sgshapiro**  Cray Computer Corporation's CSOS
210690792Sgshapiro**
210790792Sgshapiro**	From Scott Bolte <scott@craycos.com>.
210890792Sgshapiro*/
210990792Sgshapiro
211090792Sgshapiro# ifdef _CRAYCOM
211190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
211290792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
211390792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
211490792Sgshapiro#  define MAXPATHLEN	PATHSIZE
211590792Sgshapiro#  define LA_TYPE	LA_ZERO
211690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
211790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
211890792Sgshapiro#  define _POSIX_CHOWN_RESTRICTED	-1
211990792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
212090792Sgshapiro# endif /* _CRAYCOM */
212190792Sgshapiro
212290792Sgshapiro
212390792Sgshapiro/*
212490792Sgshapiro**  Sony NEWS-OS 4.2.1R and 6.0.3
212590792Sgshapiro**
212690792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
212790792Sgshapiro*/
212890792Sgshapiro
212990792Sgshapiro# ifdef sony_news
213090792Sgshapiro#  ifndef __svr4
213190792Sgshapiro			/* NEWS-OS 4.2.1R */
213290792Sgshapiro#   ifndef BSD
213390792Sgshapiro#    define BSD			/* has BSD routines */
213490792Sgshapiro#   endif /* ! BSD */
213590792Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(2) call */
213690792Sgshapiro#   undef HASSETVBUF		/* don't actually have setvbuf(3) */
213790792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
213890792Sgshapiro#   define LA_TYPE	LA_INT
213990792Sgshapiro#   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
214090792Sgshapiro#   ifndef HASFLOCK
214190792Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
214290792Sgshapiro#   endif /* ! HASFLOCK */
214390792Sgshapiro#   define setpgid	setpgrp
214490792Sgshapiro#   undef WIFEXITED
214590792Sgshapiro#   undef WEXITSTATUS
214690792Sgshapiro#   define MODE_T	int	/* system include files have no mode_t */
214790792Sgshapirotypedef int		pid_t;
214890792Sgshapirotypedef int		(*sigfunc_t)();
214990792Sgshapiro#   define SIGFUNC_DEFINED
215090792Sgshapiro#   define SIGFUNC_RETURN	(0)
215190792Sgshapiro#   define SIGFUNC_DECL		int
215290792Sgshapiro
215390792Sgshapiro#  else /* ! __svr4 */
215490792Sgshapiro			/* NEWS-OS 6.0.3 with /bin/cc */
215590792Sgshapiro#   ifndef __svr4__
215690792Sgshapiro#    define __svr4__		/* use all System V Release 4 defines below */
215790792Sgshapiro#   endif /* ! __svr4__ */
2158132943Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
215990792Sgshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
216090792Sgshapiro#   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
216190792Sgshapiro#   ifndef SPT_TYPE
216290792Sgshapiro#    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
216390792Sgshapiro#   endif /* ! SPT_TYPE */
216490792Sgshapiro#   define GIDSET_T	gid_t
216590792Sgshapiro#   undef WIFEXITED
216690792Sgshapiro#   undef WEXITSTATUS
216790792Sgshapiro#   ifndef SYSLOG_BUFSIZE
216890792Sgshapiro#    define SYSLOG_BUFSIZE	256
216990792Sgshapiro#   endif /* ! SYSLOG_BUFSIZE */
217090792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
217190792Sgshapiro#   ifndef _PATH_VENDOR_CF
217290792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
217390792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
217490792Sgshapiro#   ifndef _PATH_SENDMAILPID
217590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
217690792Sgshapiro#   endif /* ! _PATH_SENDMAILPID */
217790792Sgshapiro
217890792Sgshapiro#  endif /* ! __svr4 */
217990792Sgshapiro# endif /* sony_news */
218090792Sgshapiro
218190792Sgshapiro
218290792Sgshapiro/*
218390792Sgshapiro**  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
218490792Sgshapiro**
218590792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
218690792Sgshapiro*/
218790792Sgshapiro
218890792Sgshapiro# ifdef luna
218990792Sgshapiro#  ifndef IDENTPROTO
219090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
219190792Sgshapiro#  endif /* ! IDENTPROTO */
219290792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(2) call */
219390792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
219490792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
219590792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
219690792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
219790792Sgshapiro#  ifdef uniosb
219890792Sgshapiro#   include <sys/time.h>
219990792Sgshapiro#   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
220090792Sgshapiro#   define LA_TYPE	LA_INT
220190792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
220290792Sgshapiro#  endif /* uniosb */
220390792Sgshapiro#  ifdef luna2
220490792Sgshapiro#   define LA_TYPE	LA_SUBR
220590792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
220690792Sgshapiro#  endif /* luna2 */
220790792Sgshapiro#  ifdef luna88k
220890792Sgshapiro#   define LA_TYPE	LA_INT
220990792Sgshapiro#  endif /* luna88k */
221090792Sgshapiro#  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
221190792Sgshapiro#  define setpgid	setpgrp
221290792Sgshapiro#  undef WIFEXITED
221390792Sgshapiro#  undef WEXITSTATUS
221490792Sgshapirotypedef int		pid_t;
221590792Sgshapirotypedef int		(*sigfunc_t)();
221690792Sgshapiro#  define SIGFUNC_DEFINED
221790792Sgshapiro#  define SIGFUNC_RETURN	(0)
221890792Sgshapiro#  define SIGFUNC_DECL	int
221990792Sgshapiroextern char	*getenv();
222090792Sgshapiro#  ifndef _PATH_VENDOR_CF
222190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
222290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
222390792Sgshapiro# endif /* luna */
222490792Sgshapiro
222590792Sgshapiro
222690792Sgshapiro/*
222790792Sgshapiro**  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
222890792Sgshapiro**
222990792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
223090792Sgshapiro*/
223190792Sgshapiro
223290792Sgshapiro# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
223390792Sgshapiro#  ifndef __svr4__
223490792Sgshapiro#   define __svr4__		/* use all System V Release 4 defines below */
223590792Sgshapiro#  endif /* ! __svr4__ */
223690792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2237132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
223890792Sgshapiro#  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
223990792Sgshapiro#  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
224090792Sgshapiro#  define GIDSET_T	gid_t
224190792Sgshapiro#  undef WIFEXITED
224290792Sgshapiro#  undef WEXITSTATUS
224390792Sgshapiro#  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
224490792Sgshapiro#  ifndef _PATH_VENDOR_CF
224590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
224690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
224790792Sgshapiro#  ifndef _PATH_SENDMAILPID
224890792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
224990792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
225090792Sgshapiro#  ifndef SYSLOG_BUFSIZE
225190792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
225290792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
225390792Sgshapiro# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
225490792Sgshapiro
225590792Sgshapiro
225690792Sgshapiro/*
225790792Sgshapiro**  Fujitsu/ICL UXP/DS (For the DS/90 Series)
225890792Sgshapiro**
225990792Sgshapiro**	From Diego R. Lopez <drlopez@cica.es>.
226090792Sgshapiro**	Additional changes from Fumio Moriya and Toshiaki Nomura of the
226190792Sgshapiro**		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
226290792Sgshapiro*/
226390792Sgshapiro
226490792Sgshapiro# ifdef __uxp__
226590792Sgshapiro#  include <arpa/nameser.h>
226690792Sgshapiro#  include <sys/sysmacros.h>
226790792Sgshapiro#  include <sys/mkdev.h>
226890792Sgshapiro#  define __svr4__
226990792Sgshapiro#  define HASGETUSERSHELL	0
227090792Sgshapiro#  define HASFLOCK		0
227190792Sgshapiro#  define _PATH_UNIX		"/stand/unix"
227290792Sgshapiro#  ifndef _PATH_VENDOR_CF
227390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
227490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
227590792Sgshapiro#  ifndef _PATH_SENDMAILPID
227690792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
227790792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
227890792Sgshapiro# endif /* __uxp__ */
227990792Sgshapiro
228090792Sgshapiro/*
228190792Sgshapiro**  Pyramid DC/OSx
228290792Sgshapiro**
228390792Sgshapiro**	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
228490792Sgshapiro*/
228590792Sgshapiro
228690792Sgshapiro# ifdef DCOSx
228790792Sgshapiro#  define GIDSET_T	gid_t
228890792Sgshapiro#  ifndef IDENTPROTO
228990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
229090792Sgshapiro#  endif /* ! IDENTPROTO */
229190792Sgshapiro# endif /* DCOSx */
229290792Sgshapiro
229390792Sgshapiro/*
229490792Sgshapiro**  Concurrent Computer Corporation Maxion
229590792Sgshapiro**
229690792Sgshapiro**	From Donald R. Laster Jr. <laster@access.digex.net>.
229790792Sgshapiro*/
229890792Sgshapiro
229990792Sgshapiro# ifdef __MAXION__
230090792Sgshapiro
230190792Sgshapiro#  include <sys/stream.h>
230290792Sgshapiro#  define __svr4__		1	/* SVR4.2MP */
230390792Sgshapiro#  define HASSETREUID		1	/* have setreuid(2) */
230490792Sgshapiro#  define HASLSTAT		1	/* have lstat(2) */
230590792Sgshapiro#  define HASSETRLIMIT		1	/* have setrlimit(2) */
230690792Sgshapiro#  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
230790792Sgshapiro#  define HASGETUSERSHELL	1	/* have getusershell(3) */
230890792Sgshapiro#  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
230990792Sgshapiro#  define SLEEP_T		unsigned
231090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
231190792Sgshapiro#  define SFS_BAVAIL		f_bavail
231290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
231390792Sgshapiro#   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
231490792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
231590792Sgshapiro
231690792Sgshapiro#  undef WUNTRACED
231790792Sgshapiro#  undef WIFEXITED
231890792Sgshapiro#  undef WIFSIGNALED
231990792Sgshapiro#  undef WIFSTOPPED
232090792Sgshapiro#  undef WEXITSTATUS
232190792Sgshapiro#  undef WTERMSIG
232290792Sgshapiro#  undef WSTOPSIG
232390792Sgshapiro
232490792Sgshapiro# endif /* __MAXION__ */
232590792Sgshapiro
232690792Sgshapiro/*
232790792Sgshapiro**  Harris Nighthawk PowerUX (nh6000 box)
232890792Sgshapiro**
232990792Sgshapiro**  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
233090792Sgshapiro*/
233190792Sgshapiro
233290792Sgshapiro# ifdef _PowerUX
233390792Sgshapiro#  ifndef __svr4__
233490792Sgshapiro#   define __svr4__
233590792Sgshapiro#  endif /* ! __svr4__ */
233690792Sgshapiro#  ifndef _PATH_VENDOR_CF
233790792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
233890792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
233990792Sgshapiro#  ifndef _PATH_SENDMAILPID
234090792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
234190792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
234290792Sgshapiro#  define SYSLOG_BUFSIZE		1024
234390792Sgshapiro#  define LA_TYPE		LA_ZERO
234490792Sgshapirotypedef struct msgb		mblk_t;
234590792Sgshapiro#  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
234690792Sgshapiro# endif /* _PowerUX */
234790792Sgshapiro
234890792Sgshapiro/*
234990792Sgshapiro**  Siemens Nixdorf Informationssysteme AG SINIX
235090792Sgshapiro**
235190792Sgshapiro**	Contributed by Gerald Rinske of Siemens Business Services VAS.
235290792Sgshapiro*/
235390792Sgshapiro# ifdef sinix
235490792Sgshapiro#  define HASRANDOM		0	/* has random(3) */
235590792Sgshapiro#  define SYSLOG_BUFSIZE	1024
235690792Sgshapiro#  define SM_INT32		int	/* 32bit integer */
235790792Sgshapiro# endif /* sinix */
235890792Sgshapiro
235990792Sgshapiro
236090792Sgshapiro/*
236190792Sgshapiro**  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
236290792Sgshapiro**
236390792Sgshapiro**	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
236490792Sgshapiro*/
236590792Sgshapiro
236690792Sgshapiro# ifdef MOTO
236790792Sgshapiro#  define HASFCHMOD		1
236890792Sgshapiro#  define HASSETRLIMIT		0
2369132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
237090792Sgshapiro#  define HASSETREUID		1
237190792Sgshapiro#  define HASULIMIT		1
237290792Sgshapiro#  define HASWAITPID		1
237390792Sgshapiro#  define HASGETDTABLESIZE	1
237490792Sgshapiro#  define HASGETUSERSHELL	1
237590792Sgshapiro#  define IP_SRCROUTE		0
237690792Sgshapiro#  define IDENTPROTO		0
237790792Sgshapiro#  define RES_DNSRCH_VARIABLE	_res_dnsrch
237890792Sgshapiro#  define _PATH_UNIX		"/unix"
237990792Sgshapiro#  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
238090792Sgshapiro#  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
238190792Sgshapiro# endif /* MOTO */
238290792Sgshapiro
2383110560Sgshapiro/*
2384110560Sgshapiro**  Interix
2385110560Sgshapiro**	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2386110560Sgshapiro**
2387110560Sgshapiro**	Used for Interix support.
2388110560Sgshapiro*/
238990792Sgshapiro
2390110560Sgshapiro# if defined(__INTERIX)
2391110560Sgshapiro#  define HASURANDOMDEV		1
2392110560Sgshapiro#  define HASGETUSERSHELL	0
2393110560Sgshapiro#  define HASSTRERROR		1
2394110560Sgshapiro#  define HASUNSETENV		1
2395110560Sgshapiro#  define HASFCHOWN		1
2396110560Sgshapiro#  undef HAVE_SYS_ERRLIST
2397110560Sgshapiro#  define sys_errlist		__sys_errlist
2398110560Sgshapiro#  define sys_nerr		__sys_nerr
2399132943Sgshapiro#  include <sys/mkdev.h>
2400132943Sgshapiro#  ifndef major
2401132943Sgshapiro#   define major(dev)		((int)(((dev) >> 8) & 0xff))
2402132943Sgshapiro#  endif /* ! major */
2403132943Sgshapiro#  ifndef minor
2404132943Sgshapiro#   define minor(dev)		((int)((dev) & 0xff))
2405132943Sgshapiro#  endif /* ! minor */
2406110560Sgshapiro# endif /* defined(__INTERIX) */
2407110560Sgshapiro
2408110560Sgshapiro
240990792Sgshapiro/**********************************************************************
241090792Sgshapiro**  End of Per-Operating System defines
241190792Sgshapiro**********************************************************************/
241290792Sgshapiro/**********************************************************************
241390792Sgshapiro**  More general defines
241490792Sgshapiro**********************************************************************/
241590792Sgshapiro
241690792Sgshapiro/* general BSD defines */
241790792Sgshapiro# ifdef BSD
241890792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
241990792Sgshapiro#  ifndef HASSETREUID
242090792Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
242190792Sgshapiro#  endif /* ! HASSETREUID */
242290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
242390792Sgshapiro#  ifndef IP_SRCROUTE
242490792Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
242590792Sgshapiro#  endif /* ! IP_SRCROUTE */
242690792Sgshapiro#  ifndef HASSETRLIMIT
242790792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
242890792Sgshapiro#  endif /* ! HASSETRLIMIT */
242990792Sgshapiro#  ifndef HASFLOCK
243090792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
243190792Sgshapiro#  endif /* ! HASFLOCK */
243290792Sgshapiro#  ifndef TZ_TYPE
243390792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
243490792Sgshapiro#  endif /* ! TZ_TYPE */
243590792Sgshapiro# endif /* BSD */
243690792Sgshapiro
243790792Sgshapiro/* general System V Release 4 defines */
243890792Sgshapiro# ifdef __svr4__
243990792Sgshapiro#  define SYSTEM5	1
244090792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
244190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
244290792Sgshapiro#  define BSD_COMP	1	/* get BSD ioctl calls */
244390792Sgshapiro#  ifndef HASSETRLIMIT
244490792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
244590792Sgshapiro#  endif /* ! HASSETRLIMIT */
244690792Sgshapiro#  ifndef HASGETUSERSHELL
244790792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
244890792Sgshapiro#  endif /* ! HASGETUSERSHELL */
244990792Sgshapiro#  ifndef HASFCHMOD
245090792Sgshapiro#   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
245190792Sgshapiro#  endif /* ! HASFCHMOD */
245290792Sgshapiro
245390792Sgshapiro#  ifndef _PATH_UNIX
245490792Sgshapiro#   define _PATH_UNIX		"/unix"
245590792Sgshapiro#  endif /* ! _PATH_UNIX */
245690792Sgshapiro#  ifndef _PATH_VENDOR_CF
245790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
245890792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
245990792Sgshapiro#  ifndef _PATH_SENDMAILPID
246090792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
246190792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
246290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
246390792Sgshapiro#   define SYSLOG_BUFSIZE	128
246490792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
246590792Sgshapiro#  ifndef SFS_TYPE
246690792Sgshapiro#   define SFS_TYPE		SFS_STATVFS
246790792Sgshapiro#  endif /* ! SFS_TYPE */
246890792Sgshapiro
246990792Sgshapiro#  ifndef USE_SIGLONGJMP
247090792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
247190792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
247290792Sgshapiro# endif /* __svr4__ */
247390792Sgshapiro
247490792Sgshapiro# ifdef __SVR4
247590792Sgshapiro#  define LDA_USE_LOCKF		1
247690792Sgshapiro#  define LDA_USE_SETEUID	1
247790792Sgshapiro#  define _PATH_MAILDIR		"/var/mail"
247890792Sgshapiro# endif /* __SVR4 */
247990792Sgshapiro
248090792Sgshapiro/* general System V defines */
248190792Sgshapiro# ifdef SYSTEM5
248290792Sgshapiro#  include <sys/sysmacros.h>
248390792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
248490792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
248590792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
248690792Sgshapiro#  ifndef HASULIMIT
248790792Sgshapiro#   define HASULIMIT	1	/* has the ulimit(2) syscall */
248890792Sgshapiro#  endif /* ! HASULIMIT */
248990792Sgshapiro#  ifndef LA_TYPE
249090792Sgshapiro#   ifdef MIOC_READKSYM
249190792Sgshapiro#    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
249290792Sgshapiro#   else /* MIOC_READKSYM */
249390792Sgshapiro#    define LA_TYPE	LA_INT		/* assume integer load average */
249490792Sgshapiro#   endif /* MIOC_READKSYM */
249590792Sgshapiro#  endif /* ! LA_TYPE */
249690792Sgshapiro#  ifndef SFS_TYPE
249790792Sgshapiro#   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
249890792Sgshapiro#  endif /* ! SFS_TYPE */
249990792Sgshapiro#  ifndef TZ_TYPE
250090792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
250190792Sgshapiro#  endif /* ! TZ_TYPE */
250290792Sgshapiro# endif /* SYSTEM5 */
250390792Sgshapiro
250490792Sgshapiro/* general POSIX defines */
250590792Sgshapiro# ifdef _POSIX_VERSION
2506132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
2507132943Sgshapiro#  define HASWAITPID	1	/* has POSIX waitpid(2) call */
250890792Sgshapiro#  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
250990792Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
251090792Sgshapiro#  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
251190792Sgshapiro# endif /* _POSIX_VERSION */
251290792Sgshapiro/*
251390792Sgshapiro**  Tweaking for systems that (for example) claim to be BSD or POSIX
251490792Sgshapiro**  but don't have all the standard BSD or POSIX routines (boo hiss).
251590792Sgshapiro*/
251690792Sgshapiro
251790792Sgshapiro# ifdef titan
251890792Sgshapiro#  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
251990792Sgshapiro# endif /* titan */
252090792Sgshapiro
252190792Sgshapiro# ifdef _CRAYCOM
252290792Sgshapiro#  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
252390792Sgshapiro# endif /* _CRAYCOM */
252490792Sgshapiro
252590792Sgshapiro# ifdef MOTO
252690792Sgshapiro#  undef USESETEUID
252790792Sgshapiro# endif /* MOTO */
252890792Sgshapiro
252990792Sgshapiro/*
253090792Sgshapiro**  Due to a "feature" in some operating systems such as Ultrix 4.3 and
253190792Sgshapiro**  HPUX 8.0, if you receive a "No route to host" message (ICMP message
253290792Sgshapiro**  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
253390792Sgshapiro**  are closed.  Some firewalls return this error if you try to connect
253490792Sgshapiro**  to the IDENT port (113), so you can't receive email from these hosts
253590792Sgshapiro**  on these systems.  The firewall really should use a more specific
253690792Sgshapiro**  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
253790792Sgshapiro**  not explicitly set to zero above, default it on.
253890792Sgshapiro*/
253990792Sgshapiro
254090792Sgshapiro# ifndef IDENTPROTO
254190792Sgshapiro#  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
254290792Sgshapiro# endif /* ! IDENTPROTO */
254390792Sgshapiro
254490792Sgshapiro# ifndef IP_SRCROUTE
254590792Sgshapiro#  define IP_SRCROUTE	1	/* Detect IP source routing */
254690792Sgshapiro# endif /* ! IP_SRCROUTE */
254790792Sgshapiro
254890792Sgshapiro# ifndef HASGETUSERSHELL
254990792Sgshapiro#  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
255090792Sgshapiro# endif /* ! HASGETUSERSHELL */
255190792Sgshapiro
255290792Sgshapiro# ifndef NETUNIX
255390792Sgshapiro#  define NETUNIX	1	/* include unix domain support */
255490792Sgshapiro# endif /* ! NETUNIX */
255590792Sgshapiro
255690792Sgshapiro# ifndef HASRANDOM
255790792Sgshapiro#  define HASRANDOM	1	/* has random(3) support */
255890792Sgshapiro# endif /* ! HASRANDOM */
255990792Sgshapiro
256090792Sgshapiro# ifndef HASFLOCK
256190792Sgshapiro#  define HASFLOCK	0	/* assume no flock(2) support */
256290792Sgshapiro# endif /* ! HASFLOCK */
256390792Sgshapiro
256490792Sgshapiro# ifndef HASSETREUID
256590792Sgshapiro#  define HASSETREUID	0	/* assume no setreuid(2) call */
256690792Sgshapiro# endif /* ! HASSETREUID */
256790792Sgshapiro
256890792Sgshapiro# ifndef HASFCHMOD
256990792Sgshapiro#  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
257090792Sgshapiro# endif /* ! HASFCHMOD */
257190792Sgshapiro
257290792Sgshapiro# ifndef USESETEUID
257390792Sgshapiro#  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
257490792Sgshapiro# endif /* ! USESETEUID */
257590792Sgshapiro
257690792Sgshapiro# ifndef HASSETRLIMIT
257790792Sgshapiro#  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
257890792Sgshapiro# endif /* ! HASSETRLIMIT */
257990792Sgshapiro
258090792Sgshapiro# ifndef HASULIMIT
258190792Sgshapiro#  define HASULIMIT	0	/* assume no ulimit(2) support */
258290792Sgshapiro# endif /* ! HASULIMIT */
258390792Sgshapiro
258490792Sgshapiro# ifndef SECUREWARE
258590792Sgshapiro#  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
258690792Sgshapiro# endif /* ! SECUREWARE */
258790792Sgshapiro
258890792Sgshapiro# ifndef USE_DOUBLE_FORK
258990792Sgshapiro#  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
259090792Sgshapiro# endif /* ! USE_DOUBLE_FORK */
259190792Sgshapiro
259290792Sgshapiro# ifndef USE_ENVIRON
259390792Sgshapiro#  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
259490792Sgshapiro# endif /* ! USE_ENVIRON */
259590792Sgshapiro
259690792Sgshapiro# ifndef USE_SIGLONGJMP
259790792Sgshapiro#  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
259890792Sgshapiro# endif /* ! USE_SIGLONGJMP */
259990792Sgshapiro
260090792Sgshapiro# ifndef FDSET_CAST
260190792Sgshapiro#  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
260290792Sgshapiro# endif /* ! FDSET_CAST */
260390792Sgshapiro
260490792Sgshapiro/*
260590792Sgshapiro**  Pick a mailer setuid method for changing the current uid
260690792Sgshapiro*/
260790792Sgshapiro
260890792Sgshapiro# define USE_SETEUID	0
260990792Sgshapiro# define USE_SETREUID	1
261090792Sgshapiro# define USE_SETUID	2
261190792Sgshapiro
261290792Sgshapiro# if USESETEUID
261390792Sgshapiro#  define MAILER_SETUID_METHOD	USE_SETEUID
261490792Sgshapiro# else /* USESETEUID */
261590792Sgshapiro#  if HASSETREUID
261690792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETREUID
261790792Sgshapiro#  else /* HASSETREUID */
261890792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETUID
261990792Sgshapiro#  endif /* HASSETREUID */
262090792Sgshapiro# endif /* USESETEUID */
262190792Sgshapiro
262290792Sgshapiro/*
262390792Sgshapiro**  If no type for argument two of getgroups call is defined, assume
262490792Sgshapiro**  it's an integer -- unfortunately, there seem to be several choices
262590792Sgshapiro**  here.
262690792Sgshapiro*/
262790792Sgshapiro
262890792Sgshapiro# ifndef GIDSET_T
262990792Sgshapiro#  define GIDSET_T	int
263090792Sgshapiro# endif /* ! GIDSET_T */
263190792Sgshapiro
263290792Sgshapiro# ifndef UID_T
263390792Sgshapiro#  define UID_T		uid_t
263490792Sgshapiro# endif /* ! UID_T */
263590792Sgshapiro
263690792Sgshapiro# ifndef GID_T
263790792Sgshapiro#  define GID_T		gid_t
263890792Sgshapiro# endif /* ! GID_T */
263990792Sgshapiro
264090792Sgshapiro# ifndef MODE_T
264190792Sgshapiro#  define MODE_T		mode_t
264290792Sgshapiro# endif /* ! MODE_T */
264390792Sgshapiro
264490792Sgshapiro# ifndef ARGV_T
264590792Sgshapiro#  define ARGV_T		char **
264690792Sgshapiro# endif /* ! ARGV_T */
264790792Sgshapiro
264890792Sgshapiro# ifndef SOCKADDR_LEN_T
264990792Sgshapiro#  define SOCKADDR_LEN_T	int
265090792Sgshapiro# endif /* ! SOCKADDR_LEN_T */
265190792Sgshapiro
265290792Sgshapiro# ifndef SOCKOPT_LEN_T
265390792Sgshapiro#  define SOCKOPT_LEN_T	int
265490792Sgshapiro# endif /* ! SOCKOPT_LEN_T */
265590792Sgshapiro
265690792Sgshapiro# ifndef QUAD_T
265790792Sgshapiro#  define QUAD_T	unsigned long
265890792Sgshapiro# endif /* ! QUAD_T */
265990792Sgshapiro/**********************************************************************
266090792Sgshapiro**  Remaining definitions should never have to be changed.  They are
266190792Sgshapiro**  primarily to provide back compatibility for older systems -- for
266290792Sgshapiro**  example, it includes some POSIX compatibility definitions
266390792Sgshapiro**********************************************************************/
266490792Sgshapiro
266590792Sgshapiro/* System 5 compatibility */
266690792Sgshapiro# ifndef S_ISREG
266790792Sgshapiro#  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
266890792Sgshapiro# endif /* ! S_ISREG */
266990792Sgshapiro# ifndef S_ISDIR
267090792Sgshapiro#  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
267190792Sgshapiro# endif /* ! S_ISDIR */
267290792Sgshapiro# if !defined(S_ISLNK) && defined(S_IFLNK)
267390792Sgshapiro#  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
267490792Sgshapiro# endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
267590792Sgshapiro# if !defined(S_ISFIFO)
267690792Sgshapiro#  if defined(S_IFIFO)
267790792Sgshapiro#   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
267890792Sgshapiro#  else /* defined(S_IFIFO) */
267990792Sgshapiro#   define S_ISFIFO(foo)	false
268090792Sgshapiro#  endif /* defined(S_IFIFO) */
268190792Sgshapiro# endif /* !defined(S_ISFIFO) */
268290792Sgshapiro# ifndef S_IRUSR
268390792Sgshapiro#  define S_IRUSR		0400
268490792Sgshapiro# endif /* ! S_IRUSR */
268590792Sgshapiro# ifndef S_IWUSR
268690792Sgshapiro#  define S_IWUSR		0200
268790792Sgshapiro# endif /* ! S_IWUSR */
268890792Sgshapiro# ifndef S_IRGRP
268990792Sgshapiro#  define S_IRGRP		0040
269090792Sgshapiro# endif /* ! S_IRGRP */
269190792Sgshapiro# ifndef S_IWGRP
269290792Sgshapiro#  define S_IWGRP		0020
269390792Sgshapiro# endif /* ! S_IWGRP */
269490792Sgshapiro# ifndef S_IROTH
269590792Sgshapiro#  define S_IROTH		0004
269690792Sgshapiro# endif /* ! S_IROTH */
269790792Sgshapiro# ifndef S_IWOTH
269890792Sgshapiro#  define S_IWOTH		0002
269990792Sgshapiro# endif /* ! S_IWOTH */
270090792Sgshapiro
270190792Sgshapiro/* close-on-exec flag */
270290792Sgshapiro# ifndef FD_CLOEXEC
270390792Sgshapiro#  define FD_CLOEXEC	1
270490792Sgshapiro# endif /* ! FD_CLOEXEC */
270590792Sgshapiro
270690792Sgshapiro/*
270790792Sgshapiro**  Older systems don't have this error code -- it should be in
270890792Sgshapiro**  /usr/include/sysexits.h.
270990792Sgshapiro*/
271090792Sgshapiro
271190792Sgshapiro# ifndef EX_CONFIG
271290792Sgshapiro#  define EX_CONFIG	78	/* configuration error */
271390792Sgshapiro# endif /* ! EX_CONFIG */
271490792Sgshapiro
271590792Sgshapiro/* pseudo-codes */
2716120256Sgshapiro# define EX_QUIT	22	/* drop out of server immediately */
271790792Sgshapiro# define EX_RESTART	23	/* restart sendmail daemon */
271890792Sgshapiro# define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
271990792Sgshapiro
272090792Sgshapiro#ifndef EX_NOTFOUND
272190792Sgshapiro# define EX_NOTFOUND	EX_NOHOST
272290792Sgshapiro#endif /* ! EX_NOTFOUND */
272390792Sgshapiro
272490792Sgshapiro/* pseudo-code used for mci_setstat */
2725132943Sgshapiro# define EX_NOTSTICKY	(-5)	/* don't save persistent status */
272690792Sgshapiro
272790792Sgshapiro
272890792Sgshapiro/*
272990792Sgshapiro**  An "impossible" file mode to indicate that the file does not exist.
273090792Sgshapiro*/
273190792Sgshapiro
273290792Sgshapiro# define ST_MODE_NOFILE	0171147		/* unlikely to occur */
273390792Sgshapiro
273490792Sgshapiro
273590792Sgshapiro/* type of arbitrary pointer */
273690792Sgshapiro# ifndef ARBPTR_T
273790792Sgshapiro#  define ARBPTR_T	void *
273890792Sgshapiro# endif /* ! ARBPTR_T */
273990792Sgshapiro
274090792Sgshapiro# ifndef __P
274190792Sgshapiro#  include "sm/cdefs.h"
274290792Sgshapiro# endif /* ! __P */
274390792Sgshapiro
274490792Sgshapiro# if HESIOD && !defined(NAMED_BIND)
274590792Sgshapiro#  define NAMED_BIND	1	/* not one without the other */
274690792Sgshapiro# endif /* HESIOD && !defined(NAMED_BIND) */
274790792Sgshapiro
274890792Sgshapiro#  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
274990792Sgshapiroextern int	h_errno;
275090792Sgshapiro#  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
275190792Sgshapiro
275290792Sgshapiro# if NEEDPUTENV
275390792Sgshapiroextern int	putenv __P((char *));
275490792Sgshapiro# endif /* NEEDPUTENV */
275590792Sgshapiro
275690792Sgshapiro#if !HASUNSETENV
275790792Sgshapiroextern void	unsetenv __P((char *));
275890792Sgshapiro#endif /* !HASUNSETENV */
275990792Sgshapiro
276090792Sgshapiro# ifdef LDAPMAP
276190792Sgshapiro#  include <sys/time.h>
276290792Sgshapiro#  include <lber.h>
276390792Sgshapiro#  include <ldap.h>
276490792Sgshapiro
276590792Sgshapiro/* Some LDAP constants */
276690792Sgshapiro#  define LDAPMAP_FALSE		0
276790792Sgshapiro#  define LDAPMAP_TRUE		1
276890792Sgshapiro
276990792Sgshapiro/*
277090792Sgshapiro**  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
277190792Sgshapiro**  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
277290792Sgshapiro**  and assume (falsely) that all old API implementations are broken.
277390792Sgshapiro**  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
277490792Sgshapiro*/
277590792Sgshapiro
277690792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
277790792Sgshapiro#   define USE_LDAP_INIT	1
277890792Sgshapiro#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
277990792Sgshapiro
278090792Sgshapiro/*
278190792Sgshapiro**  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
278290792Sgshapiro**  hence ldap_set_option() must not exist.
278390792Sgshapiro*/
278490792Sgshapiro
278590792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
278690792Sgshapiro#   define USE_LDAP_SET_OPTION	1
278790792Sgshapiro#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
278890792Sgshapiro
278990792Sgshapiro# endif /* LDAPMAP */
279090792Sgshapiro
279190792Sgshapiro# if HASUNAME
279290792Sgshapiro#  include <sys/utsname.h>
279390792Sgshapiro#  ifdef newstr
279490792Sgshapiro#   undef newstr
279590792Sgshapiro#  endif /* newstr */
279690792Sgshapiro# else /* HASUNAME */
279790792Sgshapiro#  define NODE_LENGTH 32
279890792Sgshapirostruct utsname
279990792Sgshapiro{
280090792Sgshapiro	char nodename[NODE_LENGTH + 1];
280190792Sgshapiro};
280290792Sgshapiro# endif /* HASUNAME */
280390792Sgshapiro
280490792Sgshapiro# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
280590792Sgshapiro#  define MAXHOSTNAMELEN	256
280690792Sgshapiro# endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
280790792Sgshapiro
2808203004Sgshapiro
2809203004Sgshapiro# if _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255
2810203004Sgshapiro   /*
2811203004Sgshapiro   **  override Linux wierdness: a FQHN can be 255 chars long
2812203004Sgshapiro   **  SUSv3 requires HOST_NAME_MAX ("Maximum length of a host
2813203004Sgshapiro   **  name (not including the terminating null) as returned from the
2814203004Sgshapiro   **  gethostname() function.") to be at least 255.  c.f.:
2815203004Sgshapiro   **  http://www.opengroup.org/onlinepubs/009695399
2816203004Sgshapiro   **  but Linux defines that to 64 too.
2817203004Sgshapiro   */
2818203004Sgshapiro#  undef MAXHOSTNAMELEN
2819203004Sgshapiro#  define MAXHOSTNAMELEN	256
2820203004Sgshapiro# endif /* _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 */
2821203004Sgshapiro
282290792Sgshapiro# if !defined(SIGCHLD) && defined(SIGCLD)
282390792Sgshapiro#  define SIGCHLD	SIGCLD
282490792Sgshapiro# endif /* !defined(SIGCHLD) && defined(SIGCLD) */
282590792Sgshapiro
282690792Sgshapiro# ifndef STDIN_FILENO
282790792Sgshapiro#  define STDIN_FILENO	0
282890792Sgshapiro# endif /* ! STDIN_FILENO */
282990792Sgshapiro
283090792Sgshapiro# ifndef STDOUT_FILENO
283190792Sgshapiro#  define STDOUT_FILENO	1
283290792Sgshapiro# endif /* ! STDOUT_FILENO */
283390792Sgshapiro
283490792Sgshapiro# ifndef STDERR_FILENO
283590792Sgshapiro#  define STDERR_FILENO	2
283690792Sgshapiro# endif /* ! STDERR_FILENO */
283790792Sgshapiro
283890792Sgshapiro# ifndef LOCK_SH
283990792Sgshapiro#  define LOCK_SH	0x01	/* shared lock */
284090792Sgshapiro#  define LOCK_EX	0x02	/* exclusive lock */
284190792Sgshapiro#  define LOCK_NB	0x04	/* non-blocking lock */
284290792Sgshapiro#  define LOCK_UN	0x08	/* unlock */
284390792Sgshapiro# endif /* ! LOCK_SH */
284490792Sgshapiro
284590792Sgshapiro# ifndef S_IXOTH
284690792Sgshapiro#  define S_IXOTH	(S_IEXEC >> 6)
284790792Sgshapiro# endif /* ! S_IXOTH */
284890792Sgshapiro
284990792Sgshapiro# ifndef S_IXGRP
285090792Sgshapiro#  define S_IXGRP	(S_IEXEC >> 3)
285190792Sgshapiro# endif /* ! S_IXGRP */
285290792Sgshapiro
285390792Sgshapiro# ifndef S_IXUSR
285490792Sgshapiro#  define S_IXUSR	(S_IEXEC)
285590792Sgshapiro# endif /* ! S_IXUSR */
285690792Sgshapiro
285790792Sgshapiro#ifndef O_ACCMODE
285890792Sgshapiro# define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
285990792Sgshapiro#endif /* ! O_ACCMODE */
286090792Sgshapiro
286190792Sgshapiro# ifndef SEEK_SET
286290792Sgshapiro#  define SEEK_SET	0
286390792Sgshapiro#  define SEEK_CUR	1
286490792Sgshapiro#  define SEEK_END	2
286590792Sgshapiro# endif /* ! SEEK_SET */
286690792Sgshapiro
286790792Sgshapiro# ifndef SIG_ERR
286890792Sgshapiro#  define SIG_ERR	((void (*)()) -1)
286990792Sgshapiro# endif /* ! SIG_ERR */
287090792Sgshapiro
287190792Sgshapiro# ifndef WEXITSTATUS
287290792Sgshapiro#  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
287390792Sgshapiro# endif /* ! WEXITSTATUS */
287490792Sgshapiro# ifndef WIFEXITED
287590792Sgshapiro#  define WIFEXITED(st)		(((st) & 0377) == 0)
287690792Sgshapiro# endif /* ! WIFEXITED */
287790792Sgshapiro# ifndef WIFSTOPPED
287890792Sgshapiro#  define WIFSTOPPED(st)		(((st) & 0100) == 0)
287990792Sgshapiro# endif /* ! WIFSTOPPED */
288090792Sgshapiro# ifndef WCOREDUMP
288190792Sgshapiro#  define WCOREDUMP(st)		(((st) & 0200) != 0)
288290792Sgshapiro# endif /* ! WCOREDUMP */
288390792Sgshapiro# ifndef WTERMSIG
288490792Sgshapiro#  define WTERMSIG(st)		(((st) & 0177))
288590792Sgshapiro# endif /* ! WTERMSIG */
288690792Sgshapiro
288790792Sgshapiro# ifndef SIGFUNC_DEFINED
288890792Sgshapirotypedef void		(*sigfunc_t) __P((int));
288990792Sgshapiro# endif /* ! SIGFUNC_DEFINED */
289090792Sgshapiro# ifndef SIGFUNC_RETURN
289190792Sgshapiro#  define SIGFUNC_RETURN
289290792Sgshapiro# endif /* ! SIGFUNC_RETURN */
289390792Sgshapiro# ifndef SIGFUNC_DECL
289490792Sgshapiro#  define SIGFUNC_DECL	void
289590792Sgshapiro# endif /* ! SIGFUNC_DECL */
289690792Sgshapiro
289790792Sgshapiro/* size of syslog buffer */
289890792Sgshapiro# ifndef SYSLOG_BUFSIZE
289990792Sgshapiro#  define SYSLOG_BUFSIZE	1024
290090792Sgshapiro# endif /* ! SYSLOG_BUFSIZE */
290190792Sgshapiro
2902110560Sgshapiro/* for FD_SET() */
2903110560Sgshapiro#ifndef FD_SETSIZE
2904110560Sgshapiro# define FD_SETSIZE	256
2905110560Sgshapiro#endif /* ! FD_SETSIZE */
2906110560Sgshapiro
290790792Sgshapiro/*
290890792Sgshapiro**  Size of prescan buffer.
290990792Sgshapiro**	Despite comments in the _sendmail_ book, this probably should
291090792Sgshapiro**	not be changed; there are some hard-to-define dependencies.
291190792Sgshapiro*/
291290792Sgshapiro
291390792Sgshapiro# define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
291490792Sgshapiro
291590792Sgshapiro/* fork routine -- set above using #ifdef _osname_ or in Makefile */
291690792Sgshapiro# ifndef FORK
291790792Sgshapiro#  define FORK		fork		/* function to call to fork mailer */
291890792Sgshapiro# endif /* ! FORK */
291990792Sgshapiro
292090792Sgshapiro/* setting h_errno */
292190792Sgshapiro# ifndef SM_SET_H_ERRNO
292290792Sgshapiro#  define SM_SET_H_ERRNO(err)	h_errno = (err)
292390792Sgshapiro# endif /* SM_SET_H_ERRNO */
292490792Sgshapiro
292590792Sgshapiro# ifndef SM_CONF_GETOPT
292690792Sgshapiro#  define SM_CONF_GETOPT	1
292790792Sgshapiro# endif /* ! SM_CONF_GETOPT */
292890792Sgshapiro
292990792Sgshapiro/* random routine -- set above using #ifdef _osname_ or in Makefile */
293090792Sgshapiro# if HASRANDOM
293190792Sgshapiro#  define get_random()	random()
293290792Sgshapiro# else /* HASRANDOM */
293390792Sgshapiro#  define get_random()	((long) rand())
293490792Sgshapiro#  ifndef RANDOMSHIFT
293590792Sgshapiro#   define RANDOMSHIFT	8
293690792Sgshapiro#  endif /* ! RANDOMSHIFT */
293790792Sgshapiro# endif /* HASRANDOM */
293890792Sgshapiro
293990792Sgshapiro/*
294090792Sgshapiro**  Default to using scanf in readcf.
294190792Sgshapiro*/
294290792Sgshapiro
294390792Sgshapiro# ifndef SCANF
294490792Sgshapiro#  define SCANF		1
294590792Sgshapiro# endif /* ! SCANF */
294690792Sgshapiro
294790792Sgshapiro/* XXX  32 bit type */
294890792Sgshapiro# ifndef SM_INT32
294990792Sgshapiro#  define SM_INT32	int32_t
295090792Sgshapiro# endif /* ! SM_INT32 */
295190792Sgshapiro
295290792Sgshapiro/*
295390792Sgshapiro**  SVr4 and similar systems use different routines for setjmp/longjmp
295490792Sgshapiro**  with signal support
295590792Sgshapiro*/
295690792Sgshapiro
295790792Sgshapiro# if USE_SIGLONGJMP
295890792Sgshapiro#  ifdef jmp_buf
295990792Sgshapiro#   undef jmp_buf
296090792Sgshapiro#  endif /* jmp_buf */
296190792Sgshapiro#  define jmp_buf		sigjmp_buf
296290792Sgshapiro#  ifdef setjmp
296390792Sgshapiro#   undef setjmp
296490792Sgshapiro#  endif /* setjmp */
296590792Sgshapiro#  define setjmp(env)		sigsetjmp(env, 1)
296690792Sgshapiro#  ifdef longjmp
296790792Sgshapiro#   undef longjmp
296890792Sgshapiro#  endif /* longjmp */
296990792Sgshapiro#  define longjmp(env, val)	siglongjmp(env, val)
297090792Sgshapiro# endif /* USE_SIGLONGJMP */
297190792Sgshapiro
297290792Sgshapiro# if !defined(NGROUPS_MAX) && defined(NGROUPS)
297390792Sgshapiro#  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
297490792Sgshapiro# endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
297590792Sgshapiro
297690792Sgshapiro/*
297790792Sgshapiro**  Some snprintf() implementations are rumored not to NUL terminate.
297890792Sgshapiro*/
297990792Sgshapiro# if SNPRINTF_IS_BROKEN
298090792Sgshapiro#  ifdef snprintf
298190792Sgshapiro#   undef snprintf
298290792Sgshapiro#  endif /* snprintf */
298390792Sgshapiro#  define snprintf	sm_snprintf
298490792Sgshapiro#  ifdef vsnprintf
298590792Sgshapiro#   undef vsnprintf
298690792Sgshapiro#  endif /* vsnprintf */
298790792Sgshapiro#  define vsnprintf	sm_vsnprintf
298890792Sgshapiro# endif /* SNPRINTF_IS_BROKEN */
298990792Sgshapiro
299090792Sgshapiro/*
299190792Sgshapiro**  If we don't have a system syslog, simulate it.
299290792Sgshapiro*/
299390792Sgshapiro
299490792Sgshapiro# if !LOG
299590792Sgshapiro#  define LOG_EMERG	0	/* system is unusable */
299690792Sgshapiro#  define LOG_ALERT	1	/* action must be taken immediately */
299790792Sgshapiro#  define LOG_CRIT	2	/* critical conditions */
299890792Sgshapiro#  define LOG_ERR	3	/* error conditions */
299990792Sgshapiro#  define LOG_WARNING	4	/* warning conditions */
300090792Sgshapiro#  define LOG_NOTICE	5	/* normal but significant condition */
300190792Sgshapiro#  define LOG_INFO	6	/* informational */
300290792Sgshapiro#  define LOG_DEBUG	7	/* debug-level messages */
300390792Sgshapiro# endif /* !LOG */
300490792Sgshapiro
300590792Sgshapiro# ifndef SM_CONF_SYSLOG
300690792Sgshapiro#  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
300790792Sgshapiro# endif /* SM_CONF_SYSLOG */
300890792Sgshapiro
300990792Sgshapiro# if !SM_CONF_SYSLOG
301090792Sgshapiro#   ifdef __STDC__
301190792Sgshapiroextern void	syslog(int, const char *, ...);
301290792Sgshapiro#   else /* __STDC__ */
301390792Sgshapiroextern void	syslog();
301490792Sgshapiro#   endif /* __STDC__ */
301590792Sgshapiro# endif /* !SM_CONF_SYSLOG */
301690792Sgshapiro
301790792Sgshapiro/* portable(?) definition for alignment */
301890792Sgshapiro# ifndef SM_ALIGN_SIZE
301990792Sgshapirostruct sm_align
302090792Sgshapiro{
302190792Sgshapiro	char al_c;
302290792Sgshapiro	union
302390792Sgshapiro	{
302490792Sgshapiro		long	al_l;
302590792Sgshapiro		void	*al_p;
302690792Sgshapiro		double	al_d;
3027141858Sgshapiro		void	(*al_f) __P((void));
302890792Sgshapiro	} al_u;
302990792Sgshapiro};
303090792Sgshapiro#  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
303190792Sgshapiro# endif /* ! SM_ALIGN_SIZE */
303290792Sgshapiro# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
303390792Sgshapiro
303490792Sgshapiro#endif /* ! SM_CONF_H */
3035