conf.h revision 285229
190792Sgshapiro/*
2261194Sgshapiro * Copyright (c) 1998-2011 Proofpoint, 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 *
13266527Sgshapiro *	$Id: conf.h,v 1.147 2013-11-22 20:51:31 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__ */
384223067Sgshapiro#   if SOLARIS >= 21100
385223067Sgshapiro#    include <paths.h>
386223067Sgshapiro#   endif /* SOLARIS >= 21100 */
387223067Sgshapiro#   ifndef _PATH_VARRUN
388223067Sgshapiro#    define _PATH_VARRUN	"/var/run/"
389223067Sgshapiro#   endif /* _PATH_VARRUN */
39090792Sgshapiro#   define GIDSET_T	gid_t
39190792Sgshapiro#   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
39290792Sgshapiro#   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
39390792Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
39490792Sgshapiro#   ifndef _PATH_UNIX
39590792Sgshapiro#    define _PATH_UNIX		"/dev/ksyms"
39690792Sgshapiro#   endif /* ! _PATH_UNIX */
39790792Sgshapiro#   ifndef _PATH_VENDOR_CF
39890792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
39990792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
40090792Sgshapiro#   ifndef _PATH_SENDMAILPID
40190792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
40290792Sgshapiro#   endif /* ! _PATH_SENDMAILPID */
40390792Sgshapiro#   ifndef _PATH_HOSTS
40490792Sgshapiro#    define _PATH_HOSTS		"/etc/inet/hosts"
40590792Sgshapiro#   endif /* ! _PATH_HOSTS */
40690792Sgshapiro#   ifndef SYSLOG_BUFSIZE
40790792Sgshapiro#    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
40890792Sgshapiro#   endif /* ! SYSLOG_BUFSIZE */
40990792Sgshapiro#   ifndef TZ_TYPE
41090792Sgshapiro#    define TZ_TYPE	TZ_TZNAME
41190792Sgshapiro#   endif /* ! TZ_TYPE */
41290792Sgshapiro#   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
41390792Sgshapiro#    define USESETEUID		1	/* seteuid works as of 2.3 */
41490792Sgshapiro#    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
41590792Sgshapiro#   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
41690792Sgshapiro#   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
41790792Sgshapiro#    define HASSETREUID	1		/* setreuid works as of 2.5 */
41890792Sgshapiro#    define HASSETREGID	1	/* use setregid(2) to set saved gid */
419157001Sgshapiro#   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
420157001Sgshapiro#    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
421157001Sgshapiro#   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
42290792Sgshapiro#    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
42390792Sgshapiro#     ifndef LA_TYPE
42490792Sgshapiro#      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
42590792Sgshapiro#     endif /* ! LA_TYPE */
42690792Sgshapiro#     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
42790792Sgshapiro#      define RANDOMSHIFT	8
42890792Sgshapiro#     endif /* ! RANDOMSHIFT */
42990792Sgshapiro#    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
43090792Sgshapiro#   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
43190792Sgshapiro#    ifndef HASRANDOM
43290792Sgshapiro#     define HASRANDOM	0		/* doesn't have random(3) */
43390792Sgshapiro#    endif /* ! HASRANDOM */
43490792Sgshapiro#   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
43590792Sgshapiro#   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
43690792Sgshapiro#    define SM_INT32	int	/* 32bit integer */
43790792Sgshapiro#   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
43890792Sgshapiro#   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
43990792Sgshapiro#    ifndef LA_TYPE
44090792Sgshapiro#     include <sys/loadavg.h>
44190792Sgshapiro#     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
44290792Sgshapiro#      include <sys/pset.h>
44390792Sgshapiro#      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
44490792Sgshapiro#     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
44590792Sgshapiro#      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
44690792Sgshapiro#     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
44790792Sgshapiro#    endif /* ! LA_TYPE */
44890792Sgshapiro#    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
44990792Sgshapiro#   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
45090792Sgshapiro#   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
45190792Sgshapiro#    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
452223067Sgshapiro#    define _PATH_SENDMAILPID	_PATH_VARRUN "sendmail.pid"
453120256Sgshapiro#    ifndef SMRSH_CMDDIR
454120256Sgshapiro#     define SMRSH_CMDDIR	"/var/adm/sm.bin"
455120256Sgshapiro#    endif /* ! SMRSH_CMDDIR */
45690792Sgshapiro#    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
457168515Sgshapiro#    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
45890792Sgshapiro#   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
45990792Sgshapiro#   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
46090792Sgshapiro#    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
461132943Sgshapiro#    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
462132943Sgshapiro#    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
46390792Sgshapiro#   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
464125820Sgshapiro#   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
465125820Sgshapiro#    define HASUNSETENV 1       /* unsetenv() added in S10 */
466125820Sgshapiro#   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
467173340Sgshapiro#   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
468173340Sgshapiro#    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
469203004Sgshapiro#    define HAVE_NANOSLEEP	1	/* moved from librt to libc in S11 */
470223067Sgshapiro#    define SOCKADDR_LEN_T	socklen_t	/* arg#3 to accept, getsockname */
471223067Sgshapiro#    define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
472173340Sgshapiro#   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
47390792Sgshapiro#   ifndef HASGETUSERSHELL
47490792Sgshapiro#    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
47590792Sgshapiro#   endif /* ! HASGETUSERSHELL */
476285229Sgshapiro#   if SOLARIS < 21200
477285229Sgshapiro#    define SIGWAIT_TAKES_1_ARG	1	/* S12 moves to UNIX V7 semantic */
478285229Sgshapiro#   endif /* SOLARIS < 21200 */
47990792Sgshapiro
48090792Sgshapiro#  else /* SOLARIS */
48190792Sgshapiro			/* SunOS 4.0.3 or 4.1.x */
48290792Sgshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
48390792Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
48490792Sgshapiro#   ifndef HASFLOCK
48590792Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
48690792Sgshapiro#   endif /* ! HASFLOCK */
48790792Sgshapiro#   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
48890792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
48990792Sgshapiro#   include <memory.h>
49090792Sgshapiro#   include <vfork.h>
49190792Sgshapiro#   ifdef __GNUC__
49290792Sgshapiro#    define strtoul	strtol	/* gcc library bogosity */
49390792Sgshapiro#   endif /* __GNUC__ */
49490792Sgshapiro#   define memmove(d, s, l)	(bcopy((s), (d), (l)))
49590792Sgshapiro#   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
49690792Sgshapiro#   define SM_INT32	int	/* 32bit integer */
49790792Sgshapiro#   define SM_ALIGN_SIZE (sizeof(long))
49890792Sgshapiro#   define GIDSET_T	int
49990792Sgshapiro#   define SM_CONF_SYSLOG	0
50090792Sgshapiro
50190792Sgshapiro#   ifdef SUNOS403
50290792Sgshapiro			/* special tweaking for SunOS 4.0.3 */
50390792Sgshapiro#    include <malloc.h>
50490792Sgshapiro#    define BSD4_3	1	/* 4.3 BSD-based */
50590792Sgshapiro#    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
50690792Sgshapiro#    define WAITUNION	1	/* use "union wait" as wait argument type */
50790792Sgshapiro#    undef WIFEXITED
50890792Sgshapiro#    undef WEXITSTATUS
50990792Sgshapiro#    undef HASUNAME
51090792Sgshapiro#    define setpgid	setpgrp
51190792Sgshapiro#    define MODE_T	int
51290792Sgshapirotypedef int		pid_t;
51390792Sgshapiroextern char		*getenv();
51490792Sgshapiro
51590792Sgshapiro#   else /* SUNOS403 */
51690792Sgshapiro			/* 4.1.x specifics */
517132943Sgshapiro#    define HASSETSID	1	/* has POSIX setsid(2) call */
51890792Sgshapiro#    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
51990792Sgshapiro
52090792Sgshapiro#   endif /* SUNOS403 */
52190792Sgshapiro#  endif /* SOLARIS */
52290792Sgshapiro
52390792Sgshapiro#  ifndef LA_TYPE
52490792Sgshapiro#   define LA_TYPE	LA_INT
52590792Sgshapiro#  endif /* ! LA_TYPE */
52690792Sgshapiro
52790792Sgshapiro# endif /* defined(sun) && !defined(BSD) */
52890792Sgshapiro
52990792Sgshapiro/*
53090792Sgshapiro**  DG/UX
53190792Sgshapiro**
53290792Sgshapiro**	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
53390792Sgshapiro**	older support.
53490792Sgshapiro**	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
53590792Sgshapiro*/
53690792Sgshapiro
53790792Sgshapiro# ifdef DGUX_5_4_2
53890792Sgshapiro#  define DGUX		1
53990792Sgshapiro# endif /* DGUX_5_4_2 */
54090792Sgshapiro
54190792Sgshapiro# ifdef DGUX
54290792Sgshapiro#  define SYSTEM5	1
54390792Sgshapiro#  define LA_TYPE	LA_DGUX
54490792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
54590792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
546132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
54790792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
54890792Sgshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
54990792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
55090792Sgshapiro#  ifndef IDENTPROTO
55190792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
55290792Sgshapiro#  endif /* ! IDENTPROTO */
55390792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
55490792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
55590792Sgshapiro#  define LDA_USE_LOCKF		1
55690792Sgshapiro
55790792Sgshapiro/* these include files must be included early on DG/UX */
55890792Sgshapiro#  include <netinet/in.h>
55990792Sgshapiro#  include <arpa/inet.h>
56090792Sgshapiro
56190792Sgshapiro/* compiler doesn't understand const? */
56290792Sgshapiro#  define const
56390792Sgshapiro
56490792Sgshapiro#  ifdef DGUX_5_4_2
56590792Sgshapiro#   define inet_addr	dgux_inet_addr
56690792Sgshapiroextern long	dgux_inet_addr();
56790792Sgshapiro#  endif /* DGUX_5_4_2 */
56890792Sgshapiro# endif /* DGUX */
56990792Sgshapiro
57090792Sgshapiro
57190792Sgshapiro/*
57290792Sgshapiro**  Digital Ultrix 4.2 - 4.5
57390792Sgshapiro**
57490792Sgshapiro**	Apparently, fcntl locking is broken on 4.2A, in that locks are
57590792Sgshapiro**	not dropped when the process exits.  This causes major problems,
57690792Sgshapiro**	so flock is the only alternative.
57790792Sgshapiro*/
57890792Sgshapiro
57990792Sgshapiro# ifdef ultrix
58090792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
58190792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
58290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
58390792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
58490792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
58590792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
58690792Sgshapiro#  ifndef HASFLOCK
58790792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
58890792Sgshapiro#  endif /* ! HASFLOCK */
58990792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
59090792Sgshapiro#  ifndef BROKEN_RES_SEARCH
59190792Sgshapiro#   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
59290792Sgshapiro#  endif /* ! BROKEN_RES_SEARCH */
59390792Sgshapiro#  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
59490792Sgshapiro#   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
59590792Sgshapiro#  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
59690792Sgshapiro#  ifdef vax
59790792Sgshapiro#   define LA_TYPE	LA_FLOAT
59890792Sgshapiro#  else /* vax */
59990792Sgshapiro#   define LA_TYPE	LA_INT
60090792Sgshapiro#   define LA_AVENRUN	"avenrun"
60190792Sgshapiro#  endif /* vax */
60290792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
60390792Sgshapiro#  ifndef IDENTPROTO
60490792Sgshapiro#   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
60590792Sgshapiro#  endif /* ! IDENTPROTO */
60690792Sgshapiro#  define SYSLOG_BUFSIZE	256
60790792Sgshapiro#  define SM_CONF_SYSLOG	0
60890792Sgshapiro# endif /* ultrix */
60990792Sgshapiro
61090792Sgshapiro
61190792Sgshapiro/*
61290792Sgshapiro**  OSF/1 for KSR.
61390792Sgshapiro**
61490792Sgshapiro**	Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
61590792Sgshapiro*/
61690792Sgshapiro
61790792Sgshapiro# ifdef __ksr__
61890792Sgshapiro#  define __osf__	1	/* get OSF/1 defines below */
61990792Sgshapiro#  ifndef TZ_TYPE
62090792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
62190792Sgshapiro#  endif /* ! TZ_TYPE */
62290792Sgshapiro# endif /* __ksr__ */
62390792Sgshapiro
62490792Sgshapiro
62590792Sgshapiro/*
62690792Sgshapiro**  OSF/1 for Intel Paragon.
62790792Sgshapiro**
62890792Sgshapiro**	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
62990792Sgshapiro**	of Intel Scalable Systems Divison.
63090792Sgshapiro*/
63190792Sgshapiro
63290792Sgshapiro# ifdef __PARAGON__
63390792Sgshapiro#  define __osf__	1	/* get OSF/1 defines below */
63490792Sgshapiro#  ifndef TZ_TYPE
63590792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
63690792Sgshapiro#  endif /* ! TZ_TYPE */
63790792Sgshapiro#  define GIDSET_T	gid_t
63890792Sgshapiro#  define MAXNAMLEN	NAME_MAX
63990792Sgshapiro# endif /* __PARAGON__ */
64090792Sgshapiro
64190792Sgshapiro
64290792Sgshapiro/*
64390792Sgshapiro**  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
64490792Sgshapiro**
64590792Sgshapiro**	Tested for 3.2 and 4.0.
64690792Sgshapiro*/
64790792Sgshapiro
64890792Sgshapiro# ifdef __osf__
64990792Sgshapiro#  define HASUNAME	1	/* has uname(2) call */
65090792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
65190792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
65290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
65390792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
65490792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
65590792Sgshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
65690792Sgshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
65790792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
65890792Sgshapiro#  define GIDSET_T	gid_t
65990792Sgshapiro#  define SM_INT32	int	/* 32bit integer */
66090792Sgshapiro#  ifndef HASFLOCK
66198121Sgshapiro#   include <standards.h>
66298121Sgshapiro#   if _XOPEN_SOURCE+0 >= 400
66398121Sgshapiro#    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
66498121Sgshapiro#   else /* _XOPEN_SOURCE+0 >= 400 */
66598121Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
66698121Sgshapiro#   endif /* _XOPEN_SOURCE+0 >= 400 */
66790792Sgshapiro#  endif /* ! HASFLOCK */
66890792Sgshapiro#  define LA_TYPE	LA_ALPHAOSF
66990792Sgshapiro#  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
67090792Sgshapiro#  ifndef _PATH_VENDOR_CF
67190792Sgshapiro#   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
67290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
67390792Sgshapiro#  ifndef _PATH_SENDMAILPID
67490792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
67590792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
67694334Sgshapiro#  if _FFR_DIGUNIX_SAFECHOWN
67794334Sgshapiro/*
67894334Sgshapiro**  Testing on a Digital UNIX 4.0a system showed this to be the correct
67994334Sgshapiro**  setting but given the security consequences, more testing and
68094334Sgshapiro**  verification is needed.  Unfortunately, the man page offers no
68194334Sgshapiro**  assistance.
68294334Sgshapiro*/
68394334Sgshapiro#   define IS_SAFE_CHOWN >= 0
68494334Sgshapiro#  endif /* _FFR_DIGUNIX_SAFECHOWN */
68590792Sgshapiro# endif /* __osf__ */
68690792Sgshapiro
68790792Sgshapiro
68890792Sgshapiro/*
68990792Sgshapiro**  NeXTstep
69090792Sgshapiro*/
69190792Sgshapiro
69290792Sgshapiro# ifdef NeXT
69390792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
69490792Sgshapiro#  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
69590792Sgshapiro#  ifndef HASFLOCK
69690792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
69790792Sgshapiro#  endif /* ! HASFLOCK */
69890792Sgshapiro#  define UID_T		int	/* compiler gripes on uid_t */
69990792Sgshapiro#  define GID_T		int	/* ditto for gid_t */
70090792Sgshapiro#  define MODE_T	int	/* and mode_t */
70190792Sgshapiro#  define setpgid	setpgrp
70290792Sgshapiro#  ifndef NOT_SENDMAIL
70390792Sgshapiro#   define sleep		sleepX
70490792Sgshapiro#  endif /* ! NOT_SENDMAIL */
70590792Sgshapiro#  ifndef LA_TYPE
70690792Sgshapiro#   define LA_TYPE	LA_MACH
70790792Sgshapiro#  endif /* ! LA_TYPE */
70890792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
70990792Sgshapiro#  ifdef _POSIX_SOURCE
71090792Sgshapiroextern struct passwd	*getpwent();
71190792Sgshapiro#  else /* _POSIX_SOURCE */
71290792Sgshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
71390792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
71490792Sgshapirotypedef int		pid_t;
71590792Sgshapiro#   undef WEXITSTATUS
71690792Sgshapiro#   undef WIFEXITED
71790792Sgshapiro#   undef WIFSTOPPED
71890792Sgshapiro#   undef WTERMSIG
71990792Sgshapiro#  endif /* _POSIX_SOURCE */
72090792Sgshapiro#  ifndef _PATH_VENDOR_CF
72190792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
72290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
72390792Sgshapiro#  ifndef _PATH_SENDMAILPID
72490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
72590792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
72690792Sgshapiro#  define SM_INT32	int	/* 32bit integer */
72790792Sgshapiro
72890792Sgshapiro#  ifdef TCPWRAPPERS
72990792Sgshapiro#   ifndef HASUNSETENV
73090792Sgshapiro#    define HASUNSETENV	1
73190792Sgshapiro#   endif /* ! HASUNSETENV */
73290792Sgshapiro#   undef NEEDPUTENV
73390792Sgshapiro#  endif /* TCPWRAPPERS */
73490792Sgshapiro#  ifndef __APPLE__
73590792Sgshapiro#   include <libc.h>
73690792Sgshapiro#   ifndef S_IRUSR
73790792Sgshapiro#    define S_IRUSR	S_IREAD
73890792Sgshapiro#   endif /* ! S_IRUSR */
73990792Sgshapiro#   ifndef S_IWUSR
74090792Sgshapiro#    define S_IWUSR	S_IWRITE
74190792Sgshapiro#   endif /* ! S_IWUSR */
74290792Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
74390792Sgshapiro#  endif /* ! __APPLE__ */
74490792Sgshapiro#  ifndef isascii
74590792Sgshapiro#   define isascii(c)	((unsigned)(c) <= 0177)
74690792Sgshapiro#  endif /* ! isascii */
74790792Sgshapiro# endif /* NeXT */
74890792Sgshapiro
74990792Sgshapiro/*
750132943Sgshapiro**  Apple Darwin
751110560Sgshapiro**      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
75290792Sgshapiro*/
75390792Sgshapiro
75490792Sgshapiro# if defined(DARWIN)
755110560Sgshapiro#  define HASFCHMOD		1	/* has fchmod(2) */
756110560Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) */
757110560Sgshapiro#  define HASFLOCK		1	/* has flock(2) */
758110560Sgshapiro#  define HASUNAME		1	/* has uname(2) */
759110560Sgshapiro#  define HASUNSETENV		1	/* has unsetenv(3) */
760157001Sgshapiro#  define HASSETSID		1	/* has POSIX setsid(2) call */
761157001Sgshapiro#  define HASINITGROUPS		1	/* has initgroups(3) */
762110560Sgshapiro#  define HASSETVBUF		1	/* has setvbuf (3) */
763110560Sgshapiro#  define HASSETREUID		0	/* setreuid(2) unusable */
764110560Sgshapiro#  define HASSETEUID		1	/* has seteuid(2) */
765110560Sgshapiro#  define USESETEUID		1	/* has seteuid(2) */
766110560Sgshapiro#  define HASSETEGID		1	/* has setegid(2) */
767110560Sgshapiro#  define HASSETREGID		1	/* has setregid(2) */
768110560Sgshapiro#  define HASSETRESGID		0	/* no setresgid(2) */
769110560Sgshapiro#  define HASLSTAT		1	/* has lstat(2) */
770110560Sgshapiro#  define HASSETRLIMIT		1	/* has setrlimit(2) */
771110560Sgshapiro#  define HASWAITPID		1	/* has waitpid(2) */
772110560Sgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
773110560Sgshapiro#  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
774157001Sgshapiro#  define HASURANDOMDEV		1	/* has urandom(4) */
775110560Sgshapiro#  define HASSTRERROR		1	/* has strerror(3) */
776110560Sgshapiro#  define HASGETUSERSHELL	1	/* had getusershell(3) */
777110560Sgshapiro#  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
778110560Sgshapiro#  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
779110560Sgshapiro#  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
780157001Sgshapiro#  if DARWIN >= 70000
781157001Sgshapiro#   define SOCKADDR_LEN_T	socklen_t
782157001Sgshapiro#  endif
783157001Sgshapiro#  if DARWIN >= 80000
784157001Sgshapiro#   define SPT_TYPE		SPT_REUSEARGV
785157001Sgshapiro#   define SPT_PADCHAR		'\0'
786157001Sgshapiro#   define SOCKOPT_LEN_T	socklen_t
787157001Sgshapiro#  else
788157001Sgshapiro#   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
789157001Sgshapiro#  endif
790110560Sgshapiro#  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
791110560Sgshapiro#  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
792110560Sgshapiro#  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
793110560Sgshapiro#  define HAS_IN_H		1
794110560Sgshapiro#  define NETLINK		1	/* supports AF_LINK */
79594334Sgshapiro#  ifndef NOT_SENDMAIL
796110560Sgshapiro#   define sleep sleepX
797102528Sgshapiroextern unsigned int sleepX __P((unsigned int seconds));
79894334Sgshapiro#  endif /* ! NOT_SENDMAIL */
79990792Sgshapiro# endif /* defined(DARWIN) */
80090792Sgshapiro
80190792Sgshapiro
80290792Sgshapiro/*
80390792Sgshapiro**  4.4 BSD
80490792Sgshapiro**
80590792Sgshapiro**	See also BSD defines.
80690792Sgshapiro*/
80790792Sgshapiro
808157001Sgshapiro# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
80990792Sgshapiro#  include <paths.h>
81090792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
81190792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
81290792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
81390792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
81490792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
81590792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
81690792Sgshapiro#  include <sys/cdefs.h>
81790792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
81890792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
81990792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
82090792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
82190792Sgshapiro#  ifndef LA_TYPE
82290792Sgshapiro#   define LA_TYPE	LA_SUBR
82390792Sgshapiro#  endif /* ! LA_TYPE */
82490792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
82590792Sgshapiro#  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
826157001Sgshapiro# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
82790792Sgshapiro
82890792Sgshapiro
82990792Sgshapiro/*
83090792Sgshapiro**  BSD/OS (was BSD/386) (all versions)
83190792Sgshapiro**	From Tony Sanders, BSDI
83290792Sgshapiro*/
83390792Sgshapiro
83490792Sgshapiro# ifdef __bsdi__
83590792Sgshapiro#  include <paths.h>
83690792Sgshapiro#  define HASUNSETENV	1	/* has the unsetenv(3) call */
83790792Sgshapiro#  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
838132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
83990792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
84090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
84190792Sgshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
84290792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
84390792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
84490792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
84590792Sgshapiro#  include <sys/cdefs.h>
84690792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
84790792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
84890792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
84990792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
85090792Sgshapiro#  ifndef LA_TYPE
85190792Sgshapiro#   define LA_TYPE	LA_SUBR
85290792Sgshapiro#  endif /* ! LA_TYPE */
85390792Sgshapiro#  define GIDSET_T	gid_t
85490792Sgshapiro#  define QUAD_T		quad_t
85590792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
85690792Sgshapiro			/* version 1.1 or later */
85790792Sgshapiro#   undef SPT_TYPE
85890792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
85990792Sgshapiro#  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
86090792Sgshapiro			/* version 1.0 or earlier */
86190792Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
86290792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
86390792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
86490792Sgshapiro#   define HASSETUSERCONTEXT 1	/* has setusercontext */
86590792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
86690792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
86790792Sgshapiro#   define MODE_T	int	/* va_arg() can't handle less than int */
86890792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
86990792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
87090792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
87190792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
87290792Sgshapiro# endif /* __bsdi__ */
87390792Sgshapiro
87490792Sgshapiro
875168515Sgshapiro# if defined(__QNX__)
876168515Sgshapiro#  if defined(__QNXNTO__)
877168515Sgshapiro/* QNX 6 */
878168515Sgshapiro#   include <unix.h>
879168515Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
880168515Sgshapiro#   define HASINITGROUPS	1	/* has initgroups(3) call */
881168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
882168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
883168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
884168515Sgshapiro#   define HASFCHOWN	1	/* has fchown(2) syscall */
885168515Sgshapiro#   define HASUNAME	1	/* has uname(2) syscall */
886168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
887168515Sgshapiro#   define BSD4_4_SOCKADDR	/* has sa_len */
888168515Sgshapiro#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
889168515Sgshapiro#   define NETLINK	1	/* supports AF_LINK */
890168515Sgshapiro#   define GIDSET_T	gid_t
891168515Sgshapiro#   define QUAD_T	uint64_t
892168515Sgshapiro#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
893168515Sgshapiro#   define HASGETUSERSHELL 0
894168515Sgshapiro
89590792Sgshapiro/*
896168515Sgshapiro**  We have a strrev() that doesn't allocate anything.
897168515Sgshapiro**  Make sure the one here is used.
898168515Sgshapiro*/
899168515Sgshapiro
900168515Sgshapiro#   define strrev strrev_sendmail
901168515Sgshapiro
902168515Sgshapiro#  else /* defined(__QNXNTO__) */
903168515Sgshapiro
904168515Sgshapiro/*
90590792Sgshapiro**  QNX 4.2x
90690792Sgshapiro**	Contributed by Glen McCready <glen@qnx.com>.
90790792Sgshapiro**
908168515Sgshapiro**	Should work with all versions of QNX 4.
90990792Sgshapiro*/
91090792Sgshapiro
911168515Sgshapiro#   include <unix.h>
912168515Sgshapiro#   include <sys/select.h>
913168515Sgshapiro#   undef NGROUPS_MAX
914168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
915168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
916168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
917168515Sgshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
918168515Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
919168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
920168515Sgshapiro#   define HASFLOCK	0
921168515Sgshapiro#   undef HASINITGROUPS		/* has initgroups(3) call */
922168515Sgshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
923168515Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
924168515Sgshapiro#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
925168515Sgshapiro#   define GIDSET_T	gid_t
926168515Sgshapiro#   define LA_TYPE	LA_ZERO
927168515Sgshapiro#   define SFS_TYPE	SFS_NONE
928168515Sgshapiro#   define SPT_TYPE	SPT_REUSEARGV
929168515Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
930168515Sgshapiro#   define HASGETUSERSHELL 0
931168515Sgshapiro#   define _FILE_H_INCLUDED
932168515Sgshapiro#  endif /* defined(__QNXNTO__) */
93390792Sgshapiro# endif /* defined(__QNX__) */
93490792Sgshapiro
93590792Sgshapiro
93690792Sgshapiro/*
937141858Sgshapiro**  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
93890792Sgshapiro**
93990792Sgshapiro**  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
94090792Sgshapiro**  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
94190792Sgshapiro**
94290792Sgshapiro**	See also BSD defines.
94390792Sgshapiro*/
94490792Sgshapiro
945141858Sgshapiro# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
94690792Sgshapiro#  include <paths.h>
94790792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
948132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
94990792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
95090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
951132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
95290792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
95390792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
95490792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
95590792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
95690792Sgshapiro#  include <sys/cdefs.h>
95790792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
95890792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
95990792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
96090792Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
96190792Sgshapiro#  define GIDSET_T	gid_t
962157001Sgshapiro#  define QUAD_T	unsigned long long
963157001Sgshapiro#  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
96490792Sgshapiro#  ifndef LA_TYPE
96590792Sgshapiro#   define LA_TYPE	LA_SUBR
96690792Sgshapiro#  endif /* ! LA_TYPE */
967157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
968157001Sgshapiro    ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
969157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
970132943Sgshapiro#   undef SFS_TYPE
971132943Sgshapiro#   define SFS_TYPE	SFS_STATVFS
972132943Sgshapiro#  else
973132943Sgshapiro#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
974132943Sgshapiro#  endif
97590792Sgshapiro#  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
97690792Sgshapiro#   undef SPT_TYPE
97790792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
97890792Sgshapiro#  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
97990792Sgshapiro#  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
98090792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
98190792Sgshapiro#  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
982132943Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
983132943Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
984132943Sgshapiro#  endif
985157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
986157001Sgshapiro    ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
987157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
988132943Sgshapiro#   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
989132943Sgshapiro#  endif
990132943Sgshapiro#  if defined(__NetBSD__)
991132943Sgshapiro#   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
992132943Sgshapiro#   include <sys/param.h>
993132943Sgshapiro#   include <sys/sysctl.h>
994132943Sgshapiro#  endif
995141858Sgshapiro#  if defined(__DragonFly__)
996141858Sgshapiro#   define HASSETLOGIN		1	/* has setlogin(2) */
997141858Sgshapiro#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
998141858Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
999141858Sgshapiro#   undef SPT_TYPE
1000141858Sgshapiro#   include <libutil.h>
1001141858Sgshapiro#   define SPT_TYPE		SPT_BUILTIN
1002141858Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1003141858Sgshapiro#   ifndef SMRSH_CMDDIR
1004141858Sgshapiro#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1005141858Sgshapiro#   endif /* ! SMRSH_CMDDIR */
1006141858Sgshapiro#   ifndef SMRSH_PATH
1007141858Sgshapiro#    define SMRSH_PATH		"/bin:/usr/bin"
1008141858Sgshapiro#   endif /* ! SMRSH_PATH */
1009141858Sgshapiro#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
1010141858Sgshapiro#  include <sys/sysctl.h>
1011141858Sgshapiro#  endif /* defined(__DragonFly__) */
101290792Sgshapiro#  if defined(__FreeBSD__)
101390792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
101490792Sgshapiro#   if __FreeBSD_version >= 227001
101590792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
101690792Sgshapiro#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
101790792Sgshapiro#   endif /* __FreeBSD_version >= 227001 */
101890792Sgshapiro#   undef SPT_TYPE
101990792Sgshapiro#   if __FreeBSD__ >= 2
102090792Sgshapiro#    include <osreldate.h>
102190792Sgshapiro#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
102290792Sgshapiro#     include <libutil.h>
102390792Sgshapiro#     define SPT_TYPE	SPT_BUILTIN
102490792Sgshapiro#    endif /* __FreeBSD_version >= 199512 */
102590792Sgshapiro#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
102690792Sgshapiro#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
102790792Sgshapiro#    endif /* __FreeBSD_version >= 222000 */
1028223067Sgshapiro#    if __FreeBSD_version >= 300000	/* 3.0.0-release and later */
1029223067Sgshapiro#     define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1030223067Sgshapiro#    endif /* __FreeBSD_version >= 300000 */
103190792Sgshapiro#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
1032120256Sgshapiro#     ifndef SMRSH_CMDDIR
1033120256Sgshapiro#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1034120256Sgshapiro#     endif /* ! SMRSH_CMDDIR */
1035120256Sgshapiro#     ifndef SMRSH_PATH
1036120256Sgshapiro#      define SMRSH_PATH	"/bin:/usr/bin"
1037120256Sgshapiro#     endif /* ! SMRSH_PATH */
103890792Sgshapiro#    endif /* __FreeBSD_version >= 330000 */
1039203004Sgshapiro#    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
1040203004Sgshapiro#     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
1041203004Sgshapiro#     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
1042203004Sgshapiro#    endif /* __FreeBSD_version >= 430000 */
104390792Sgshapiro#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
104490792Sgshapiro#    include <sys/sysctl.h>
104590792Sgshapiro#   endif /* __FreeBSD__ >= 2 */
104690792Sgshapiro#   ifndef SPT_TYPE
104790792Sgshapiro#    define SPT_TYPE	SPT_REUSEARGV
104890792Sgshapiro#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
104990792Sgshapiro#   endif /* ! SPT_TYPE */
105090792Sgshapiro#  endif /* defined(__FreeBSD__) */
105190792Sgshapiro#  if defined(__OpenBSD__)
105290792Sgshapiro#   undef SPT_TYPE
105390792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
105490792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
1055120256Sgshapiro#   if OpenBSD < 200305
1056120256Sgshapiro#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
1057120256Sgshapiro#   endif /* OpenBSD < 200305 */
105890792Sgshapiro#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
105990792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
106090792Sgshapiro#   if OpenBSD >= 200006
106190792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
106290792Sgshapiro#   endif /* OpenBSD >= 200006 */
106390792Sgshapiro#   if OpenBSD >= 200012
106490792Sgshapiro#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
106590792Sgshapiro#   endif /* OpenBSD >= 200012 */
1066132943Sgshapiro#   if OpenBSD >= 200405
1067132943Sgshapiro#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
1068132943Sgshapiro#   endif /* OpenBSD >= 200405 */
1069157001Sgshapiro#   if OpenBSD >= 200505
1070157001Sgshapiro#    undef NETISO	/* iso.h removed in 3.7 */
1071157001Sgshapiro#   endif /* OpenBSD >= 200505 */
1072223067Sgshapiro#   if OpenBSD >= 200800
1073223067Sgshapiro#    define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1074223067Sgshapiro#   endif /* OpenBSD >= 200800 */
107590792Sgshapiro#  endif /* defined(__OpenBSD__) */
1076141858Sgshapiro# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
107790792Sgshapiro
107890792Sgshapiro
107990792Sgshapiro/*
108090792Sgshapiro**  Mach386
108190792Sgshapiro**
108290792Sgshapiro**	For mt Xinu's Mach386 system.
108390792Sgshapiro*/
108490792Sgshapiro
108590792Sgshapiro# if defined(MACH) && defined(i386) && !defined(__GNU__)
108690792Sgshapiro#  define MACH386	1
108790792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
108890792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
108990792Sgshapiro#  ifndef HASFLOCK
109090792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
109190792Sgshapiro#  endif /* ! HASFLOCK */
109290792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
109390792Sgshapiro#  define NEEDSTRTOL	1	/* need the strtol() function */
109490792Sgshapiro#  define setpgid	setpgrp
109590792Sgshapiro#  ifndef LA_TYPE
109690792Sgshapiro#   define LA_TYPE	LA_FLOAT
109790792Sgshapiro#  endif /* ! LA_TYPE */
109890792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
109990792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
110090792Sgshapiro#  undef WEXITSTATUS
110190792Sgshapiro#  undef WIFEXITED
110290792Sgshapiro#  ifndef _PATH_VENDOR_CF
110390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
110490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
110590792Sgshapiro#  ifndef _PATH_SENDMAILPID
110690792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
110790792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
110890792Sgshapiro# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
110990792Sgshapiro
111090792Sgshapiro
111190792Sgshapiro
111290792Sgshapiro/*
111390792Sgshapiro**  GNU OS (hurd)
111490792Sgshapiro**	Largely BSD & posix compatible.
111590792Sgshapiro**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
111690792Sgshapiro**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
111790792Sgshapiro*/
111890792Sgshapiro
111990792Sgshapiro# if defined(__GNU__) && !defined(NeXT)
112090792Sgshapiro#  include <paths.h>
112190792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
112290792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
112390792Sgshapiro#  define HASUNAME	1	/* has uname(2) call */
112490792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
112590792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
112690792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
112790792Sgshapiro#  define GIDSET_T	gid_t
112890792Sgshapiro#  define SOCKADDR_LEN_T	socklen_t
112990792Sgshapiro#  define SOCKOPT_LEN_T	socklen_t
113090792Sgshapiro#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
113190792Sgshapiro#   define LA_TYPE	LA_SUBR
113290792Sgshapiro#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
113390792Sgshapiro#   define LA_TYPE	LA_MACH
113490792Sgshapiro   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
113590792Sgshapiro#   define host_self	mach_host_self
113690792Sgshapiro#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
113790792Sgshapiro#  define SFS_TYPE	SFS_STATFS
113890792Sgshapiro#  define SPT_TYPE	SPT_CHANGEARGV
113990792Sgshapiro#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
114090792Sgshapiro#  define BSD4_4_SOCKADDR	1	/* has sa_len */
114190792Sgshapiro#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
114290792Sgshapiro#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
114390792Sgshapiro/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
114490792Sgshapiro#  define MAXPATHLEN	2048
114590792Sgshapiro# endif /* defined(__GNU__) && !defined(NeXT) */
114690792Sgshapiro
114790792Sgshapiro/*
114890792Sgshapiro**  4.3 BSD -- this is for very old systems
114990792Sgshapiro**
115090792Sgshapiro**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
115190792Sgshapiro**
115290792Sgshapiro**	You'll also have to install a new resolver library.
115390792Sgshapiro**	I don't guarantee that support for this environment is complete.
115490792Sgshapiro*/
115590792Sgshapiro
115690792Sgshapiro# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
115790792Sgshapiro#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
115890792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
115990792Sgshapiro#  define ARBPTR_T	char *
116090792Sgshapiro#  define setpgid	setpgrp
116190792Sgshapiro#  ifndef LA_TYPE
116290792Sgshapiro#   define LA_TYPE	LA_FLOAT
116390792Sgshapiro#  endif /* ! LA_TYPE */
116490792Sgshapiro#  ifndef _PATH_VENDOR_CF
116590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
116690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
116790792Sgshapiro#  ifndef IDENTPROTO
116890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
116990792Sgshapiro#  endif /* ! IDENTPROTO */
117090792Sgshapiro#  undef WEXITSTATUS
117190792Sgshapiro#  undef WIFEXITED
117290792Sgshapirotypedef short		pid_t;
117390792Sgshapiro# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
117490792Sgshapiro
117590792Sgshapiro
117690792Sgshapiro/*
117790792Sgshapiro**  SCO Unix
117890792Sgshapiro**
117990792Sgshapiro**	This includes three parts:
118090792Sgshapiro**
118190792Sgshapiro**	The first is for SCO OpenServer 5.
118290792Sgshapiro**	(Contributed by Keith Reynolds <keithr@sco.COM>).
118390792Sgshapiro**
118490792Sgshapiro**		SCO OpenServer 5 has a compiler version number macro,
118590792Sgshapiro**		which we can use to figure out what version we're on.
118690792Sgshapiro**		This may have to change in future releases.
118790792Sgshapiro**
118890792Sgshapiro**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
118990792Sgshapiro**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
119090792Sgshapiro**
119190792Sgshapiro**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
119290792Sgshapiro*/
119390792Sgshapiro
119490792Sgshapiro/* SCO OpenServer 5 */
119590792Sgshapiro# if _SCO_DS >= 1
119690792Sgshapiro#  include <paths.h>
119790792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
119890792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
119990792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
120090792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
120190792Sgshapiro#  define USESETEUID	1	/* has seteuid(2) call */
120290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
120390792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
120490792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
120590792Sgshapiro#  define LDA_USE_LOCKF	1
120690792Sgshapiro#  ifndef LA_TYPE
120790792Sgshapiro#   define LA_TYPE	LA_DEVSHORT
120890792Sgshapiro#  endif /* ! LA_TYPE */
120990792Sgshapiro#  define _PATH_AVENRUN	"/dev/table/avenrun"
121090792Sgshapiro#  ifndef _SCO_unix_4_2
121190792Sgshapiro#   define _SCO_unix_4_2
121290792Sgshapiro#  else /* ! _SCO_unix_4_2 */
121390792Sgshapiro#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1214147078Sgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
121590792Sgshapiro#  endif /* ! _SCO_unix_4_2 */
121690792Sgshapiro# endif /* _SCO_DS >= 1 */
121790792Sgshapiro
121890792Sgshapiro/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
121990792Sgshapiro# ifdef _SCO_unix_4_2
122090792Sgshapiro#  define _SCO_unix_
122190792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
122290792Sgshapiro# endif /* _SCO_unix_4_2 */
122390792Sgshapiro
122490792Sgshapiro/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
122590792Sgshapiro# ifdef _SCO_unix_
122690792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
122790792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
122890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
122990792Sgshapiro#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
123090792Sgshapiro#  ifndef USE_SIGLONGJMP
123190792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
123290792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
123390792Sgshapiro#  define MAXPATHLEN	PATHSIZE
123490792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
123590792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
123690792Sgshapiro#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
123790792Sgshapiro#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
123890792Sgshapiro#  define UID_T		uid_t
123990792Sgshapiro#  define GID_T		gid_t
124090792Sgshapiro#  define GIDSET_T	gid_t
124190792Sgshapiro#  define _PATH_UNIX		"/unix"
124290792Sgshapiro#  ifndef _PATH_VENDOR_CF
124390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
124490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
124590792Sgshapiro#  ifndef _PATH_SENDMAILPID
124690792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
124790792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
124890792Sgshapiro
124990792Sgshapiro/* stuff fixed in later releases */
125090792Sgshapiro#  ifndef _SCO_unix_4_2
125190792Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
125290792Sgshapiro#  endif /* ! _SCO_unix_4_2 */
125390792Sgshapiro
125490792Sgshapiro#  ifndef _SCO_DS
125590792Sgshapiro#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
125690792Sgshapiro#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
125790792Sgshapiro#   define NETUNIX	0	/* no unix domain socket support */
125890792Sgshapiro#   define LA_TYPE	LA_SHORT
125990792Sgshapiro#  endif /* ! _SCO_DS */
126090792Sgshapiro
126190792Sgshapiro# endif /* _SCO_unix_ */
126290792Sgshapiro
126390792Sgshapiro/*
126490792Sgshapiro**  ISC (SunSoft) Unix.
126590792Sgshapiro**
126690792Sgshapiro**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
126790792Sgshapiro*/
126890792Sgshapiro
126990792Sgshapiro# ifdef ISC_UNIX
127090792Sgshapiro#  include <net/errno.h>
127190792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
127290792Sgshapiro#  include <sys/bsdtypes.h>
127390792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
127490792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
127590792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
127690792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
127790792Sgshapiro#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
127890792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
127990792Sgshapiro#  define MAXPATHLEN	1024
128090792Sgshapiro#  define LA_TYPE	LA_SHORT
128190792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
128290792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
128390792Sgshapiro#  define _PATH_UNIX		"/unix"
128490792Sgshapiro#  ifndef _PATH_VENDOR_CF
128590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
128690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
128790792Sgshapiro#  ifndef _PATH_SENDMAILPID
128890792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
128990792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
129090792Sgshapiro# endif /* ISC_UNIX */
129190792Sgshapiro
129290792Sgshapiro
129390792Sgshapiro/*
129490792Sgshapiro**  Altos System V (5.3.1)
129590792Sgshapiro**	Contributed by Tim Rice <tim@trr.metro.net>.
129690792Sgshapiro*/
129790792Sgshapiro
129890792Sgshapiro# ifdef ALTOS_SYSTEM_V
129990792Sgshapiro#  include <sys/stream.h>
130090792Sgshapiro#  include <limits.h>
130190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
130290792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
130390792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
130490792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
130590792Sgshapiro#  define NEEDFSYNC	1	/* no fsync(2) in system library */
130690792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
130790792Sgshapiro#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
130890792Sgshapiro#  define MAXPATHLEN	PATH_MAX
130990792Sgshapiro#  define LA_TYPE	LA_SHORT
131090792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
131190792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
131290792Sgshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
131390792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
131490792Sgshapiro#  undef WIFEXITED
131590792Sgshapiro#  undef WEXITSTATUS
131690792Sgshapiro#  define strtoul	strtol	/* gcc library bogosity */
131790792Sgshapiro
131890792Sgshapirotypedef unsigned short	uid_t;
131990792Sgshapirotypedef unsigned short	gid_t;
132090792Sgshapirotypedef short		pid_t;
132190792Sgshapirotypedef unsigned long	mode_t;
132290792Sgshapiro
132390792Sgshapiro/* some stuff that should have been in the include files */
132490792Sgshapiroextern char		*malloc();
132590792Sgshapiroextern struct passwd	*getpwent();
132690792Sgshapiroextern struct passwd	*getpwnam();
132790792Sgshapiroextern struct passwd	*getpwuid();
132890792Sgshapiroextern char		*getenv();
132990792Sgshapiroextern struct group	*getgrgid();
133090792Sgshapiroextern struct group	*getgrnam();
133190792Sgshapiro
133290792Sgshapiro# endif /* ALTOS_SYSTEM_V */
133390792Sgshapiro
133490792Sgshapiro
133590792Sgshapiro/*
133690792Sgshapiro**  ConvexOS 11.0 and later
133790792Sgshapiro**
133890792Sgshapiro**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
133990792Sgshapiro**	works on 9.1 as well.
134090792Sgshapiro**
134190792Sgshapiro**  ConvexOS 11.5 and later, should work on 11.0 as defined.
134290792Sgshapiro**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
134390792Sgshapiro**
134490792Sgshapiro**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
134590792Sgshapiro**		(now the CONVEX Technologies Center of Hewlett Packard)
134690792Sgshapiro*/
134790792Sgshapiro
134890792Sgshapiro# ifdef _CONVEX_SOURCE
134990792Sgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
135090792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) */
135190792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
135290792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
135390792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) */
135490792Sgshapiro#  define HASFLOCK	1	/* has flock(2) */
135590792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) */
135690792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) */
135790792Sgshapiro#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
135890792Sgshapiro#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
135990792Sgshapiro#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
136090792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
136190792Sgshapiro#  define LA_TYPE	LA_FLOAT
136290792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
136390792Sgshapiro#  ifndef _PATH_VENDOR_CF
136490792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
136590792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
136690792Sgshapiro#  ifndef S_IREAD
136790792Sgshapiro#   define S_IREAD	_S_IREAD
136890792Sgshapiro#   define S_IWRITE	_S_IWRITE
136990792Sgshapiro#   define S_IEXEC	_S_IEXEC
137090792Sgshapiro#   define S_IFMT	_S_IFMT
137190792Sgshapiro#   define S_IFCHR	_S_IFCHR
137290792Sgshapiro#   define S_IFBLK	_S_IFBLK
137390792Sgshapiro#  endif /* ! S_IREAD */
137490792Sgshapiro#  ifndef TZ_TYPE
137590792Sgshapiro#   define TZ_TYPE	TZ_TIMEZONE
137690792Sgshapiro#  endif /* ! TZ_TYPE */
137790792Sgshapiro#  ifndef IDENTPROTO
137890792Sgshapiro#   define IDENTPROTO	1
137990792Sgshapiro#  endif /* ! IDENTPROTO */
138090792Sgshapiro#  ifndef SHARE_V1
138190792Sgshapiro#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
138290792Sgshapiro#  endif /* ! SHARE_V1 */
138390792Sgshapiro#  if !defined(__GNUC__ )
138490792Sgshapiro#   define UID_T	int		/* GNUC gets it right, ConvexC botches */
138590792Sgshapiro#   define GID_T	int		/* GNUC gets it right, ConvexC botches */
138690792Sgshapiro#  endif /* !defined(__GNUC__ ) */
138790792Sgshapiro#  if SECUREWARE
138890792Sgshapiro#   define FORK	fork		/* SecureWare wants the real fork! */
138990792Sgshapiro#  else /* SECUREWARE */
139090792Sgshapiro#   define FORK	vfork		/* the rest of the OS versions don't care */
139190792Sgshapiro#  endif /* SECUREWARE */
139290792Sgshapiro# endif /* _CONVEX_SOURCE */
139390792Sgshapiro
139490792Sgshapiro
139590792Sgshapiro/*
139690792Sgshapiro**  RISC/os 4.52
139790792Sgshapiro**
139890792Sgshapiro**	Gives a ton of warning messages, but otherwise compiles.
139990792Sgshapiro*/
140090792Sgshapiro
140190792Sgshapiro# ifdef RISCOS
140290792Sgshapiro
140390792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
140490792Sgshapiro#  ifndef HASFLOCK
140590792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
140690792Sgshapiro#  endif /* ! HASFLOCK */
140790792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
140890792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
140990792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
141090792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
141190792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
141290792Sgshapiro#  define LA_TYPE	LA_INT
141390792Sgshapiro#  define LA_AVENRUN	"avenrun"
141490792Sgshapiro#  define _PATH_UNIX	"/unix"
141590792Sgshapiro#  undef WIFEXITED
141690792Sgshapiro
141790792Sgshapiro#  define setpgid	setpgrp
141890792Sgshapiro
141990792Sgshapirotypedef int		pid_t;
142090792Sgshapiro#  define SIGFUNC_DEFINED
142190792Sgshapiro#  define SIGFUNC_RETURN	(0)
142290792Sgshapiro#  define SIGFUNC_DECL	int
142390792Sgshapirotypedef int		(*sigfunc_t)();
142490792Sgshapiroextern char		*getenv();
142590792Sgshapiroextern void		*malloc();
142690792Sgshapiro
142790792Sgshapiro/* added for RISC/os 4.01...which is dumber than 4.50 */
142890792Sgshapiro#  ifdef RISCOS_4_0
142990792Sgshapiro#   ifndef ARBPTR_T
143090792Sgshapiro#    define ARBPTR_T	char *
143190792Sgshapiro#   endif /* ! ARBPTR_T */
143290792Sgshapiro#   undef HASFLOCK
143390792Sgshapiro#   define HASFLOCK	0
143490792Sgshapiro#  endif /* RISCOS_4_0 */
143590792Sgshapiro
143690792Sgshapiro#  include <sys/time.h>
143790792Sgshapiro
143890792Sgshapiro# endif /* RISCOS */
143990792Sgshapiro
144090792Sgshapiro
144190792Sgshapiro/*
144290792Sgshapiro**  Linux 0.99pl10 and above...
144390792Sgshapiro**
144490792Sgshapiro**  Thanks to, in reverse order of contact:
144590792Sgshapiro**
144690792Sgshapiro**	John Kennedy <warlock@csuchico.edu>
144790792Sgshapiro**	Andrew Pam <avatar@aus.xanadu.com>
144890792Sgshapiro**	Florian La Roche <rzsfl@rz.uni-sb.de>
144990792Sgshapiro**	Karl London <karl@borg.demon.co.uk>
145090792Sgshapiro**
145190792Sgshapiro**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
145290792Sgshapiro**	file locking is no longer allowed.  In particular, make sure
145390792Sgshapiro**	your DBM library and sendmail are both using either flock(2)
145490792Sgshapiro**	*or* fcntl(2) file locking, but not both.
145590792Sgshapiro*/
145690792Sgshapiro
145790792Sgshapiro# ifdef __linux__
145890792Sgshapiro#  include <linux/version.h>
145990792Sgshapiro#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
146090792Sgshapiro#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
146190792Sgshapiro#  endif /* !defined(KERNEL_VERSION) */
146290792Sgshapiro#  define BSD		1	/* include BSD defines */
146390792Sgshapiro#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
146490792Sgshapiro#  ifndef REQUIRES_DIR_FSYNC
146590792Sgshapiro#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
146690792Sgshapiro#  endif /* REQUIRES_DIR_FSYNC */
146790792Sgshapiro#  ifndef USESETEUID
146890792Sgshapiro#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
146990792Sgshapiro#  endif /* USESETEUID */
1470112810Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
147190792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
147290792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
147390792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
147490792Sgshapiro#  define GIDSET_T	gid_t	/* from <linux/types.h> */
147590792Sgshapiro#  ifndef HASGETUSERSHELL
147690792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
147790792Sgshapiro#  endif /* HASGETUSERSHELL */
147890792Sgshapiro#  ifndef IP_SRCROUTE
147990792Sgshapiro#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
148090792Sgshapiro#  endif /* ! IP_SRCROUTE */
148190792Sgshapiro#  ifndef HAS_IN_H
148290792Sgshapiro#   define HAS_IN_H	1	/* use netinet/in.h */
148390792Sgshapiro#  endif /* ! HAS_IN_H */
148490792Sgshapiro#  ifndef USE_SIGLONGJMP
148590792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
148690792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
148790792Sgshapiro#  ifndef HASFLOCK
148890792Sgshapiro#   if LINUX_VERSION_CODE < 66399
148990792Sgshapiro#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
149090792Sgshapiro#   else /* LINUX_VERSION_CODE < 66399 */
1491132943Sgshapiro#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
1492132943Sgshapiro#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1493132943Sgshapiro#     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1494132943Sgshapiro#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1495132943Sgshapiro#     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
149690792Sgshapiro#   endif /* LINUX_VERSION_CODE < 66399 */
149790792Sgshapiro#  endif /* ! HASFLOCK */
149890792Sgshapiro#  ifndef LA_TYPE
149990792Sgshapiro#   define LA_TYPE	LA_PROCSTR
150090792Sgshapiro#  endif /* ! LA_TYPE */
150190792Sgshapiro#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
150290792Sgshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
150390792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
150490792Sgshapiro#   ifndef HASURANDOMDEV
150590792Sgshapiro#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
150690792Sgshapiro#   endif /* ! HASURANDOMDEV */
150790792Sgshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1508120256Sgshapiro#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1509132943Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
1510120256Sgshapiro#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
151190792Sgshapiro#  ifndef TZ_TYPE
151290792Sgshapiro#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
151390792Sgshapiro#  endif /* ! TZ_TYPE */
151498841Sgshapiro#  if (__GLIBC__ >= 2)
151598841Sgshapiro#   include <paths.h>
151698841Sgshapiro#  endif /* (__GLIBC__ >= 2) */
151790792Sgshapiro#  ifndef _PATH_SENDMAILPID
151890792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
151990792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
152090792Sgshapiro#  include <sys/sysmacros.h>
152190792Sgshapiro#  undef atol			/* wounded in <stdlib.h> */
152290792Sgshapiro#  if NETINET6
152390792Sgshapiro   /*
152490792Sgshapiro   **  Linux doesn't have a good way to tell userland what interfaces are
152590792Sgshapiro   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
152690792Sgshapiro   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
152790792Sgshapiro   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
152890792Sgshapiro   */
152990792Sgshapiro#   define ADDRCONFIG_IS_BROKEN	1
153090792Sgshapiro
153190792Sgshapiro   /*
153290792Sgshapiro   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
153390792Sgshapiro   **  in 2.1 and later, but the APIs appear before the functions.
153490792Sgshapiro   */
153590792Sgshapiro#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
153690792Sgshapiro#    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
153790792Sgshapiro#    if (GLIBC_VERSION >= 0x201)
1538261194Sgshapiro#     define SOCKADDR_LEN_T     socklen_t
1539261194Sgshapiro#     define SOCKOPT_LEN_T      socklen_t
154090792Sgshapiro#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
154190792Sgshapiro#    else /* (GLIBC_VERSION >= 0x201) */
154290792Sgshapiro#     include <linux/in6.h>	/* IPv6 support */
154390792Sgshapiro#    endif /* (GLIBC_VERSION >= 0x201) */
154490792Sgshapiro#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
154590792Sgshapiro     /* Have APIs in <netdb.h>, but no support in glibc */
154690792Sgshapiro#     define NEEDSGETIPNODE	1
154790792Sgshapiro#    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
154890792Sgshapiro#    undef GLIBC_VERSION
154990792Sgshapiro#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
155090792Sgshapiro#  endif /* NETINET6 */
155190792Sgshapiro#  ifndef HASFCHOWN
155290792Sgshapiro#   define HASFCHOWN	1	/* fchown(2) */
155390792Sgshapiro#  endif /* ! HASFCHOWN */
155490792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
155590792Sgshapiro#    define HASFCHMOD	1	/* fchmod(2) */
155690792Sgshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
155790792Sgshapiro# endif /* __linux__ */
155890792Sgshapiro
155990792Sgshapiro
156090792Sgshapiro/*
156190792Sgshapiro**  DELL SVR4 Issue 2.2, and others
156290792Sgshapiro**	From Kimmo Suominen <kim@grendel.lut.fi>
156390792Sgshapiro**
156490792Sgshapiro**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
156590792Sgshapiro**	defined, and the definitions conflict.
156690792Sgshapiro**
156790792Sgshapiro**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
156890792Sgshapiro**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
156990792Sgshapiro**	(SVR4.0/386 version 3.0).
157090792Sgshapiro*/
157190792Sgshapiro
157290792Sgshapiro# ifdef DELL_SVR4
157390792Sgshapiro				/* no changes necessary */
157490792Sgshapiro				/* see general __svr4__ defines below */
157590792Sgshapiro# endif /* DELL_SVR4 */
157690792Sgshapiro
157790792Sgshapiro
157890792Sgshapiro/*
157990792Sgshapiro**  Apple A/UX 3.0
158090792Sgshapiro*/
158190792Sgshapiro
158290792Sgshapiro# ifdef _AUX_SOURCE
158390792Sgshapiro#  include <sys/sysmacros.h>
158490792Sgshapiro#  define BSD			/* has BSD routines */
158590792Sgshapiro#  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
158690792Sgshapiro#  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
158790792Sgshapiro#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
158890792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
158990792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
159090792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
159190792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) in libc */
159290792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
159390792Sgshapiro#  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
159490792Sgshapiro#  define SIGFUNC_RETURN		/* POSIX-mode */
159590792Sgshapiro#  define SIGFUNC_DECL	void	/* POSIX-mode */
159690792Sgshapiro#  define ERRLIST_PREDEFINED	1
159790792Sgshapiro#  ifndef IDENTPROTO
159890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
159990792Sgshapiro#  endif /* ! IDENTPROTO */
160090792Sgshapiro#  ifndef LA_TYPE
160190792Sgshapiro#   define LA_TYPE	LA_INT
160290792Sgshapiro#   define FSHIFT	16
160390792Sgshapiro#  endif /* ! LA_TYPE */
160490792Sgshapiro#  define LA_AVENRUN	"avenrun"
160590792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
160690792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
160790792Sgshapiro#  ifndef _PATH_UNIX
160890792Sgshapiro#   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
160990792Sgshapiro#  endif /* ! _PATH_UNIX */
161090792Sgshapiro#  ifndef _PATH_VENDOR_CF
161190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
161290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
161390792Sgshapiro#  undef WIFEXITED
161490792Sgshapiro#  undef WEXITSTATUS
161590792Sgshapiro# endif /* _AUX_SOURCE */
161690792Sgshapiro
161790792Sgshapiro
161890792Sgshapiro/*
161990792Sgshapiro**  Encore UMAX V
162090792Sgshapiro**
162190792Sgshapiro**	Not extensively tested.
162290792Sgshapiro*/
162390792Sgshapiro
162490792Sgshapiro# ifdef UMAXV
162590792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
162690792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
162790792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
162890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
162990792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
163090792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
163190792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
163290792Sgshapiro#  define MAXPATHLEN	PATH_MAX
163390792Sgshapiroextern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
163490792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
163590792Sgshapiro#  undef WIFEXITED
163690792Sgshapiro#  undef WEXITSTATUS
163790792Sgshapiro# endif /* UMAXV */
163890792Sgshapiro
163990792Sgshapiro
164090792Sgshapiro/*
164190792Sgshapiro**  Stardent Titan 3000 running TitanOS 4.2.
164290792Sgshapiro**
164390792Sgshapiro**	Must be compiled in "cc -43" mode.
164490792Sgshapiro**
164590792Sgshapiro**	From Kate Hedstrom <kate@ahab.rutgers.edu>.
164690792Sgshapiro**
164790792Sgshapiro**	Note the tweaking below after the BSD defines are set.
164890792Sgshapiro*/
164990792Sgshapiro
165090792Sgshapiro# ifdef titan
165190792Sgshapiro#  define setpgid	setpgrp
165290792Sgshapirotypedef int		pid_t;
165390792Sgshapiro#  undef WIFEXITED
165490792Sgshapiro#  undef WEXITSTATUS
165590792Sgshapiro# endif /* titan */
165690792Sgshapiro
165790792Sgshapiro
165890792Sgshapiro/*
165990792Sgshapiro**  Sequent DYNIX 3.2.0
166090792Sgshapiro**
166190792Sgshapiro**	From Jim Davis <jdavis@cs.arizona.edu>.
166290792Sgshapiro*/
166390792Sgshapiro
166490792Sgshapiro# ifdef sequent
166590792Sgshapiro
166690792Sgshapiro#  define BSD		1
166790792Sgshapiro#  define HASUNSETENV	1
166890792Sgshapiro#  define BSD4_3		1	/* to get signal() in conf.c */
166990792Sgshapiro#  define WAITUNION	1
167090792Sgshapiro#  define LA_TYPE	LA_FLOAT
167190792Sgshapiro#  ifdef _POSIX_VERSION
167290792Sgshapiro#   undef _POSIX_VERSION		/* set in <unistd.h> */
167390792Sgshapiro#  endif /* _POSIX_VERSION */
167490792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
167590792Sgshapiro#  define setpgid	setpgrp
167690792Sgshapiro
167790792Sgshapiro/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
167890792Sgshapiro#  undef	WIFEXITED
167990792Sgshapiro#  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
168090792Sgshapiro			 ((union wait*)&(s))->w_termsig == 0)
168190792Sgshapiro#  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
168290792Sgshapirotypedef int		pid_t;
168390792Sgshapiro#  define isgraph(c)	(isprint(c) && (c != ' '))
168490792Sgshapiro
168590792Sgshapiro#  ifndef IDENTPROTO
168690792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
168790792Sgshapiro#  endif /* ! IDENTPROTO */
168890792Sgshapiro
168990792Sgshapiro#  ifndef _PATH_UNIX
169090792Sgshapiro#   define _PATH_UNIX		"/dynix"
169190792Sgshapiro#  endif /* ! _PATH_UNIX */
169290792Sgshapiro#  ifndef _PATH_VENDOR_CF
169390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
169490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
169590792Sgshapiro# endif /* sequent */
169690792Sgshapiro
169790792Sgshapiro
169890792Sgshapiro/*
169990792Sgshapiro**  Sequent DYNIX/ptx v2.0 (and higher)
170090792Sgshapiro**
170190792Sgshapiro**	For DYNIX/ptx v1.x, undefine HASSETREUID.
170290792Sgshapiro**
170390792Sgshapiro**	From Tim Wright <timw@sequent.com>.
170490792Sgshapiro**	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
170590792Sgshapiro**		for DYNIX/ptx 4.0.2.
170690792Sgshapiro*/
170790792Sgshapiro
170890792Sgshapiro# ifdef _SEQUENT_
170990792Sgshapiro#  include <sys/stream.h>
171090792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
171190792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
171290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
171390792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
171490792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
171590792Sgshapiro#  define GIDSET_T	gid_t
171690792Sgshapiro#  define LA_TYPE	LA_INT
171790792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
171890792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
171990792Sgshapiro#  ifndef IDENTPROTO
172090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
172190792Sgshapiro#  endif /* ! IDENTPROTO */
172290792Sgshapiro#  ifndef _PATH_VENDOR_CF
172390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
172490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
172590792Sgshapiro#  ifndef _PATH_SENDMAILPID
172690792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
172790792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
172890792Sgshapiro# endif /* _SEQUENT_ */
172990792Sgshapiro
173090792Sgshapiro/*
1731132943Sgshapiro**  Cray UNICOS, UNICOS/mk, and UNICOS/mp
173290792Sgshapiro**
1733132943Sgshapiro**    UNICOS:
173490792Sgshapiro**	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
1735132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1736132943Sgshapiro**    UNICOS/mk (Cray T3E):
1737132943Sgshapiro**	Contributed by Manu Mahonen <mailadm@csc.fi>
1738132943Sgshapiro**	of Center for Scientific Computing.
1739132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1740132943Sgshapiro**    UNICOS/mp:
1741132943Sgshapiro**	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
174290792Sgshapiro*/
174390792Sgshapiro
1744132943Sgshapiro# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
174590792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
1746132943Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1747132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) */
1748132943Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
1749132943Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
1750132943Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
1751132943Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
1752132943Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
1753132943Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
1754132943Sgshapiro#  define GIDSET_T	gid_t
175590792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1756132943Sgshapiro#  define SFS_BAVAIL	f_bfree	/* alternate field name */
1757132943Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1758132943Sgshapiro#  ifdef UNICOS
1759132943Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1760132943Sgshapiro#   define LA_TYPE	LA_ZERO
1761132943Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
1762132943Sgshapiro#   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
1763132943Sgshapiro#   ifndef MAXPATHLEN
1764132943Sgshapiro#    define MAXPATHLEN PATHSIZE
1765132943Sgshapiro#   endif /* ! MAXPATHLEN */
1766132943Sgshapiro#   ifndef _PATH_UNIX
1767132943Sgshapiro#    ifdef UNICOSMK
1768132943Sgshapiro#     define _PATH_UNIX		"/unicosmk.ar"
1769132943Sgshapiro#    else
1770132943Sgshapiro#     define _PATH_UNIX		"/unicos"
1771132943Sgshapiro#    endif /* UNICOSMK */
1772132943Sgshapiro#   endif /* ! _PATH_UNIX */
1773132943Sgshapiro#   ifndef _PATH_VENDOR_CF
1774132943Sgshapiro#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1775132943Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
1776132943Sgshapiro#  endif /* UNICOS */
1777132943Sgshapiro#  ifdef _UNICOSMP
1778132943Sgshapiro#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1779132943Sgshapiro    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1780132943Sgshapiro#   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1781132943Sgshapiro#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
1782132943Sgshapiro#   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
1783132943Sgshapiro#   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
1784132943Sgshapiro#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1785132943Sgshapiro#   include <sys/cdefs.h>
1786132943Sgshapiro#   include <paths.h>
1787132943Sgshapiro#   define ARGV_T char *const *
1788132943Sgshapiro#  endif /* _UNICOSMP */
1789132943Sgshapiro# endif /* _CRAY */
179090792Sgshapiro
179190792Sgshapiro/*
179290792Sgshapiro**  Apollo DomainOS
179390792Sgshapiro**
179490792Sgshapiro**  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
179590792Sgshapiro**
179690792Sgshapiro**  15 Jan 1994; updated 2 Aug 1995
179790792Sgshapiro**
179890792Sgshapiro*/
179990792Sgshapiro
180090792Sgshapiro# ifdef apollo
180190792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
180290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(2) call */
180390792Sgshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
180490792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
180590792Sgshapiro#  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
180690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
180790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
180890792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
180990792Sgshapiro#  ifndef _PATH_VENDOR_CF
181090792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
181190792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
181290792Sgshapiro#  ifndef _PATH_SENDMAILPID
181390792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
181490792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
181590792Sgshapiro#  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
181690792Sgshapiro#  undef	 S_IFIFO
181790792Sgshapiro#  define S_IFIFO	0010000
181890792Sgshapiro#  ifndef IDENTPROTO
181990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
182090792Sgshapiro#  endif /* ! IDENTPROTO */
182190792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
182290792Sgshapiro#  if defined(NGROUPS_MAX) && !NGROUPS_MAX
182390792Sgshapiro#   undef NGROUPS_MAX
182490792Sgshapiro#  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
182590792Sgshapiro# endif /* apollo */
182690792Sgshapiro
182790792Sgshapiro/*
182890792Sgshapiro**  MPE-iX
182990792Sgshapiro**
183090792Sgshapiro**	Requires MPE 6.0 or greater.  See sendmail/README for more info.
183190792Sgshapiro**
183290792Sgshapiro**	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
183390792Sgshapiro*/
183490792Sgshapiro
183590792Sgshapiro# ifdef MPE
183690792Sgshapiro
183790792Sgshapiro#  include <sys/sysmacros.h>
183890792Sgshapiro#  include <fcntl.h>
183990792Sgshapiro
184090792Sgshapiro/* Sendmail stuff */
184190792Sgshapiro#  define HASFCHOWN		0	/* lacks fchown() */
184290792Sgshapiro#  define HASGETUSERSHELL	0	/* lacks getusershell() */
184390792Sgshapiro#  ifdef HASNICE
184490792Sgshapiro#   undef  HASNICE
184590792Sgshapiro#  endif /* HASNICE */
184690792Sgshapiro#  define HASNICE		0	/* lacks nice() */
184790792Sgshapiro#  define HASRANDOM		0	/* lacks random() */
184890792Sgshapiro#  ifdef HASRRESVPORT
184990792Sgshapiro#   undef HASRRESVPORT
185090792Sgshapiro#  endif /* HASRRESVPORT */
185190792Sgshapiro#  define HASRRESVPORT		0	/* lacks rresvport() */
185290792Sgshapiro#  define IP_SRCROUTE		0	/* lacks IP source routing fields */
185390792Sgshapiro#  ifdef MATCHGECOS
185490792Sgshapiro#   undef MATCHGECOS
185590792Sgshapiro#  endif /* MATCHGECOS */
185690792Sgshapiro#  define MATCHGECOS		0	/* lacks an initialized GECOS field */
185790792Sgshapiro#  define NEEDFSYNC		1	/* use sendmail's fsync() */
185890792Sgshapiro#  define NEEDLINK		1	/* use sendmail's link() */
185990792Sgshapiro#  define NOFTRUNCATE		1	/* lacks ftruncate() */
186090792Sgshapiro#  define SFS_TYPE		SFS_NONE /* can't determine disk space */
186190792Sgshapiro#  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
186290792Sgshapiro#  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
186390792Sgshapiro#  define USE_ENVIRON		1	/* use environ instead of envp */
186490792Sgshapiro
186590792Sgshapiro/* Missing header stuff */
186690792Sgshapiro#  define AF_UNSPEC		0
186790792Sgshapiro#  define AF_MAX		AF_INET
186890792Sgshapiro#  define IFF_LOOPBACK		0x8
186990792Sgshapiro#  define IN_LOOPBACKNET	127
187090792Sgshapiro#  define MAXNAMLEN		NAME_MAX
187190792Sgshapiro#  define S_IEXEC		S_IXUSR
187290792Sgshapiro#  define S_IREAD		S_IRUSR
187390792Sgshapiro#  define S_IWRITE		S_IWUSR
187490792Sgshapiro
187590792Sgshapiro/* Present header stuff that needs to be missing */
187690792Sgshapiro#  undef NGROUPS_MAX
187790792Sgshapiro
187890792Sgshapiro/* Shadow functions */
187990792Sgshapiro#  define bind		sendmail_mpe_bind
188090792Sgshapiro#  define _exit		sendmail_mpe__exit
188190792Sgshapiro#  define exit		sendmail_mpe_exit
188290792Sgshapiro#  define fcntl		sendmail_mpe_fcntl
188390792Sgshapiro#  define getegid	sendmail_mpe_getegid
188490792Sgshapiro#  define geteuid	sendmail_mpe_geteuid
188590792Sgshapiro#  define getpwnam	sendmail_mpe_getpwnam
188690792Sgshapiro#  define getpwuid	sendmail_mpe_getpwuid
188790792Sgshapiro#  define setgid	sendmail_mpe_setgid
188890792Sgshapiro#  define setuid	sendmail_mpe_setuid
188990792Sgshapiroextern int		sendmail_mpe_fcntl __P((int, int, ...));
189090792Sgshapiroextern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
189190792Sgshapiroextern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
189290792Sgshapiro# endif /* MPE */
189390792Sgshapiro
189490792Sgshapiro/*
189590792Sgshapiro**  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
189690792Sgshapiro**
189790792Sgshapiro**	Contributed by Paul Gampe <paulg@apnic.net>
189890792Sgshapiro*/
189990792Sgshapiro
190090792Sgshapiro# ifdef __svr5__
190190792Sgshapiro#  include <sys/mkdev.h>
190290792Sgshapiro#  define __svr4__
190390792Sgshapiro#  define SYS5SIGNALS		1
190490792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
1905132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
190690792Sgshapiro#  define HASSETREUID		1
190790792Sgshapiro#  define HASWAITPID		1
190890792Sgshapiro#  define HASGETDTABLESIZE	1
190990792Sgshapiro#  define GIDSET_T		gid_t
1910147078Sgshapiro#  define SOCKADDR_LEN_T	size_t
191190792Sgshapiro#  define SOCKOPT_LEN_T		size_t
1912285229Sgshapiro#  define SIGWAIT_TAKES_1_ARG	1
191390792Sgshapiro#  ifndef _PATH_UNIX
191490792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
191590792Sgshapiro#  endif /* ! _PATH_UNIX */
191690792Sgshapiro#  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
191790792Sgshapiro#  ifndef SYSLOG_BUFSIZE
191890792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* unsure */
191990792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
192090792Sgshapiro#  ifndef _PATH_VENDOR_CF
192190792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
192290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
192390792Sgshapiro#  ifndef _PATH_SENDMAILPID
192490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
192590792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
192690792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
192790792Sgshapiro#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
192890792Sgshapiro# define SM_SET_H_ERRNO(err)	set_h_errno((err))
192990792Sgshapiro#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
193090792Sgshapiro# endif /* __svr5__ */
193190792Sgshapiro
193290792Sgshapiro/* ###################################################################### */
193390792Sgshapiro
193490792Sgshapiro/*
193590792Sgshapiro**  UnixWare 2.x
193690792Sgshapiro*/
193790792Sgshapiro
193890792Sgshapiro# ifdef UNIXWARE2
193990792Sgshapiro#  define UNIXWARE	1
194090792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
194190792Sgshapiro# endif /* UNIXWARE2 */
194290792Sgshapiro
194390792Sgshapiro
194490792Sgshapiro/*
194590792Sgshapiro**  UnixWare 1.1.2.
194690792Sgshapiro**
194790792Sgshapiro**	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
194890792Sgshapiro**	From Evan Champion <evanc@spatial.synapse.org>.
194990792Sgshapiro*/
195090792Sgshapiro
195190792Sgshapiro# ifdef UNIXWARE
195290792Sgshapiro#  include <sys/mkdev.h>
195390792Sgshapiro#  define SYSTEM5		1
195490792Sgshapiro#  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
195590792Sgshapiro#  define HASSETREUID		1
1956132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
195790792Sgshapiro#  define HASINITGROUPS		1
195890792Sgshapiro#  define GIDSET_T		gid_t
195990792Sgshapiro#  define SLEEP_T		unsigned
196090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
196190792Sgshapiro#  define LA_TYPE		LA_ZERO
196290792Sgshapiro#  undef WIFEXITED
196390792Sgshapiro#  undef WEXITSTATUS
196490792Sgshapiro#  ifndef _PATH_UNIX
196590792Sgshapiro#   define _PATH_UNIX		"/unix"
196690792Sgshapiro#  endif /* ! _PATH_UNIX */
196790792Sgshapiro#  ifndef _PATH_VENDOR_CF
196890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
196990792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
197090792Sgshapiro#  ifndef _PATH_SENDMAILPID
197190792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
197290792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
197390792Sgshapiro#  define SYSLOG_BUFSIZE	128
197490792Sgshapiro# endif /* UNIXWARE */
197590792Sgshapiro
197690792Sgshapiro
197790792Sgshapiro/*
197890792Sgshapiro**  Intergraph CLIX 3.1
197990792Sgshapiro**
198090792Sgshapiro**	From Paul Southworth <pauls@locust.cic.net>
198190792Sgshapiro*/
198290792Sgshapiro
198390792Sgshapiro# ifdef CLIX
198490792Sgshapiro#  define SYSTEM5	1	/* looks like System V */
198590792Sgshapiro#  ifndef HASGETUSERSHELL
198690792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
198790792Sgshapiro#  endif /* ! HASGETUSERSHELL */
198890792Sgshapiro#  define DEV_BSIZE	512	/* device block size not defined */
198990792Sgshapiro#  define GIDSET_T	gid_t
199090792Sgshapiro#  undef LOG			/* syslog not available */
199190792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
199290792Sgshapiro#  define GETSHORT	_getshort
199390792Sgshapiro# endif /* CLIX */
199490792Sgshapiro
199590792Sgshapiro
199690792Sgshapiro/*
199790792Sgshapiro**  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
199890792Sgshapiro**
199990792Sgshapiro**	From Kevin Darcy <kevin@tech.mis.cfc.com>.
200090792Sgshapiro*/
200190792Sgshapiro
200290792Sgshapiro# ifdef NCR_MP_RAS2
200390792Sgshapiro#  include <sys/sockio.h>
200490792Sgshapiro#  define __svr4__
200590792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
200690792Sgshapiro#  define SYSLOG_BUFSIZE	1024
200790792Sgshapiro#  define SPT_TYPE  SPT_NONE
200890792Sgshapiro# endif /* NCR_MP_RAS2 */
200990792Sgshapiro
201090792Sgshapiro
201190792Sgshapiro/*
201290792Sgshapiro**  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
201390792Sgshapiro**
201490792Sgshapiro**	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
201590792Sgshapiro*/
201690792Sgshapiro
201790792Sgshapiro# ifdef NCR_MP_RAS3
201890792Sgshapiro#  define __svr4__
201990792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
202090792Sgshapiro#  define LDA_USE_LOCKF		1
202190792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
202290792Sgshapiro#  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
202390792Sgshapiro#  define SYSLOG_BUFSIZE	1024
202490792Sgshapiro#  define SPT_TYPE	SPT_NONE
202590792Sgshapiro#  define _PATH_MAILDIR	"/var/mail"
202690792Sgshapiro#  ifndef _XOPEN_SOURCE
202790792Sgshapiro#   define _XOPEN_SOURCE
202890792Sgshapiro#   define _XOPEN_SOURCE_EXTENDED 1
202990792Sgshapiro#   include <sys/resource.h>
203090792Sgshapiro#   undef _XOPEN_SOURCE
203190792Sgshapiro#   undef _XOPEN_SOURCE_EXTENDED
203290792Sgshapiro#  endif /* ! _XOPEN_SOURCE */
203390792Sgshapiro# endif /* NCR_MP_RAS3 */
203490792Sgshapiro
203590792Sgshapiro
203690792Sgshapiro/*
203790792Sgshapiro**  Tandem NonStop-UX SVR4
203890792Sgshapiro**
203990792Sgshapiro**	From Rick McCarty <mccarty@mpd.tandem.com>.
204090792Sgshapiro*/
204190792Sgshapiro
204290792Sgshapiro# ifdef NonStop_UX_BXX
204390792Sgshapiro#  define __svr4__
204490792Sgshapiro# endif /* NonStop_UX_BXX */
204590792Sgshapiro
204690792Sgshapiro
204790792Sgshapiro/*
204890792Sgshapiro**  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
204990792Sgshapiro**
205090792Sgshapiro**	Tested for 1.04, 1.03
205190792Sgshapiro**	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
205290792Sgshapiro**
205390792Sgshapiro**	Tested for 4.02, 6.10 and 7.10
205490792Sgshapiro**	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
205590792Sgshapiro*/
205690792Sgshapiro
205790792Sgshapiro# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
205890792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
205990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
206090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
206190792Sgshapiro#  define setreuid(r, e)	setresuid(r, e, -1)
206290792Sgshapiro#  define LA_TYPE	LA_FLOAT
206390792Sgshapiro#  define SPT_TYPE	SPT_PSTAT
206490792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
206590792Sgshapiro#  ifndef HASSETVBUF
206690792Sgshapiro#   define HASSETVBUF	/* HI-UX has no setlinebuf */
206790792Sgshapiro#  endif /* ! HASSETVBUF */
206890792Sgshapiro#  ifndef GIDSET_T
206990792Sgshapiro#   define GIDSET_T	gid_t
207090792Sgshapiro#  endif /* ! GIDSET_T */
207190792Sgshapiro#  ifndef _PATH_UNIX
207290792Sgshapiro#   define _PATH_UNIX		"/HI-UX"
207390792Sgshapiro#  endif /* ! _PATH_UNIX */
207490792Sgshapiro#  ifndef _PATH_VENDOR_CF
207590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
207690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
207790792Sgshapiro#  ifndef IDENTPROTO
207890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
207990792Sgshapiro#  endif /* ! IDENTPROTO */
208090792Sgshapiro#  ifndef HASGETUSERSHELL
208190792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
208290792Sgshapiro#  endif /* ! HASGETUSERSHELL */
208390792Sgshapiro#  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
208490792Sgshapiro
208590792Sgshapiro/*
208690792Sgshapiro**  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
208790792Sgshapiro**  on HIUX 3050
208890792Sgshapiro*/
208990792Sgshapiro#  undef m_flags
209090792Sgshapiro
209190792Sgshapiro#  define SM_CONF_SYSLOG	0
209290792Sgshapiro
209390792Sgshapiro# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
209490792Sgshapiro
209590792Sgshapiro
209690792Sgshapiro/*
209790792Sgshapiro**  Amdahl UTS System V 2.1.5 (SVr3-based)
209890792Sgshapiro**
209990792Sgshapiro**    From: Janet Jackson <janet@dialix.oz.au>.
210090792Sgshapiro*/
210190792Sgshapiro
210290792Sgshapiro# ifdef _UTS
210390792Sgshapiro#  include <sys/sysmacros.h>
210490792Sgshapiro#  undef HASLSTAT		/* has symlinks, but they cause problems */
210590792Sgshapiro#  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
210690792Sgshapiro#  define SYS5SIGNALS	1	/* System V signal semantics */
210790792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
210890792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
210990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) function */
211090792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) function */
211190792Sgshapiro#  ifndef HASGETUSERSHELL
211290792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
211390792Sgshapiro#  endif /* ! HASGETUSERSHELL */
211490792Sgshapiro#  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
211590792Sgshapiro#  define LA_TYPE	LA_ZERO		/* doesn't have load average */
211690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
211790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
211890792Sgshapiro#  define _PATH_UNIX		"/unix"
211990792Sgshapiro#  ifndef _PATH_VENDOR_CF
212090792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
212190792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
212290792Sgshapiro# endif /* _UTS */
212390792Sgshapiro
212490792Sgshapiro/*
212590792Sgshapiro**  Cray Computer Corporation's CSOS
212690792Sgshapiro**
212790792Sgshapiro**	From Scott Bolte <scott@craycos.com>.
212890792Sgshapiro*/
212990792Sgshapiro
213090792Sgshapiro# ifdef _CRAYCOM
213190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
213290792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
213390792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
213490792Sgshapiro#  define MAXPATHLEN	PATHSIZE
213590792Sgshapiro#  define LA_TYPE	LA_ZERO
213690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
213790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
213890792Sgshapiro#  define _POSIX_CHOWN_RESTRICTED	-1
213990792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
214090792Sgshapiro# endif /* _CRAYCOM */
214190792Sgshapiro
214290792Sgshapiro
214390792Sgshapiro/*
214490792Sgshapiro**  Sony NEWS-OS 4.2.1R and 6.0.3
214590792Sgshapiro**
214690792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
214790792Sgshapiro*/
214890792Sgshapiro
214990792Sgshapiro# ifdef sony_news
215090792Sgshapiro#  ifndef __svr4
215190792Sgshapiro			/* NEWS-OS 4.2.1R */
215290792Sgshapiro#   ifndef BSD
215390792Sgshapiro#    define BSD			/* has BSD routines */
215490792Sgshapiro#   endif /* ! BSD */
215590792Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(2) call */
215690792Sgshapiro#   undef HASSETVBUF		/* don't actually have setvbuf(3) */
215790792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
215890792Sgshapiro#   define LA_TYPE	LA_INT
215990792Sgshapiro#   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
216090792Sgshapiro#   ifndef HASFLOCK
216190792Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
216290792Sgshapiro#   endif /* ! HASFLOCK */
216390792Sgshapiro#   define setpgid	setpgrp
216490792Sgshapiro#   undef WIFEXITED
216590792Sgshapiro#   undef WEXITSTATUS
216690792Sgshapiro#   define MODE_T	int	/* system include files have no mode_t */
216790792Sgshapirotypedef int		pid_t;
216890792Sgshapirotypedef int		(*sigfunc_t)();
216990792Sgshapiro#   define SIGFUNC_DEFINED
217090792Sgshapiro#   define SIGFUNC_RETURN	(0)
217190792Sgshapiro#   define SIGFUNC_DECL		int
217290792Sgshapiro
217390792Sgshapiro#  else /* ! __svr4 */
217490792Sgshapiro			/* NEWS-OS 6.0.3 with /bin/cc */
217590792Sgshapiro#   ifndef __svr4__
217690792Sgshapiro#    define __svr4__		/* use all System V Release 4 defines below */
217790792Sgshapiro#   endif /* ! __svr4__ */
2178132943Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
217990792Sgshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
218090792Sgshapiro#   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
218190792Sgshapiro#   ifndef SPT_TYPE
218290792Sgshapiro#    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
218390792Sgshapiro#   endif /* ! SPT_TYPE */
218490792Sgshapiro#   define GIDSET_T	gid_t
218590792Sgshapiro#   undef WIFEXITED
218690792Sgshapiro#   undef WEXITSTATUS
218790792Sgshapiro#   ifndef SYSLOG_BUFSIZE
218890792Sgshapiro#    define SYSLOG_BUFSIZE	256
218990792Sgshapiro#   endif /* ! SYSLOG_BUFSIZE */
219090792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
219190792Sgshapiro#   ifndef _PATH_VENDOR_CF
219290792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
219390792Sgshapiro#   endif /* ! _PATH_VENDOR_CF */
219490792Sgshapiro#   ifndef _PATH_SENDMAILPID
219590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
219690792Sgshapiro#   endif /* ! _PATH_SENDMAILPID */
219790792Sgshapiro
219890792Sgshapiro#  endif /* ! __svr4 */
219990792Sgshapiro# endif /* sony_news */
220090792Sgshapiro
220190792Sgshapiro
220290792Sgshapiro/*
220390792Sgshapiro**  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
220490792Sgshapiro**
220590792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
220690792Sgshapiro*/
220790792Sgshapiro
220890792Sgshapiro# ifdef luna
220990792Sgshapiro#  ifndef IDENTPROTO
221090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
221190792Sgshapiro#  endif /* ! IDENTPROTO */
221290792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(2) call */
221390792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
221490792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
221590792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
221690792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
221790792Sgshapiro#  ifdef uniosb
221890792Sgshapiro#   include <sys/time.h>
221990792Sgshapiro#   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
222090792Sgshapiro#   define LA_TYPE	LA_INT
222190792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
222290792Sgshapiro#  endif /* uniosb */
222390792Sgshapiro#  ifdef luna2
222490792Sgshapiro#   define LA_TYPE	LA_SUBR
222590792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
222690792Sgshapiro#  endif /* luna2 */
222790792Sgshapiro#  ifdef luna88k
222890792Sgshapiro#   define LA_TYPE	LA_INT
222990792Sgshapiro#  endif /* luna88k */
223090792Sgshapiro#  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
223190792Sgshapiro#  define setpgid	setpgrp
223290792Sgshapiro#  undef WIFEXITED
223390792Sgshapiro#  undef WEXITSTATUS
223490792Sgshapirotypedef int		pid_t;
223590792Sgshapirotypedef int		(*sigfunc_t)();
223690792Sgshapiro#  define SIGFUNC_DEFINED
223790792Sgshapiro#  define SIGFUNC_RETURN	(0)
223890792Sgshapiro#  define SIGFUNC_DECL	int
223990792Sgshapiroextern char	*getenv();
224090792Sgshapiro#  ifndef _PATH_VENDOR_CF
224190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
224290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
224390792Sgshapiro# endif /* luna */
224490792Sgshapiro
224590792Sgshapiro
224690792Sgshapiro/*
224790792Sgshapiro**  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
224890792Sgshapiro**
224990792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
225090792Sgshapiro*/
225190792Sgshapiro
225290792Sgshapiro# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
225390792Sgshapiro#  ifndef __svr4__
225490792Sgshapiro#   define __svr4__		/* use all System V Release 4 defines below */
225590792Sgshapiro#  endif /* ! __svr4__ */
225690792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2257132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
225890792Sgshapiro#  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
225990792Sgshapiro#  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
226090792Sgshapiro#  define GIDSET_T	gid_t
226190792Sgshapiro#  undef WIFEXITED
226290792Sgshapiro#  undef WEXITSTATUS
226390792Sgshapiro#  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
226490792Sgshapiro#  ifndef _PATH_VENDOR_CF
226590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
226690792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
226790792Sgshapiro#  ifndef _PATH_SENDMAILPID
226890792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
226990792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
227090792Sgshapiro#  ifndef SYSLOG_BUFSIZE
227190792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
227290792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
227390792Sgshapiro# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
227490792Sgshapiro
227590792Sgshapiro
227690792Sgshapiro/*
227790792Sgshapiro**  Fujitsu/ICL UXP/DS (For the DS/90 Series)
227890792Sgshapiro**
227990792Sgshapiro**	From Diego R. Lopez <drlopez@cica.es>.
228090792Sgshapiro**	Additional changes from Fumio Moriya and Toshiaki Nomura of the
228190792Sgshapiro**		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
228290792Sgshapiro*/
228390792Sgshapiro
228490792Sgshapiro# ifdef __uxp__
228590792Sgshapiro#  include <arpa/nameser.h>
228690792Sgshapiro#  include <sys/sysmacros.h>
228790792Sgshapiro#  include <sys/mkdev.h>
228890792Sgshapiro#  define __svr4__
228990792Sgshapiro#  define HASGETUSERSHELL	0
229090792Sgshapiro#  define HASFLOCK		0
229190792Sgshapiro#  define _PATH_UNIX		"/stand/unix"
229290792Sgshapiro#  ifndef _PATH_VENDOR_CF
229390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
229490792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
229590792Sgshapiro#  ifndef _PATH_SENDMAILPID
229690792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
229790792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
229890792Sgshapiro# endif /* __uxp__ */
229990792Sgshapiro
230090792Sgshapiro/*
230190792Sgshapiro**  Pyramid DC/OSx
230290792Sgshapiro**
230390792Sgshapiro**	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
230490792Sgshapiro*/
230590792Sgshapiro
230690792Sgshapiro# ifdef DCOSx
230790792Sgshapiro#  define GIDSET_T	gid_t
230890792Sgshapiro#  ifndef IDENTPROTO
230990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
231090792Sgshapiro#  endif /* ! IDENTPROTO */
231190792Sgshapiro# endif /* DCOSx */
231290792Sgshapiro
231390792Sgshapiro/*
231490792Sgshapiro**  Concurrent Computer Corporation Maxion
231590792Sgshapiro**
231690792Sgshapiro**	From Donald R. Laster Jr. <laster@access.digex.net>.
231790792Sgshapiro*/
231890792Sgshapiro
231990792Sgshapiro# ifdef __MAXION__
232090792Sgshapiro
232190792Sgshapiro#  include <sys/stream.h>
232290792Sgshapiro#  define __svr4__		1	/* SVR4.2MP */
232390792Sgshapiro#  define HASSETREUID		1	/* have setreuid(2) */
232490792Sgshapiro#  define HASLSTAT		1	/* have lstat(2) */
232590792Sgshapiro#  define HASSETRLIMIT		1	/* have setrlimit(2) */
232690792Sgshapiro#  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
232790792Sgshapiro#  define HASGETUSERSHELL	1	/* have getusershell(3) */
232890792Sgshapiro#  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
232990792Sgshapiro#  define SLEEP_T		unsigned
233090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
233190792Sgshapiro#  define SFS_BAVAIL		f_bavail
233290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
233390792Sgshapiro#   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
233490792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
233590792Sgshapiro
233690792Sgshapiro#  undef WUNTRACED
233790792Sgshapiro#  undef WIFEXITED
233890792Sgshapiro#  undef WIFSIGNALED
233990792Sgshapiro#  undef WIFSTOPPED
234090792Sgshapiro#  undef WEXITSTATUS
234190792Sgshapiro#  undef WTERMSIG
234290792Sgshapiro#  undef WSTOPSIG
234390792Sgshapiro
234490792Sgshapiro# endif /* __MAXION__ */
234590792Sgshapiro
234690792Sgshapiro/*
234790792Sgshapiro**  Harris Nighthawk PowerUX (nh6000 box)
234890792Sgshapiro**
234990792Sgshapiro**  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
235090792Sgshapiro*/
235190792Sgshapiro
235290792Sgshapiro# ifdef _PowerUX
235390792Sgshapiro#  ifndef __svr4__
235490792Sgshapiro#   define __svr4__
235590792Sgshapiro#  endif /* ! __svr4__ */
235690792Sgshapiro#  ifndef _PATH_VENDOR_CF
235790792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
235890792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
235990792Sgshapiro#  ifndef _PATH_SENDMAILPID
236090792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
236190792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
236290792Sgshapiro#  define SYSLOG_BUFSIZE		1024
236390792Sgshapiro#  define LA_TYPE		LA_ZERO
236490792Sgshapirotypedef struct msgb		mblk_t;
236590792Sgshapiro#  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
236690792Sgshapiro# endif /* _PowerUX */
236790792Sgshapiro
236890792Sgshapiro/*
236990792Sgshapiro**  Siemens Nixdorf Informationssysteme AG SINIX
237090792Sgshapiro**
237190792Sgshapiro**	Contributed by Gerald Rinske of Siemens Business Services VAS.
237290792Sgshapiro*/
237390792Sgshapiro# ifdef sinix
237490792Sgshapiro#  define HASRANDOM		0	/* has random(3) */
237590792Sgshapiro#  define SYSLOG_BUFSIZE	1024
237690792Sgshapiro#  define SM_INT32		int	/* 32bit integer */
237790792Sgshapiro# endif /* sinix */
237890792Sgshapiro
237990792Sgshapiro
238090792Sgshapiro/*
238190792Sgshapiro**  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
238290792Sgshapiro**
238390792Sgshapiro**	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
238490792Sgshapiro*/
238590792Sgshapiro
238690792Sgshapiro# ifdef MOTO
238790792Sgshapiro#  define HASFCHMOD		1
238890792Sgshapiro#  define HASSETRLIMIT		0
2389132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
239090792Sgshapiro#  define HASSETREUID		1
239190792Sgshapiro#  define HASULIMIT		1
239290792Sgshapiro#  define HASWAITPID		1
239390792Sgshapiro#  define HASGETDTABLESIZE	1
239490792Sgshapiro#  define HASGETUSERSHELL	1
239590792Sgshapiro#  define IP_SRCROUTE		0
239690792Sgshapiro#  define IDENTPROTO		0
239790792Sgshapiro#  define RES_DNSRCH_VARIABLE	_res_dnsrch
239890792Sgshapiro#  define _PATH_UNIX		"/unix"
239990792Sgshapiro#  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
240090792Sgshapiro#  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
240190792Sgshapiro# endif /* MOTO */
240290792Sgshapiro
2403110560Sgshapiro/*
2404110560Sgshapiro**  Interix
2405110560Sgshapiro**	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2406110560Sgshapiro**
2407110560Sgshapiro**	Used for Interix support.
2408110560Sgshapiro*/
240990792Sgshapiro
2410110560Sgshapiro# if defined(__INTERIX)
2411110560Sgshapiro#  define HASURANDOMDEV		1
2412110560Sgshapiro#  define HASGETUSERSHELL	0
2413110560Sgshapiro#  define HASSTRERROR		1
2414110560Sgshapiro#  define HASUNSETENV		1
2415110560Sgshapiro#  define HASFCHOWN		1
2416110560Sgshapiro#  undef HAVE_SYS_ERRLIST
2417110560Sgshapiro#  define sys_errlist		__sys_errlist
2418110560Sgshapiro#  define sys_nerr		__sys_nerr
2419132943Sgshapiro#  include <sys/mkdev.h>
2420132943Sgshapiro#  ifndef major
2421132943Sgshapiro#   define major(dev)		((int)(((dev) >> 8) & 0xff))
2422132943Sgshapiro#  endif /* ! major */
2423132943Sgshapiro#  ifndef minor
2424132943Sgshapiro#   define minor(dev)		((int)((dev) & 0xff))
2425132943Sgshapiro#  endif /* ! minor */
2426110560Sgshapiro# endif /* defined(__INTERIX) */
2427110560Sgshapiro
2428110560Sgshapiro
242990792Sgshapiro/**********************************************************************
243090792Sgshapiro**  End of Per-Operating System defines
243190792Sgshapiro**********************************************************************/
243290792Sgshapiro/**********************************************************************
243390792Sgshapiro**  More general defines
243490792Sgshapiro**********************************************************************/
243590792Sgshapiro
243690792Sgshapiro/* general BSD defines */
243790792Sgshapiro# ifdef BSD
243890792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
243990792Sgshapiro#  ifndef HASSETREUID
244090792Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
244190792Sgshapiro#  endif /* ! HASSETREUID */
244290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
244390792Sgshapiro#  ifndef IP_SRCROUTE
244490792Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
244590792Sgshapiro#  endif /* ! IP_SRCROUTE */
244690792Sgshapiro#  ifndef HASSETRLIMIT
244790792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
244890792Sgshapiro#  endif /* ! HASSETRLIMIT */
244990792Sgshapiro#  ifndef HASFLOCK
245090792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
245190792Sgshapiro#  endif /* ! HASFLOCK */
245290792Sgshapiro#  ifndef TZ_TYPE
245390792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
245490792Sgshapiro#  endif /* ! TZ_TYPE */
245590792Sgshapiro# endif /* BSD */
245690792Sgshapiro
245790792Sgshapiro/* general System V Release 4 defines */
245890792Sgshapiro# ifdef __svr4__
245990792Sgshapiro#  define SYSTEM5	1
246090792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
246190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
246290792Sgshapiro#  define BSD_COMP	1	/* get BSD ioctl calls */
246390792Sgshapiro#  ifndef HASSETRLIMIT
246490792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
246590792Sgshapiro#  endif /* ! HASSETRLIMIT */
246690792Sgshapiro#  ifndef HASGETUSERSHELL
246790792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
246890792Sgshapiro#  endif /* ! HASGETUSERSHELL */
246990792Sgshapiro#  ifndef HASFCHMOD
247090792Sgshapiro#   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
247190792Sgshapiro#  endif /* ! HASFCHMOD */
247290792Sgshapiro
247390792Sgshapiro#  ifndef _PATH_UNIX
247490792Sgshapiro#   define _PATH_UNIX		"/unix"
247590792Sgshapiro#  endif /* ! _PATH_UNIX */
247690792Sgshapiro#  ifndef _PATH_VENDOR_CF
247790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
247890792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
247990792Sgshapiro#  ifndef _PATH_SENDMAILPID
248090792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
248190792Sgshapiro#  endif /* ! _PATH_SENDMAILPID */
248290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
248390792Sgshapiro#   define SYSLOG_BUFSIZE	128
248490792Sgshapiro#  endif /* ! SYSLOG_BUFSIZE */
248590792Sgshapiro#  ifndef SFS_TYPE
248690792Sgshapiro#   define SFS_TYPE		SFS_STATVFS
248790792Sgshapiro#  endif /* ! SFS_TYPE */
248890792Sgshapiro
248990792Sgshapiro#  ifndef USE_SIGLONGJMP
249090792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
249190792Sgshapiro#  endif /* ! USE_SIGLONGJMP */
249290792Sgshapiro# endif /* __svr4__ */
249390792Sgshapiro
249490792Sgshapiro# ifdef __SVR4
249590792Sgshapiro#  define LDA_USE_LOCKF		1
249690792Sgshapiro#  define LDA_USE_SETEUID	1
249790792Sgshapiro#  define _PATH_MAILDIR		"/var/mail"
249890792Sgshapiro# endif /* __SVR4 */
249990792Sgshapiro
250090792Sgshapiro/* general System V defines */
250190792Sgshapiro# ifdef SYSTEM5
250290792Sgshapiro#  include <sys/sysmacros.h>
250390792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
250490792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
250590792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
250690792Sgshapiro#  ifndef HASULIMIT
250790792Sgshapiro#   define HASULIMIT	1	/* has the ulimit(2) syscall */
250890792Sgshapiro#  endif /* ! HASULIMIT */
250990792Sgshapiro#  ifndef LA_TYPE
251090792Sgshapiro#   ifdef MIOC_READKSYM
251190792Sgshapiro#    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
251290792Sgshapiro#   else /* MIOC_READKSYM */
251390792Sgshapiro#    define LA_TYPE	LA_INT		/* assume integer load average */
251490792Sgshapiro#   endif /* MIOC_READKSYM */
251590792Sgshapiro#  endif /* ! LA_TYPE */
251690792Sgshapiro#  ifndef SFS_TYPE
251790792Sgshapiro#   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
251890792Sgshapiro#  endif /* ! SFS_TYPE */
251990792Sgshapiro#  ifndef TZ_TYPE
252090792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
252190792Sgshapiro#  endif /* ! TZ_TYPE */
252290792Sgshapiro# endif /* SYSTEM5 */
252390792Sgshapiro
252490792Sgshapiro/* general POSIX defines */
252590792Sgshapiro# ifdef _POSIX_VERSION
2526132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
2527132943Sgshapiro#  define HASWAITPID	1	/* has POSIX waitpid(2) call */
252890792Sgshapiro#  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
252990792Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
253090792Sgshapiro#  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
253190792Sgshapiro# endif /* _POSIX_VERSION */
253290792Sgshapiro/*
253390792Sgshapiro**  Tweaking for systems that (for example) claim to be BSD or POSIX
253490792Sgshapiro**  but don't have all the standard BSD or POSIX routines (boo hiss).
253590792Sgshapiro*/
253690792Sgshapiro
253790792Sgshapiro# ifdef titan
253890792Sgshapiro#  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
253990792Sgshapiro# endif /* titan */
254090792Sgshapiro
254190792Sgshapiro# ifdef _CRAYCOM
254290792Sgshapiro#  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
254390792Sgshapiro# endif /* _CRAYCOM */
254490792Sgshapiro
254590792Sgshapiro# ifdef MOTO
254690792Sgshapiro#  undef USESETEUID
254790792Sgshapiro# endif /* MOTO */
254890792Sgshapiro
254990792Sgshapiro/*
255090792Sgshapiro**  Due to a "feature" in some operating systems such as Ultrix 4.3 and
255190792Sgshapiro**  HPUX 8.0, if you receive a "No route to host" message (ICMP message
255290792Sgshapiro**  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
255390792Sgshapiro**  are closed.  Some firewalls return this error if you try to connect
255490792Sgshapiro**  to the IDENT port (113), so you can't receive email from these hosts
255590792Sgshapiro**  on these systems.  The firewall really should use a more specific
255690792Sgshapiro**  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
255790792Sgshapiro**  not explicitly set to zero above, default it on.
255890792Sgshapiro*/
255990792Sgshapiro
256090792Sgshapiro# ifndef IDENTPROTO
256190792Sgshapiro#  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
256290792Sgshapiro# endif /* ! IDENTPROTO */
256390792Sgshapiro
256490792Sgshapiro# ifndef IP_SRCROUTE
256590792Sgshapiro#  define IP_SRCROUTE	1	/* Detect IP source routing */
256690792Sgshapiro# endif /* ! IP_SRCROUTE */
256790792Sgshapiro
256890792Sgshapiro# ifndef HASGETUSERSHELL
256990792Sgshapiro#  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
257090792Sgshapiro# endif /* ! HASGETUSERSHELL */
257190792Sgshapiro
257290792Sgshapiro# ifndef NETUNIX
257390792Sgshapiro#  define NETUNIX	1	/* include unix domain support */
257490792Sgshapiro# endif /* ! NETUNIX */
257590792Sgshapiro
257690792Sgshapiro# ifndef HASRANDOM
257790792Sgshapiro#  define HASRANDOM	1	/* has random(3) support */
257890792Sgshapiro# endif /* ! HASRANDOM */
257990792Sgshapiro
258090792Sgshapiro# ifndef HASFLOCK
258190792Sgshapiro#  define HASFLOCK	0	/* assume no flock(2) support */
258290792Sgshapiro# endif /* ! HASFLOCK */
258390792Sgshapiro
258490792Sgshapiro# ifndef HASSETREUID
258590792Sgshapiro#  define HASSETREUID	0	/* assume no setreuid(2) call */
258690792Sgshapiro# endif /* ! HASSETREUID */
258790792Sgshapiro
258890792Sgshapiro# ifndef HASFCHMOD
258990792Sgshapiro#  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
259090792Sgshapiro# endif /* ! HASFCHMOD */
259190792Sgshapiro
259290792Sgshapiro# ifndef USESETEUID
259390792Sgshapiro#  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
259490792Sgshapiro# endif /* ! USESETEUID */
259590792Sgshapiro
259690792Sgshapiro# ifndef HASSETRLIMIT
259790792Sgshapiro#  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
259890792Sgshapiro# endif /* ! HASSETRLIMIT */
259990792Sgshapiro
260090792Sgshapiro# ifndef HASULIMIT
260190792Sgshapiro#  define HASULIMIT	0	/* assume no ulimit(2) support */
260290792Sgshapiro# endif /* ! HASULIMIT */
260390792Sgshapiro
260490792Sgshapiro# ifndef SECUREWARE
260590792Sgshapiro#  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
260690792Sgshapiro# endif /* ! SECUREWARE */
260790792Sgshapiro
260890792Sgshapiro# ifndef USE_DOUBLE_FORK
260990792Sgshapiro#  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
261090792Sgshapiro# endif /* ! USE_DOUBLE_FORK */
261190792Sgshapiro
261290792Sgshapiro# ifndef USE_ENVIRON
261390792Sgshapiro#  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
261490792Sgshapiro# endif /* ! USE_ENVIRON */
261590792Sgshapiro
261690792Sgshapiro# ifndef USE_SIGLONGJMP
261790792Sgshapiro#  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
261890792Sgshapiro# endif /* ! USE_SIGLONGJMP */
261990792Sgshapiro
262090792Sgshapiro# ifndef FDSET_CAST
262190792Sgshapiro#  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
262290792Sgshapiro# endif /* ! FDSET_CAST */
262390792Sgshapiro
262490792Sgshapiro/*
262590792Sgshapiro**  Pick a mailer setuid method for changing the current uid
262690792Sgshapiro*/
262790792Sgshapiro
262890792Sgshapiro# define USE_SETEUID	0
262990792Sgshapiro# define USE_SETREUID	1
263090792Sgshapiro# define USE_SETUID	2
263190792Sgshapiro
263290792Sgshapiro# if USESETEUID
263390792Sgshapiro#  define MAILER_SETUID_METHOD	USE_SETEUID
263490792Sgshapiro# else /* USESETEUID */
263590792Sgshapiro#  if HASSETREUID
263690792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETREUID
263790792Sgshapiro#  else /* HASSETREUID */
263890792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETUID
263990792Sgshapiro#  endif /* HASSETREUID */
264090792Sgshapiro# endif /* USESETEUID */
264190792Sgshapiro
264290792Sgshapiro/*
264390792Sgshapiro**  If no type for argument two of getgroups call is defined, assume
264490792Sgshapiro**  it's an integer -- unfortunately, there seem to be several choices
264590792Sgshapiro**  here.
264690792Sgshapiro*/
264790792Sgshapiro
264890792Sgshapiro# ifndef GIDSET_T
264990792Sgshapiro#  define GIDSET_T	int
265090792Sgshapiro# endif /* ! GIDSET_T */
265190792Sgshapiro
265290792Sgshapiro# ifndef UID_T
265390792Sgshapiro#  define UID_T		uid_t
265490792Sgshapiro# endif /* ! UID_T */
265590792Sgshapiro
265690792Sgshapiro# ifndef GID_T
265790792Sgshapiro#  define GID_T		gid_t
265890792Sgshapiro# endif /* ! GID_T */
265990792Sgshapiro
266090792Sgshapiro# ifndef MODE_T
266190792Sgshapiro#  define MODE_T		mode_t
266290792Sgshapiro# endif /* ! MODE_T */
266390792Sgshapiro
266490792Sgshapiro# ifndef ARGV_T
266590792Sgshapiro#  define ARGV_T		char **
266690792Sgshapiro# endif /* ! ARGV_T */
266790792Sgshapiro
266890792Sgshapiro# ifndef SOCKADDR_LEN_T
266990792Sgshapiro#  define SOCKADDR_LEN_T	int
267090792Sgshapiro# endif /* ! SOCKADDR_LEN_T */
267190792Sgshapiro
267290792Sgshapiro# ifndef SOCKOPT_LEN_T
267390792Sgshapiro#  define SOCKOPT_LEN_T	int
267490792Sgshapiro# endif /* ! SOCKOPT_LEN_T */
267590792Sgshapiro
267690792Sgshapiro# ifndef QUAD_T
267790792Sgshapiro#  define QUAD_T	unsigned long
267890792Sgshapiro# endif /* ! QUAD_T */
267990792Sgshapiro/**********************************************************************
268090792Sgshapiro**  Remaining definitions should never have to be changed.  They are
268190792Sgshapiro**  primarily to provide back compatibility for older systems -- for
268290792Sgshapiro**  example, it includes some POSIX compatibility definitions
268390792Sgshapiro**********************************************************************/
268490792Sgshapiro
268590792Sgshapiro/* System 5 compatibility */
268690792Sgshapiro# ifndef S_ISREG
268790792Sgshapiro#  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
268890792Sgshapiro# endif /* ! S_ISREG */
268990792Sgshapiro# ifndef S_ISDIR
269090792Sgshapiro#  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
269190792Sgshapiro# endif /* ! S_ISDIR */
269290792Sgshapiro# if !defined(S_ISLNK) && defined(S_IFLNK)
269390792Sgshapiro#  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
269490792Sgshapiro# endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
269590792Sgshapiro# if !defined(S_ISFIFO)
269690792Sgshapiro#  if defined(S_IFIFO)
269790792Sgshapiro#   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
269890792Sgshapiro#  else /* defined(S_IFIFO) */
269990792Sgshapiro#   define S_ISFIFO(foo)	false
270090792Sgshapiro#  endif /* defined(S_IFIFO) */
270190792Sgshapiro# endif /* !defined(S_ISFIFO) */
270290792Sgshapiro# ifndef S_IRUSR
270390792Sgshapiro#  define S_IRUSR		0400
270490792Sgshapiro# endif /* ! S_IRUSR */
270590792Sgshapiro# ifndef S_IWUSR
270690792Sgshapiro#  define S_IWUSR		0200
270790792Sgshapiro# endif /* ! S_IWUSR */
270890792Sgshapiro# ifndef S_IRGRP
270990792Sgshapiro#  define S_IRGRP		0040
271090792Sgshapiro# endif /* ! S_IRGRP */
271190792Sgshapiro# ifndef S_IWGRP
271290792Sgshapiro#  define S_IWGRP		0020
271390792Sgshapiro# endif /* ! S_IWGRP */
271490792Sgshapiro# ifndef S_IROTH
271590792Sgshapiro#  define S_IROTH		0004
271690792Sgshapiro# endif /* ! S_IROTH */
271790792Sgshapiro# ifndef S_IWOTH
271890792Sgshapiro#  define S_IWOTH		0002
271990792Sgshapiro# endif /* ! S_IWOTH */
272090792Sgshapiro
272190792Sgshapiro/* close-on-exec flag */
272290792Sgshapiro# ifndef FD_CLOEXEC
272390792Sgshapiro#  define FD_CLOEXEC	1
272490792Sgshapiro# endif /* ! FD_CLOEXEC */
272590792Sgshapiro
272690792Sgshapiro/*
272790792Sgshapiro**  Older systems don't have this error code -- it should be in
272890792Sgshapiro**  /usr/include/sysexits.h.
272990792Sgshapiro*/
273090792Sgshapiro
273190792Sgshapiro# ifndef EX_CONFIG
273290792Sgshapiro#  define EX_CONFIG	78	/* configuration error */
273390792Sgshapiro# endif /* ! EX_CONFIG */
273490792Sgshapiro
273590792Sgshapiro/* pseudo-codes */
2736120256Sgshapiro# define EX_QUIT	22	/* drop out of server immediately */
273790792Sgshapiro# define EX_RESTART	23	/* restart sendmail daemon */
273890792Sgshapiro# define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
273990792Sgshapiro
274090792Sgshapiro#ifndef EX_NOTFOUND
274190792Sgshapiro# define EX_NOTFOUND	EX_NOHOST
274290792Sgshapiro#endif /* ! EX_NOTFOUND */
274390792Sgshapiro
274490792Sgshapiro/* pseudo-code used for mci_setstat */
2745132943Sgshapiro# define EX_NOTSTICKY	(-5)	/* don't save persistent status */
274690792Sgshapiro
274790792Sgshapiro
274890792Sgshapiro/*
274990792Sgshapiro**  An "impossible" file mode to indicate that the file does not exist.
275090792Sgshapiro*/
275190792Sgshapiro
275290792Sgshapiro# define ST_MODE_NOFILE	0171147		/* unlikely to occur */
275390792Sgshapiro
275490792Sgshapiro
275590792Sgshapiro/* type of arbitrary pointer */
275690792Sgshapiro# ifndef ARBPTR_T
275790792Sgshapiro#  define ARBPTR_T	void *
275890792Sgshapiro# endif /* ! ARBPTR_T */
275990792Sgshapiro
276090792Sgshapiro# ifndef __P
276190792Sgshapiro#  include "sm/cdefs.h"
276290792Sgshapiro# endif /* ! __P */
276390792Sgshapiro
276490792Sgshapiro# if HESIOD && !defined(NAMED_BIND)
276590792Sgshapiro#  define NAMED_BIND	1	/* not one without the other */
276690792Sgshapiro# endif /* HESIOD && !defined(NAMED_BIND) */
276790792Sgshapiro
276890792Sgshapiro#  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
276990792Sgshapiroextern int	h_errno;
277090792Sgshapiro#  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
277190792Sgshapiro
277290792Sgshapiro# if NEEDPUTENV
277390792Sgshapiroextern int	putenv __P((char *));
277490792Sgshapiro# endif /* NEEDPUTENV */
277590792Sgshapiro
277690792Sgshapiro#if !HASUNSETENV
277790792Sgshapiroextern void	unsetenv __P((char *));
277890792Sgshapiro#endif /* !HASUNSETENV */
277990792Sgshapiro
278090792Sgshapiro# ifdef LDAPMAP
278190792Sgshapiro#  include <sys/time.h>
278290792Sgshapiro#  include <lber.h>
278390792Sgshapiro#  include <ldap.h>
278490792Sgshapiro
278590792Sgshapiro/* Some LDAP constants */
278690792Sgshapiro#  define LDAPMAP_FALSE		0
278790792Sgshapiro#  define LDAPMAP_TRUE		1
278890792Sgshapiro
278990792Sgshapiro/*
279090792Sgshapiro**  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
279190792Sgshapiro**  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
279290792Sgshapiro**  and assume (falsely) that all old API implementations are broken.
279390792Sgshapiro**  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
279490792Sgshapiro*/
279590792Sgshapiro
279690792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
279790792Sgshapiro#   define USE_LDAP_INIT	1
279890792Sgshapiro#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
279990792Sgshapiro
280090792Sgshapiro/*
280190792Sgshapiro**  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
280290792Sgshapiro**  hence ldap_set_option() must not exist.
280390792Sgshapiro*/
280490792Sgshapiro
280590792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
280690792Sgshapiro#   define USE_LDAP_SET_OPTION	1
280790792Sgshapiro#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
280890792Sgshapiro
280990792Sgshapiro# endif /* LDAPMAP */
281090792Sgshapiro
281190792Sgshapiro# if HASUNAME
281290792Sgshapiro#  include <sys/utsname.h>
281390792Sgshapiro#  ifdef newstr
281490792Sgshapiro#   undef newstr
281590792Sgshapiro#  endif /* newstr */
281690792Sgshapiro# else /* HASUNAME */
281790792Sgshapiro#  define NODE_LENGTH 32
281890792Sgshapirostruct utsname
281990792Sgshapiro{
282090792Sgshapiro	char nodename[NODE_LENGTH + 1];
282190792Sgshapiro};
282290792Sgshapiro# endif /* HASUNAME */
282390792Sgshapiro
282490792Sgshapiro# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
282590792Sgshapiro#  define MAXHOSTNAMELEN	256
282690792Sgshapiro# endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
282790792Sgshapiro
2828203004Sgshapiro
2829203004Sgshapiro# if _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255
2830203004Sgshapiro   /*
2831223067Sgshapiro   **  override Linux weirdness: a FQHN can be 255 chars long
2832203004Sgshapiro   **  SUSv3 requires HOST_NAME_MAX ("Maximum length of a host
2833203004Sgshapiro   **  name (not including the terminating null) as returned from the
2834203004Sgshapiro   **  gethostname() function.") to be at least 255.  c.f.:
2835203004Sgshapiro   **  http://www.opengroup.org/onlinepubs/009695399
2836203004Sgshapiro   **  but Linux defines that to 64 too.
2837203004Sgshapiro   */
2838203004Sgshapiro#  undef MAXHOSTNAMELEN
2839203004Sgshapiro#  define MAXHOSTNAMELEN	256
2840203004Sgshapiro# endif /* _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 */
2841203004Sgshapiro
284290792Sgshapiro# if !defined(SIGCHLD) && defined(SIGCLD)
284390792Sgshapiro#  define SIGCHLD	SIGCLD
284490792Sgshapiro# endif /* !defined(SIGCHLD) && defined(SIGCLD) */
284590792Sgshapiro
284690792Sgshapiro# ifndef STDIN_FILENO
284790792Sgshapiro#  define STDIN_FILENO	0
284890792Sgshapiro# endif /* ! STDIN_FILENO */
284990792Sgshapiro
285090792Sgshapiro# ifndef STDOUT_FILENO
285190792Sgshapiro#  define STDOUT_FILENO	1
285290792Sgshapiro# endif /* ! STDOUT_FILENO */
285390792Sgshapiro
285490792Sgshapiro# ifndef STDERR_FILENO
285590792Sgshapiro#  define STDERR_FILENO	2
285690792Sgshapiro# endif /* ! STDERR_FILENO */
285790792Sgshapiro
285890792Sgshapiro# ifndef LOCK_SH
285990792Sgshapiro#  define LOCK_SH	0x01	/* shared lock */
286090792Sgshapiro#  define LOCK_EX	0x02	/* exclusive lock */
286190792Sgshapiro#  define LOCK_NB	0x04	/* non-blocking lock */
286290792Sgshapiro#  define LOCK_UN	0x08	/* unlock */
286390792Sgshapiro# endif /* ! LOCK_SH */
286490792Sgshapiro
286590792Sgshapiro# ifndef S_IXOTH
286690792Sgshapiro#  define S_IXOTH	(S_IEXEC >> 6)
286790792Sgshapiro# endif /* ! S_IXOTH */
286890792Sgshapiro
286990792Sgshapiro# ifndef S_IXGRP
287090792Sgshapiro#  define S_IXGRP	(S_IEXEC >> 3)
287190792Sgshapiro# endif /* ! S_IXGRP */
287290792Sgshapiro
287390792Sgshapiro# ifndef S_IXUSR
287490792Sgshapiro#  define S_IXUSR	(S_IEXEC)
287590792Sgshapiro# endif /* ! S_IXUSR */
287690792Sgshapiro
287790792Sgshapiro#ifndef O_ACCMODE
287890792Sgshapiro# define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
287990792Sgshapiro#endif /* ! O_ACCMODE */
288090792Sgshapiro
288190792Sgshapiro# ifndef SEEK_SET
288290792Sgshapiro#  define SEEK_SET	0
288390792Sgshapiro#  define SEEK_CUR	1
288490792Sgshapiro#  define SEEK_END	2
288590792Sgshapiro# endif /* ! SEEK_SET */
288690792Sgshapiro
288790792Sgshapiro# ifndef SIG_ERR
288890792Sgshapiro#  define SIG_ERR	((void (*)()) -1)
288990792Sgshapiro# endif /* ! SIG_ERR */
289090792Sgshapiro
289190792Sgshapiro# ifndef WEXITSTATUS
289290792Sgshapiro#  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
289390792Sgshapiro# endif /* ! WEXITSTATUS */
289490792Sgshapiro# ifndef WIFEXITED
289590792Sgshapiro#  define WIFEXITED(st)		(((st) & 0377) == 0)
289690792Sgshapiro# endif /* ! WIFEXITED */
289790792Sgshapiro# ifndef WIFSTOPPED
289890792Sgshapiro#  define WIFSTOPPED(st)		(((st) & 0100) == 0)
289990792Sgshapiro# endif /* ! WIFSTOPPED */
290090792Sgshapiro# ifndef WCOREDUMP
290190792Sgshapiro#  define WCOREDUMP(st)		(((st) & 0200) != 0)
290290792Sgshapiro# endif /* ! WCOREDUMP */
290390792Sgshapiro# ifndef WTERMSIG
290490792Sgshapiro#  define WTERMSIG(st)		(((st) & 0177))
290590792Sgshapiro# endif /* ! WTERMSIG */
290690792Sgshapiro
290790792Sgshapiro# ifndef SIGFUNC_DEFINED
290890792Sgshapirotypedef void		(*sigfunc_t) __P((int));
290990792Sgshapiro# endif /* ! SIGFUNC_DEFINED */
291090792Sgshapiro# ifndef SIGFUNC_RETURN
291190792Sgshapiro#  define SIGFUNC_RETURN
291290792Sgshapiro# endif /* ! SIGFUNC_RETURN */
291390792Sgshapiro# ifndef SIGFUNC_DECL
291490792Sgshapiro#  define SIGFUNC_DECL	void
291590792Sgshapiro# endif /* ! SIGFUNC_DECL */
291690792Sgshapiro
291790792Sgshapiro/* size of syslog buffer */
291890792Sgshapiro# ifndef SYSLOG_BUFSIZE
291990792Sgshapiro#  define SYSLOG_BUFSIZE	1024
292090792Sgshapiro# endif /* ! SYSLOG_BUFSIZE */
292190792Sgshapiro
2922110560Sgshapiro/* for FD_SET() */
2923110560Sgshapiro#ifndef FD_SETSIZE
2924110560Sgshapiro# define FD_SETSIZE	256
2925110560Sgshapiro#endif /* ! FD_SETSIZE */
2926110560Sgshapiro
2927285229Sgshapiro#ifndef SIGWAIT_TAKES_1_ARG
2928285229Sgshapiro# define SIGWAIT_TAKES_1_ARG	0
2929285229Sgshapiro#endif /* ! SIGWAIT_TAKES_1_ARG */
2930285229Sgshapiro
293190792Sgshapiro/*
293290792Sgshapiro**  Size of prescan buffer.
293390792Sgshapiro**	Despite comments in the _sendmail_ book, this probably should
293490792Sgshapiro**	not be changed; there are some hard-to-define dependencies.
293590792Sgshapiro*/
293690792Sgshapiro
293790792Sgshapiro# define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
293890792Sgshapiro
293990792Sgshapiro/* fork routine -- set above using #ifdef _osname_ or in Makefile */
294090792Sgshapiro# ifndef FORK
294190792Sgshapiro#  define FORK		fork		/* function to call to fork mailer */
294290792Sgshapiro# endif /* ! FORK */
294390792Sgshapiro
294490792Sgshapiro/* setting h_errno */
294590792Sgshapiro# ifndef SM_SET_H_ERRNO
294690792Sgshapiro#  define SM_SET_H_ERRNO(err)	h_errno = (err)
294790792Sgshapiro# endif /* SM_SET_H_ERRNO */
294890792Sgshapiro
294990792Sgshapiro# ifndef SM_CONF_GETOPT
295090792Sgshapiro#  define SM_CONF_GETOPT	1
295190792Sgshapiro# endif /* ! SM_CONF_GETOPT */
295290792Sgshapiro
295390792Sgshapiro/* random routine -- set above using #ifdef _osname_ or in Makefile */
295490792Sgshapiro# if HASRANDOM
295590792Sgshapiro#  define get_random()	random()
295690792Sgshapiro# else /* HASRANDOM */
295790792Sgshapiro#  define get_random()	((long) rand())
295890792Sgshapiro#  ifndef RANDOMSHIFT
295990792Sgshapiro#   define RANDOMSHIFT	8
296090792Sgshapiro#  endif /* ! RANDOMSHIFT */
296190792Sgshapiro# endif /* HASRANDOM */
296290792Sgshapiro
296390792Sgshapiro/*
296490792Sgshapiro**  Default to using scanf in readcf.
296590792Sgshapiro*/
296690792Sgshapiro
296790792Sgshapiro# ifndef SCANF
296890792Sgshapiro#  define SCANF		1
296990792Sgshapiro# endif /* ! SCANF */
297090792Sgshapiro
297190792Sgshapiro/* XXX  32 bit type */
297290792Sgshapiro# ifndef SM_INT32
297390792Sgshapiro#  define SM_INT32	int32_t
297490792Sgshapiro# endif /* ! SM_INT32 */
297590792Sgshapiro
2976261194Sgshapiro/* XXX  16 bit type */
2977261194Sgshapiro# ifndef SM_UINT16
2978261194Sgshapiro#  define SM_UINT16	uint16_t
2979261194Sgshapiro# endif /* ! SM_UINT16 */
2980261194Sgshapiro
2981285229Sgshapiro/* additional valid chars in user/group names in passwd */
2982285229Sgshapiro# ifndef SM_PWN_CHARS
2983285229Sgshapiro#  define SM_PWN_CHARS "-_."
2984285229Sgshapiro# endif
2985285229Sgshapiro
2986285229Sgshapiro
298790792Sgshapiro/*
298890792Sgshapiro**  SVr4 and similar systems use different routines for setjmp/longjmp
298990792Sgshapiro**  with signal support
299090792Sgshapiro*/
299190792Sgshapiro
299290792Sgshapiro# if USE_SIGLONGJMP
299390792Sgshapiro#  ifdef jmp_buf
299490792Sgshapiro#   undef jmp_buf
299590792Sgshapiro#  endif /* jmp_buf */
299690792Sgshapiro#  define jmp_buf		sigjmp_buf
299790792Sgshapiro#  ifdef setjmp
299890792Sgshapiro#   undef setjmp
299990792Sgshapiro#  endif /* setjmp */
300090792Sgshapiro#  define setjmp(env)		sigsetjmp(env, 1)
300190792Sgshapiro#  ifdef longjmp
300290792Sgshapiro#   undef longjmp
300390792Sgshapiro#  endif /* longjmp */
300490792Sgshapiro#  define longjmp(env, val)	siglongjmp(env, val)
300590792Sgshapiro# endif /* USE_SIGLONGJMP */
300690792Sgshapiro
300790792Sgshapiro# if !defined(NGROUPS_MAX) && defined(NGROUPS)
300890792Sgshapiro#  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
300990792Sgshapiro# endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
301090792Sgshapiro
301190792Sgshapiro/*
301290792Sgshapiro**  Some snprintf() implementations are rumored not to NUL terminate.
301390792Sgshapiro*/
301490792Sgshapiro# if SNPRINTF_IS_BROKEN
301590792Sgshapiro#  ifdef snprintf
301690792Sgshapiro#   undef snprintf
301790792Sgshapiro#  endif /* snprintf */
301890792Sgshapiro#  define snprintf	sm_snprintf
301990792Sgshapiro#  ifdef vsnprintf
302090792Sgshapiro#   undef vsnprintf
302190792Sgshapiro#  endif /* vsnprintf */
302290792Sgshapiro#  define vsnprintf	sm_vsnprintf
302390792Sgshapiro# endif /* SNPRINTF_IS_BROKEN */
302490792Sgshapiro
302590792Sgshapiro/*
302690792Sgshapiro**  If we don't have a system syslog, simulate it.
302790792Sgshapiro*/
302890792Sgshapiro
302990792Sgshapiro# if !LOG
303090792Sgshapiro#  define LOG_EMERG	0	/* system is unusable */
303190792Sgshapiro#  define LOG_ALERT	1	/* action must be taken immediately */
303290792Sgshapiro#  define LOG_CRIT	2	/* critical conditions */
303390792Sgshapiro#  define LOG_ERR	3	/* error conditions */
303490792Sgshapiro#  define LOG_WARNING	4	/* warning conditions */
303590792Sgshapiro#  define LOG_NOTICE	5	/* normal but significant condition */
303690792Sgshapiro#  define LOG_INFO	6	/* informational */
303790792Sgshapiro#  define LOG_DEBUG	7	/* debug-level messages */
303890792Sgshapiro# endif /* !LOG */
303990792Sgshapiro
304090792Sgshapiro# ifndef SM_CONF_SYSLOG
304190792Sgshapiro#  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
304290792Sgshapiro# endif /* SM_CONF_SYSLOG */
304390792Sgshapiro
304490792Sgshapiro# if !SM_CONF_SYSLOG
304590792Sgshapiro#   ifdef __STDC__
304690792Sgshapiroextern void	syslog(int, const char *, ...);
304790792Sgshapiro#   else /* __STDC__ */
304890792Sgshapiroextern void	syslog();
304990792Sgshapiro#   endif /* __STDC__ */
305090792Sgshapiro# endif /* !SM_CONF_SYSLOG */
305190792Sgshapiro
305290792Sgshapiro/* portable(?) definition for alignment */
305390792Sgshapiro# ifndef SM_ALIGN_SIZE
305490792Sgshapirostruct sm_align
305590792Sgshapiro{
305690792Sgshapiro	char al_c;
305790792Sgshapiro	union
305890792Sgshapiro	{
305990792Sgshapiro		long	al_l;
306090792Sgshapiro		void	*al_p;
306190792Sgshapiro		double	al_d;
3062141858Sgshapiro		void	(*al_f) __P((void));
306390792Sgshapiro	} al_u;
306490792Sgshapiro};
306590792Sgshapiro#  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
306690792Sgshapiro# endif /* ! SM_ALIGN_SIZE */
306790792Sgshapiro# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
306890792Sgshapiro
3069261194Sgshapirochar *sm_inet6_ntop __P((const void *, char *, size_t));
3070261194Sgshapiro
307190792Sgshapiro#endif /* ! SM_CONF_H */
3072