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 */
45363466Sgshapiro# endif
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 */
53363466Sgshapiro# endif
5490792Sgshapiro
5590792Sgshapiro# ifndef HASNICE
5690792Sgshapiro#  define HASNICE	1	/* has nice(2) call */
57363466Sgshapiro# endif
5890792Sgshapiro
5990792Sgshapiro# ifndef HASRRESVPORT
6090792Sgshapiro#  define HASRRESVPORT	1	/* has rrsevport(3) call */
61363466Sgshapiro# endif
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 */
104363466Sgshapiro#  endif
10590792Sgshapiro#  ifdef HPUX10
10690792Sgshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
107120256Sgshapiro#   ifndef SMRSH_CMDDIR
108120256Sgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
109363466Sgshapiro#   endif
110363466Sgshapiro#  endif
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 */
116363466Sgshapiro#   endif
117120256Sgshapiro#   ifndef SMRSH_CMDDIR
118120256Sgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
119363466Sgshapiro#   endif
12090792Sgshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
12190792Sgshapiro#  else /* HPUX11 */
12290792Sgshapiro#   ifndef NOT_SENDMAIL
12390792Sgshapiro#    define syslog	hard_syslog
124363466Sgshapiro#   endif
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"
133363466Sgshapiro#   endif
13490792Sgshapiro#   ifndef _PATH_SENDMAILPID
13590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
136363466Sgshapiro#   endif
13790792Sgshapiro#   ifndef IDENTPROTO
13890792Sgshapiro#    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
139363466Sgshapiro#   endif
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"
146363466Sgshapiro#   endif
14790792Sgshapiro#   ifndef IDENTPROTO
14890792Sgshapiro#    define IDENTPROTO	0	/* TCP/IP implementation is broken */
149363466Sgshapiro#   endif
15090792Sgshapiro#   ifdef __STDC__
15190792Sgshapiroextern void	hard_syslog(int, char *, ...);
152363466Sgshapiro#   else
15390792Sgshapiroextern void	hard_syslog();
154363466Sgshapiro#   endif
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 */
172363466Sgshapiro#  endif
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 */
186363466Sgshapiro#  endif
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 */
191363466Sgshapiro#   endif
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
223363466Sgshapiro#  endif
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
229363466Sgshapiro#   endif
23090792Sgshapiro#  endif /* !defined(_AIX4) || _AIX4 < 40300 */
23190792Sgshapiro#  if !defined(_AIX4) || _AIX4 < 40200
23290792Sgshapiro#   define SM_CONF_SYSLOG	0
233363466Sgshapiro#  endif
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"
275363466Sgshapiro#  endif
27690792Sgshapiro#  ifndef _PATH_SENDMAILPID
27790792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
278363466Sgshapiro#  endif
27990792Sgshapiro# endif /* AIX */
28090792Sgshapiro
28190792Sgshapiro# if defined(_AIX)
28290792Sgshapiro#  define LDA_USE_LOCKF		1
28390792Sgshapiro#  define LDA_USE_SETEUID	1
284363466Sgshapiro# endif
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
313363466Sgshapiro#  endif
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) */
363363466Sgshapiro#  endif
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 */
377363466Sgshapiro#  endif
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 */
383363466Sgshapiro#   endif
384223067Sgshapiro#   if SOLARIS >= 21100
385223067Sgshapiro#    include <paths.h>
386363466Sgshapiro#   endif
387223067Sgshapiro#   ifndef _PATH_VARRUN
388223067Sgshapiro#    define _PATH_VARRUN	"/var/run/"
389363466Sgshapiro#   endif
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"
396363466Sgshapiro#   endif
39790792Sgshapiro#   ifndef _PATH_VENDOR_CF
39890792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
399363466Sgshapiro#   endif
40090792Sgshapiro#   ifndef _PATH_SENDMAILPID
40190792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
402363466Sgshapiro#   endif
40390792Sgshapiro#   ifndef _PATH_HOSTS
40490792Sgshapiro#    define _PATH_HOSTS		"/etc/inet/hosts"
405363466Sgshapiro#   endif
40690792Sgshapiro#   ifndef SYSLOG_BUFSIZE
40790792Sgshapiro#    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
408363466Sgshapiro#   endif
40990792Sgshapiro#   ifndef TZ_TYPE
41090792Sgshapiro#    define TZ_TYPE	TZ_TZNAME
411363466Sgshapiro#   endif
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 */
415363466Sgshapiro#   endif
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 */
421363466Sgshapiro#   endif
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 */
425363466Sgshapiro#     endif
426363466Sgshapiro#     ifndef RANDOMSHIFT	/* random() doesn't work well (sometimes) */
42790792Sgshapiro#      define RANDOMSHIFT	8
428363466Sgshapiro#     endif
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) */
433363466Sgshapiro#    endif
43490792Sgshapiro#   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
43590792Sgshapiro#   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
43690792Sgshapiro#    define SM_INT32	int	/* 32bit integer */
437363466Sgshapiro#   endif
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"
455363466Sgshapiro#    endif
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 */
466363466Sgshapiro#   endif
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 */
475363466Sgshapiro#   endif
476285229Sgshapiro#   if SOLARIS < 21200
477285229Sgshapiro#    define SIGWAIT_TAKES_1_ARG	1	/* S12 moves to UNIX V7 semantic */
478363466Sgshapiro#   endif
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 */
486363466Sgshapiro#   endif
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 */
493363466Sgshapiro#   endif
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
525363466Sgshapiro#  endif
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
539363466Sgshapiro# endif
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 */
552363466Sgshapiro#  endif
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 */
588363466Sgshapiro#  endif
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 */
592363466Sgshapiro#  endif
59390792Sgshapiro#  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
59490792Sgshapiro#   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
595363466Sgshapiro#  endif
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 */
605363466Sgshapiro#  endif
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 */
621363466Sgshapiro#  endif
62290792Sgshapiro# endif /* __ksr__ */
62390792Sgshapiro
62490792Sgshapiro
62590792Sgshapiro/*
62690792Sgshapiro**  OSF/1 for Intel Paragon.
62790792Sgshapiro**
62890792Sgshapiro**	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
629363466Sgshapiro**	of Intel Scalable Systems Division.
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 */
636363466Sgshapiro#  endif
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 */
664363466Sgshapiro#   else
66598121Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
666363466Sgshapiro#   endif
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"
672363466Sgshapiro#  endif
67390792Sgshapiro#  ifndef _PATH_SENDMAILPID
67490792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
675363466Sgshapiro#  endif
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 */
697363466Sgshapiro#  endif
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
704363466Sgshapiro#  endif
70590792Sgshapiro#  ifndef LA_TYPE
70690792Sgshapiro#   define LA_TYPE	LA_MACH
707363466Sgshapiro#  endif
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"
722363466Sgshapiro#  endif
72390792Sgshapiro#  ifndef _PATH_SENDMAILPID
72490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
725363466Sgshapiro#  endif
72690792Sgshapiro#  define SM_INT32	int	/* 32bit integer */
72790792Sgshapiro
72890792Sgshapiro#  ifdef TCPWRAPPERS
72990792Sgshapiro#   ifndef HASUNSETENV
73090792Sgshapiro#    define HASUNSETENV	1
731363466Sgshapiro#   endif
73290792Sgshapiro#   undef NEEDPUTENV
73390792Sgshapiro#  endif /* TCPWRAPPERS */
73490792Sgshapiro#  ifndef __APPLE__
73590792Sgshapiro#   include <libc.h>
73690792Sgshapiro#   ifndef S_IRUSR
73790792Sgshapiro#    define S_IRUSR	S_IREAD
738363466Sgshapiro#   endif
73990792Sgshapiro#   ifndef S_IWUSR
74090792Sgshapiro#    define S_IWUSR	S_IWRITE
741363466Sgshapiro#   endif
74290792Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
74390792Sgshapiro#  endif /* ! __APPLE__ */
74490792Sgshapiro#  ifndef isascii
74590792Sgshapiro#   define isascii(c)	((unsigned)(c) <= 0177)
746363466Sgshapiro#  endif
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) */
777363466Sgshapiro#  if DARWIN >=180000
778363466Sgshapiro#   ifdef HASRRESVPORT
779363466Sgshapiro#    undef HASRRESVPORT
780363466Sgshapiro#   endif
781363466Sgshapiro#   define HASRRESVPORT		0	/* deprecated rresvport() */
782363466Sgshapiro#  endif
783110560Sgshapiro#  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
784110560Sgshapiro#  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
785110560Sgshapiro#  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
786157001Sgshapiro#  if DARWIN >= 70000
787157001Sgshapiro#   define SOCKADDR_LEN_T	socklen_t
788157001Sgshapiro#  endif
789157001Sgshapiro#  if DARWIN >= 80000
790157001Sgshapiro#   define SPT_TYPE		SPT_REUSEARGV
791157001Sgshapiro#   define SPT_PADCHAR		'\0'
792157001Sgshapiro#   define SOCKOPT_LEN_T	socklen_t
793157001Sgshapiro#  else
794157001Sgshapiro#   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
795157001Sgshapiro#  endif
796110560Sgshapiro#  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
797110560Sgshapiro#  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
798110560Sgshapiro#  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
799110560Sgshapiro#  define HAS_IN_H		1
800110560Sgshapiro#  define NETLINK		1	/* supports AF_LINK */
80194334Sgshapiro#  ifndef NOT_SENDMAIL
802110560Sgshapiro#   define sleep sleepX
803102528Sgshapiroextern unsigned int sleepX __P((unsigned int seconds));
80494334Sgshapiro#  endif /* ! NOT_SENDMAIL */
80590792Sgshapiro# endif /* defined(DARWIN) */
80690792Sgshapiro
80790792Sgshapiro
80890792Sgshapiro/*
80990792Sgshapiro**  4.4 BSD
81090792Sgshapiro**
81190792Sgshapiro**	See also BSD defines.
81290792Sgshapiro*/
81390792Sgshapiro
814157001Sgshapiro# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
81590792Sgshapiro#  include <paths.h>
81690792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
81790792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
81890792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
81990792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
82090792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
82190792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
82290792Sgshapiro#  include <sys/cdefs.h>
82390792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
82490792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
82590792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
82690792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
82790792Sgshapiro#  ifndef LA_TYPE
82890792Sgshapiro#   define LA_TYPE	LA_SUBR
829363466Sgshapiro#  endif
83090792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
83190792Sgshapiro#  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
832157001Sgshapiro# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
83390792Sgshapiro
83490792Sgshapiro
83590792Sgshapiro/*
83690792Sgshapiro**  BSD/OS (was BSD/386) (all versions)
83790792Sgshapiro**	From Tony Sanders, BSDI
83890792Sgshapiro*/
83990792Sgshapiro
84090792Sgshapiro# ifdef __bsdi__
84190792Sgshapiro#  include <paths.h>
84290792Sgshapiro#  define HASUNSETENV	1	/* has the unsetenv(3) call */
84390792Sgshapiro#  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
844132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
84590792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
84690792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
84790792Sgshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
84890792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
84990792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
85090792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
85190792Sgshapiro#  include <sys/cdefs.h>
85290792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
85390792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
85490792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
85590792Sgshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
85690792Sgshapiro#  ifndef LA_TYPE
85790792Sgshapiro#   define LA_TYPE	LA_SUBR
858363466Sgshapiro#  endif
85990792Sgshapiro#  define GIDSET_T	gid_t
86090792Sgshapiro#  define QUAD_T		quad_t
86190792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
86290792Sgshapiro			/* version 1.1 or later */
86390792Sgshapiro#   undef SPT_TYPE
86490792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
86590792Sgshapiro#  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
86690792Sgshapiro			/* version 1.0 or earlier */
86790792Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
86890792Sgshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
86990792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
87090792Sgshapiro#   define HASSETUSERCONTEXT 1	/* has setusercontext */
871363466Sgshapiro#  endif
87290792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
87390792Sgshapiro#   define MODE_T	int	/* va_arg() can't handle less than int */
874363466Sgshapiro#  endif
87590792Sgshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
87690792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
877363466Sgshapiro#  endif
87890792Sgshapiro# endif /* __bsdi__ */
87990792Sgshapiro
88090792Sgshapiro
881168515Sgshapiro# if defined(__QNX__)
882168515Sgshapiro#  if defined(__QNXNTO__)
883168515Sgshapiro/* QNX 6 */
884168515Sgshapiro#   include <unix.h>
885168515Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
886168515Sgshapiro#   define HASINITGROUPS	1	/* has initgroups(3) call */
887168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
888168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
889168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
890168515Sgshapiro#   define HASFCHOWN	1	/* has fchown(2) syscall */
891168515Sgshapiro#   define HASUNAME	1	/* has uname(2) syscall */
892168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
893168515Sgshapiro#   define BSD4_4_SOCKADDR	/* has sa_len */
894168515Sgshapiro#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
895168515Sgshapiro#   define NETLINK	1	/* supports AF_LINK */
896168515Sgshapiro#   define GIDSET_T	gid_t
897168515Sgshapiro#   define QUAD_T	uint64_t
898168515Sgshapiro#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
899168515Sgshapiro#   define HASGETUSERSHELL 0
900168515Sgshapiro
90190792Sgshapiro/*
902168515Sgshapiro**  We have a strrev() that doesn't allocate anything.
903168515Sgshapiro**  Make sure the one here is used.
904168515Sgshapiro*/
905168515Sgshapiro
906168515Sgshapiro#   define strrev strrev_sendmail
907168515Sgshapiro
908168515Sgshapiro#  else /* defined(__QNXNTO__) */
909168515Sgshapiro
910168515Sgshapiro/*
91190792Sgshapiro**  QNX 4.2x
91290792Sgshapiro**	Contributed by Glen McCready <glen@qnx.com>.
91390792Sgshapiro**
914168515Sgshapiro**	Should work with all versions of QNX 4.
91590792Sgshapiro*/
91690792Sgshapiro
917168515Sgshapiro#   include <unix.h>
918168515Sgshapiro#   include <sys/select.h>
919168515Sgshapiro#   undef NGROUPS_MAX
920168515Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
921168515Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
922168515Sgshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
923168515Sgshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
924168515Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
925168515Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
926168515Sgshapiro#   define HASFLOCK	0
927168515Sgshapiro#   undef HASINITGROUPS		/* has initgroups(3) call */
928168515Sgshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
929168515Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
930168515Sgshapiro#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
931168515Sgshapiro#   define GIDSET_T	gid_t
932168515Sgshapiro#   define LA_TYPE	LA_ZERO
933168515Sgshapiro#   define SFS_TYPE	SFS_NONE
934168515Sgshapiro#   define SPT_TYPE	SPT_REUSEARGV
935168515Sgshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
936168515Sgshapiro#   define HASGETUSERSHELL 0
937168515Sgshapiro#   define _FILE_H_INCLUDED
938168515Sgshapiro#  endif /* defined(__QNXNTO__) */
93990792Sgshapiro# endif /* defined(__QNX__) */
94090792Sgshapiro
94190792Sgshapiro
94290792Sgshapiro/*
943141858Sgshapiro**  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
94490792Sgshapiro**
94590792Sgshapiro**  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
94690792Sgshapiro**  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
94790792Sgshapiro**
94890792Sgshapiro**	See also BSD defines.
94990792Sgshapiro*/
95090792Sgshapiro
951141858Sgshapiro# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
95290792Sgshapiro#  include <paths.h>
95390792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
954132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
95590792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
95690792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
957132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
95890792Sgshapiro#  define HASUNAME	1	/* has uname(2) syscall */
95990792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
96090792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
96190792Sgshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
96290792Sgshapiro#  include <sys/cdefs.h>
96390792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
96490792Sgshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
96590792Sgshapiro#  define NETLINK	1	/* supports AF_LINK */
96690792Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
96790792Sgshapiro#  define GIDSET_T	gid_t
968157001Sgshapiro#  define QUAD_T	unsigned long long
969157001Sgshapiro#  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
97090792Sgshapiro#  ifndef LA_TYPE
97190792Sgshapiro#   define LA_TYPE	LA_SUBR
972363466Sgshapiro#  endif
973157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
974157001Sgshapiro    ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
975157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
976132943Sgshapiro#   undef SFS_TYPE
977132943Sgshapiro#   define SFS_TYPE	SFS_STATVFS
978132943Sgshapiro#  else
979132943Sgshapiro#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
980132943Sgshapiro#  endif
98190792Sgshapiro#  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
98290792Sgshapiro#   undef SPT_TYPE
98390792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
984363466Sgshapiro#  endif
98590792Sgshapiro#  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
98690792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
987363466Sgshapiro#  endif
988132943Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
989132943Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
990132943Sgshapiro#  endif
991157001Sgshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
992157001Sgshapiro    ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
993157001Sgshapiro    (__NetBSD_Version__ >= 299000900))
994132943Sgshapiro#   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
995132943Sgshapiro#  endif
996132943Sgshapiro#  if defined(__NetBSD__)
997132943Sgshapiro#   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
998132943Sgshapiro#   include <sys/param.h>
999132943Sgshapiro#   include <sys/sysctl.h>
1000132943Sgshapiro#  endif
1001141858Sgshapiro#  if defined(__DragonFly__)
1002141858Sgshapiro#   define HASSETLOGIN		1	/* has setlogin(2) */
1003141858Sgshapiro#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
1004141858Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
1005141858Sgshapiro#   undef SPT_TYPE
1006141858Sgshapiro#   include <libutil.h>
1007141858Sgshapiro#   define SPT_TYPE		SPT_BUILTIN
1008141858Sgshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1009141858Sgshapiro#   ifndef SMRSH_CMDDIR
1010141858Sgshapiro#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1011363466Sgshapiro#   endif
1012141858Sgshapiro#   ifndef SMRSH_PATH
1013141858Sgshapiro#    define SMRSH_PATH		"/bin:/usr/bin"
1014363466Sgshapiro#   endif
1015141858Sgshapiro#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
1016141858Sgshapiro#  include <sys/sysctl.h>
1017141858Sgshapiro#  endif /* defined(__DragonFly__) */
101890792Sgshapiro#  if defined(__FreeBSD__)
101990792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
102090792Sgshapiro#   if __FreeBSD_version >= 227001
102190792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
102290792Sgshapiro#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
102390792Sgshapiro#   endif /* __FreeBSD_version >= 227001 */
102490792Sgshapiro#   undef SPT_TYPE
102590792Sgshapiro#   if __FreeBSD__ >= 2
102690792Sgshapiro#    include <osreldate.h>
102790792Sgshapiro#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
1028363466Sgshapiro#     if __FreeBSD_version < 500012	/* Moved to libc in 2000 */
1029363466Sgshapiro#      include <libutil.h>
1030363466Sgshapiro#     endif
103190792Sgshapiro#     define SPT_TYPE	SPT_BUILTIN
103290792Sgshapiro#    endif /* __FreeBSD_version >= 199512 */
103390792Sgshapiro#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
103490792Sgshapiro#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1035363466Sgshapiro#    endif
1036223067Sgshapiro#    if __FreeBSD_version >= 300000	/* 3.0.0-release and later */
1037223067Sgshapiro#     define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1038363466Sgshapiro#    endif
103990792Sgshapiro#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
1040120256Sgshapiro#     ifndef SMRSH_CMDDIR
1041120256Sgshapiro#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1042363466Sgshapiro#     endif
1043120256Sgshapiro#     ifndef SMRSH_PATH
1044120256Sgshapiro#      define SMRSH_PATH	"/bin:/usr/bin"
1045363466Sgshapiro#     endif
104690792Sgshapiro#    endif /* __FreeBSD_version >= 330000 */
1047203004Sgshapiro#    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
1048203004Sgshapiro#     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
1049203004Sgshapiro#     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
1050203004Sgshapiro#    endif /* __FreeBSD_version >= 430000 */
105190792Sgshapiro#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
105290792Sgshapiro#    include <sys/sysctl.h>
105390792Sgshapiro#   endif /* __FreeBSD__ >= 2 */
105490792Sgshapiro#   ifndef SPT_TYPE
105590792Sgshapiro#    define SPT_TYPE	SPT_REUSEARGV
105690792Sgshapiro#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
1057363466Sgshapiro#   endif
105890792Sgshapiro#  endif /* defined(__FreeBSD__) */
105990792Sgshapiro#  if defined(__OpenBSD__)
106090792Sgshapiro#   undef SPT_TYPE
106190792Sgshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
106290792Sgshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
1063120256Sgshapiro#   if OpenBSD < 200305
1064120256Sgshapiro#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
1065363466Sgshapiro#   endif
106690792Sgshapiro#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
106790792Sgshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
106890792Sgshapiro#   if OpenBSD >= 200006
106990792Sgshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
1070363466Sgshapiro#   endif
107190792Sgshapiro#   if OpenBSD >= 200012
107290792Sgshapiro#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1073363466Sgshapiro#   endif
1074132943Sgshapiro#   if OpenBSD >= 200405
1075132943Sgshapiro#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
1076363466Sgshapiro#   endif
1077157001Sgshapiro#   if OpenBSD >= 200505
1078157001Sgshapiro#    undef NETISO	/* iso.h removed in 3.7 */
1079363466Sgshapiro#   endif
1080223067Sgshapiro#   if OpenBSD >= 200800
1081223067Sgshapiro#    define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1082363466Sgshapiro#   endif
1083363466Sgshapiro#   ifndef SOCKADDR_LEN_T
1084363466Sgshapiro#    define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
1085363466Sgshapiro#   endif
1086363466Sgshapiro#   ifndef SOCKOPT_LEN_T
1087363466Sgshapiro#    define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
1088363466Sgshapiro#   endif
108990792Sgshapiro#  endif /* defined(__OpenBSD__) */
1090141858Sgshapiro# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
109190792Sgshapiro
109290792Sgshapiro
109390792Sgshapiro/*
109490792Sgshapiro**  Mach386
109590792Sgshapiro**
109690792Sgshapiro**	For mt Xinu's Mach386 system.
109790792Sgshapiro*/
109890792Sgshapiro
109990792Sgshapiro# if defined(MACH) && defined(i386) && !defined(__GNU__)
110090792Sgshapiro#  define MACH386	1
110190792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
110290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
110390792Sgshapiro#  ifndef HASFLOCK
110490792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
1105363466Sgshapiro#  endif
110690792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
110790792Sgshapiro#  define NEEDSTRTOL	1	/* need the strtol() function */
110890792Sgshapiro#  define setpgid	setpgrp
110990792Sgshapiro#  ifndef LA_TYPE
111090792Sgshapiro#   define LA_TYPE	LA_FLOAT
1111363466Sgshapiro#  endif
111290792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
111390792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
111490792Sgshapiro#  undef WEXITSTATUS
111590792Sgshapiro#  undef WIFEXITED
111690792Sgshapiro#  ifndef _PATH_VENDOR_CF
111790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1118363466Sgshapiro#  endif
111990792Sgshapiro#  ifndef _PATH_SENDMAILPID
112090792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1121363466Sgshapiro#  endif
112290792Sgshapiro# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
112390792Sgshapiro
112490792Sgshapiro
112590792Sgshapiro
112690792Sgshapiro/*
112790792Sgshapiro**  GNU OS (hurd)
112890792Sgshapiro**	Largely BSD & posix compatible.
112990792Sgshapiro**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
113090792Sgshapiro**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
113190792Sgshapiro*/
113290792Sgshapiro
113390792Sgshapiro# if defined(__GNU__) && !defined(NeXT)
113490792Sgshapiro#  include <paths.h>
113590792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
113690792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
113790792Sgshapiro#  define HASUNAME	1	/* has uname(2) call */
113890792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
113990792Sgshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
114090792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
114190792Sgshapiro#  define GIDSET_T	gid_t
114290792Sgshapiro#  define SOCKADDR_LEN_T	socklen_t
114390792Sgshapiro#  define SOCKOPT_LEN_T	socklen_t
114490792Sgshapiro#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
114590792Sgshapiro#   define LA_TYPE	LA_SUBR
114690792Sgshapiro#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
114790792Sgshapiro#   define LA_TYPE	LA_MACH
114890792Sgshapiro   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
114990792Sgshapiro#   define host_self	mach_host_self
115090792Sgshapiro#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
115190792Sgshapiro#  define SFS_TYPE	SFS_STATFS
115290792Sgshapiro#  define SPT_TYPE	SPT_CHANGEARGV
115390792Sgshapiro#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
115490792Sgshapiro#  define BSD4_4_SOCKADDR	1	/* has sa_len */
115590792Sgshapiro#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
115690792Sgshapiro#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
115790792Sgshapiro/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
115890792Sgshapiro#  define MAXPATHLEN	2048
115990792Sgshapiro# endif /* defined(__GNU__) && !defined(NeXT) */
116090792Sgshapiro
116190792Sgshapiro/*
116290792Sgshapiro**  4.3 BSD -- this is for very old systems
116390792Sgshapiro**
116490792Sgshapiro**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
116590792Sgshapiro**
116690792Sgshapiro**	You'll also have to install a new resolver library.
116790792Sgshapiro**	I don't guarantee that support for this environment is complete.
116890792Sgshapiro*/
116990792Sgshapiro
117090792Sgshapiro# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
117190792Sgshapiro#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
117290792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
117390792Sgshapiro#  define ARBPTR_T	char *
117490792Sgshapiro#  define setpgid	setpgrp
117590792Sgshapiro#  ifndef LA_TYPE
117690792Sgshapiro#   define LA_TYPE	LA_FLOAT
1177363466Sgshapiro#  endif
117890792Sgshapiro#  ifndef _PATH_VENDOR_CF
117990792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1180363466Sgshapiro#  endif
118190792Sgshapiro#  ifndef IDENTPROTO
118290792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1183363466Sgshapiro#  endif
118490792Sgshapiro#  undef WEXITSTATUS
118590792Sgshapiro#  undef WIFEXITED
118690792Sgshapirotypedef short		pid_t;
118790792Sgshapiro# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
118890792Sgshapiro
118990792Sgshapiro
119090792Sgshapiro/*
119190792Sgshapiro**  SCO Unix
119290792Sgshapiro**
119390792Sgshapiro**	This includes three parts:
119490792Sgshapiro**
119590792Sgshapiro**	The first is for SCO OpenServer 5.
119690792Sgshapiro**	(Contributed by Keith Reynolds <keithr@sco.COM>).
119790792Sgshapiro**
119890792Sgshapiro**		SCO OpenServer 5 has a compiler version number macro,
119990792Sgshapiro**		which we can use to figure out what version we're on.
120090792Sgshapiro**		This may have to change in future releases.
120190792Sgshapiro**
120290792Sgshapiro**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
120390792Sgshapiro**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
120490792Sgshapiro**
120590792Sgshapiro**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
120690792Sgshapiro*/
120790792Sgshapiro
120890792Sgshapiro/* SCO OpenServer 5 */
120990792Sgshapiro# if _SCO_DS >= 1
121090792Sgshapiro#  include <paths.h>
121190792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
121290792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
121390792Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
121490792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
121590792Sgshapiro#  define USESETEUID	1	/* has seteuid(2) call */
121690792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
121790792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
121890792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
121990792Sgshapiro#  define LDA_USE_LOCKF	1
122090792Sgshapiro#  ifndef LA_TYPE
122190792Sgshapiro#   define LA_TYPE	LA_DEVSHORT
1222363466Sgshapiro#  endif
122390792Sgshapiro#  define _PATH_AVENRUN	"/dev/table/avenrun"
122490792Sgshapiro#  ifndef _SCO_unix_4_2
122590792Sgshapiro#   define _SCO_unix_4_2
122690792Sgshapiro#  else /* ! _SCO_unix_4_2 */
122790792Sgshapiro#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1228147078Sgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
122990792Sgshapiro#  endif /* ! _SCO_unix_4_2 */
123090792Sgshapiro# endif /* _SCO_DS >= 1 */
123190792Sgshapiro
123290792Sgshapiro/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
123390792Sgshapiro# ifdef _SCO_unix_4_2
123490792Sgshapiro#  define _SCO_unix_
123590792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
123690792Sgshapiro# endif /* _SCO_unix_4_2 */
123790792Sgshapiro
123890792Sgshapiro/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
123990792Sgshapiro# ifdef _SCO_unix_
124090792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
124190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
124290792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
124390792Sgshapiro#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
124490792Sgshapiro#  ifndef USE_SIGLONGJMP
124590792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1246363466Sgshapiro#  endif
124790792Sgshapiro#  define MAXPATHLEN	PATHSIZE
124890792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
124990792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
125090792Sgshapiro#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
125190792Sgshapiro#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
125290792Sgshapiro#  define UID_T		uid_t
125390792Sgshapiro#  define GID_T		gid_t
125490792Sgshapiro#  define GIDSET_T	gid_t
125590792Sgshapiro#  define _PATH_UNIX		"/unix"
125690792Sgshapiro#  ifndef _PATH_VENDOR_CF
125790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1258363466Sgshapiro#  endif
125990792Sgshapiro#  ifndef _PATH_SENDMAILPID
126090792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1261363466Sgshapiro#  endif
126290792Sgshapiro
126390792Sgshapiro/* stuff fixed in later releases */
126490792Sgshapiro#  ifndef _SCO_unix_4_2
126590792Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1266363466Sgshapiro#  endif
126790792Sgshapiro
126890792Sgshapiro#  ifndef _SCO_DS
126990792Sgshapiro#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
127090792Sgshapiro#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
127190792Sgshapiro#   define NETUNIX	0	/* no unix domain socket support */
127290792Sgshapiro#   define LA_TYPE	LA_SHORT
127390792Sgshapiro#  endif /* ! _SCO_DS */
127490792Sgshapiro
127590792Sgshapiro# endif /* _SCO_unix_ */
127690792Sgshapiro
127790792Sgshapiro/*
127890792Sgshapiro**  ISC (SunSoft) Unix.
127990792Sgshapiro**
128090792Sgshapiro**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
128190792Sgshapiro*/
128290792Sgshapiro
128390792Sgshapiro# ifdef ISC_UNIX
128490792Sgshapiro#  include <net/errno.h>
128590792Sgshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
128690792Sgshapiro#  include <sys/bsdtypes.h>
128790792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
128890792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
128990792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
129090792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
129190792Sgshapiro#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
129290792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
129390792Sgshapiro#  define MAXPATHLEN	1024
129490792Sgshapiro#  define LA_TYPE	LA_SHORT
129590792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
129690792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
129790792Sgshapiro#  define _PATH_UNIX		"/unix"
129890792Sgshapiro#  ifndef _PATH_VENDOR_CF
129990792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1300363466Sgshapiro#  endif
130190792Sgshapiro#  ifndef _PATH_SENDMAILPID
130290792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1303363466Sgshapiro#  endif
130490792Sgshapiro# endif /* ISC_UNIX */
130590792Sgshapiro
130690792Sgshapiro
130790792Sgshapiro/*
130890792Sgshapiro**  Altos System V (5.3.1)
130990792Sgshapiro**	Contributed by Tim Rice <tim@trr.metro.net>.
131090792Sgshapiro*/
131190792Sgshapiro
131290792Sgshapiro# ifdef ALTOS_SYSTEM_V
131390792Sgshapiro#  include <sys/stream.h>
131490792Sgshapiro#  include <limits.h>
131590792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
131690792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
131790792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
131890792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
131990792Sgshapiro#  define NEEDFSYNC	1	/* no fsync(2) in system library */
132090792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
132190792Sgshapiro#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
132290792Sgshapiro#  define MAXPATHLEN	PATH_MAX
132390792Sgshapiro#  define LA_TYPE	LA_SHORT
132490792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
132590792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
132690792Sgshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
132790792Sgshapiro#  define NETUNIX	0	/* no unix domain socket support */
132890792Sgshapiro#  undef WIFEXITED
132990792Sgshapiro#  undef WEXITSTATUS
133090792Sgshapiro#  define strtoul	strtol	/* gcc library bogosity */
133190792Sgshapiro
133290792Sgshapirotypedef unsigned short	uid_t;
133390792Sgshapirotypedef unsigned short	gid_t;
133490792Sgshapirotypedef short		pid_t;
133590792Sgshapirotypedef unsigned long	mode_t;
133690792Sgshapiro
133790792Sgshapiro/* some stuff that should have been in the include files */
133890792Sgshapiroextern char		*malloc();
133990792Sgshapiroextern struct passwd	*getpwent();
134090792Sgshapiroextern struct passwd	*getpwnam();
134190792Sgshapiroextern struct passwd	*getpwuid();
134290792Sgshapiroextern char		*getenv();
134390792Sgshapiroextern struct group	*getgrgid();
134490792Sgshapiroextern struct group	*getgrnam();
134590792Sgshapiro
134690792Sgshapiro# endif /* ALTOS_SYSTEM_V */
134790792Sgshapiro
134890792Sgshapiro
134990792Sgshapiro/*
135090792Sgshapiro**  ConvexOS 11.0 and later
135190792Sgshapiro**
135290792Sgshapiro**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
135390792Sgshapiro**	works on 9.1 as well.
135490792Sgshapiro**
135590792Sgshapiro**  ConvexOS 11.5 and later, should work on 11.0 as defined.
135690792Sgshapiro**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
135790792Sgshapiro**
135890792Sgshapiro**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
135990792Sgshapiro**		(now the CONVEX Technologies Center of Hewlett Packard)
136090792Sgshapiro*/
136190792Sgshapiro
136290792Sgshapiro# ifdef _CONVEX_SOURCE
136390792Sgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
136490792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) */
136590792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
136690792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
136790792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) */
136890792Sgshapiro#  define HASFLOCK	1	/* has flock(2) */
136990792Sgshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) */
137090792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) */
137190792Sgshapiro#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
137290792Sgshapiro#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
137390792Sgshapiro#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
137490792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
137590792Sgshapiro#  define LA_TYPE	LA_FLOAT
137690792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
137790792Sgshapiro#  ifndef _PATH_VENDOR_CF
137890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1379363466Sgshapiro#  endif
138090792Sgshapiro#  ifndef S_IREAD
138190792Sgshapiro#   define S_IREAD	_S_IREAD
138290792Sgshapiro#   define S_IWRITE	_S_IWRITE
138390792Sgshapiro#   define S_IEXEC	_S_IEXEC
138490792Sgshapiro#   define S_IFMT	_S_IFMT
138590792Sgshapiro#   define S_IFCHR	_S_IFCHR
138690792Sgshapiro#   define S_IFBLK	_S_IFBLK
138790792Sgshapiro#  endif /* ! S_IREAD */
138890792Sgshapiro#  ifndef TZ_TYPE
138990792Sgshapiro#   define TZ_TYPE	TZ_TIMEZONE
1390363466Sgshapiro#  endif
139190792Sgshapiro#  ifndef IDENTPROTO
139290792Sgshapiro#   define IDENTPROTO	1
1393363466Sgshapiro#  endif
139490792Sgshapiro#  ifndef SHARE_V1
139590792Sgshapiro#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
1396363466Sgshapiro#  endif
139790792Sgshapiro#  if !defined(__GNUC__ )
1398363466Sgshapiro#   define UID_T	int	/* GNUC gets it right, ConvexC botches */
1399363466Sgshapiro#   define GID_T	int	/* GNUC gets it right, ConvexC botches */
1400363466Sgshapiro#  endif
140190792Sgshapiro#  if SECUREWARE
140290792Sgshapiro#   define FORK	fork		/* SecureWare wants the real fork! */
1403363466Sgshapiro#  else
140490792Sgshapiro#   define FORK	vfork		/* the rest of the OS versions don't care */
1405363466Sgshapiro#  endif
140690792Sgshapiro# endif /* _CONVEX_SOURCE */
140790792Sgshapiro
140890792Sgshapiro
140990792Sgshapiro/*
141090792Sgshapiro**  RISC/os 4.52
141190792Sgshapiro**
141290792Sgshapiro**	Gives a ton of warning messages, but otherwise compiles.
141390792Sgshapiro*/
141490792Sgshapiro
141590792Sgshapiro# ifdef RISCOS
141690792Sgshapiro
141790792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
141890792Sgshapiro#  ifndef HASFLOCK
141990792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
1420363466Sgshapiro#  endif
142190792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
142290792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
142390792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
142490792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
142590792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
142690792Sgshapiro#  define LA_TYPE	LA_INT
142790792Sgshapiro#  define LA_AVENRUN	"avenrun"
142890792Sgshapiro#  define _PATH_UNIX	"/unix"
142990792Sgshapiro#  undef WIFEXITED
143090792Sgshapiro
143190792Sgshapiro#  define setpgid	setpgrp
143290792Sgshapiro
143390792Sgshapirotypedef int		pid_t;
143490792Sgshapiro#  define SIGFUNC_DEFINED
143590792Sgshapiro#  define SIGFUNC_RETURN	(0)
143690792Sgshapiro#  define SIGFUNC_DECL	int
143790792Sgshapirotypedef int		(*sigfunc_t)();
143890792Sgshapiroextern char		*getenv();
143990792Sgshapiroextern void		*malloc();
144090792Sgshapiro
144190792Sgshapiro/* added for RISC/os 4.01...which is dumber than 4.50 */
144290792Sgshapiro#  ifdef RISCOS_4_0
144390792Sgshapiro#   ifndef ARBPTR_T
144490792Sgshapiro#    define ARBPTR_T	char *
1445363466Sgshapiro#   endif
144690792Sgshapiro#   undef HASFLOCK
144790792Sgshapiro#   define HASFLOCK	0
144890792Sgshapiro#  endif /* RISCOS_4_0 */
144990792Sgshapiro
145090792Sgshapiro#  include <sys/time.h>
145190792Sgshapiro
145290792Sgshapiro# endif /* RISCOS */
145390792Sgshapiro
145490792Sgshapiro
145590792Sgshapiro/*
145690792Sgshapiro**  Linux 0.99pl10 and above...
145790792Sgshapiro**
145890792Sgshapiro**  Thanks to, in reverse order of contact:
145990792Sgshapiro**
146090792Sgshapiro**	John Kennedy <warlock@csuchico.edu>
146190792Sgshapiro**	Andrew Pam <avatar@aus.xanadu.com>
146290792Sgshapiro**	Florian La Roche <rzsfl@rz.uni-sb.de>
146390792Sgshapiro**	Karl London <karl@borg.demon.co.uk>
146490792Sgshapiro**
146590792Sgshapiro**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
146690792Sgshapiro**	file locking is no longer allowed.  In particular, make sure
146790792Sgshapiro**	your DBM library and sendmail are both using either flock(2)
146890792Sgshapiro**	*or* fcntl(2) file locking, but not both.
146990792Sgshapiro*/
147090792Sgshapiro
147190792Sgshapiro# ifdef __linux__
147290792Sgshapiro#  include <linux/version.h>
147390792Sgshapiro#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
147490792Sgshapiro#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
1475363466Sgshapiro#  endif
147690792Sgshapiro#  define BSD		1	/* include BSD defines */
147790792Sgshapiro#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
147890792Sgshapiro#  ifndef REQUIRES_DIR_FSYNC
147990792Sgshapiro#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
1480363466Sgshapiro#  endif
148190792Sgshapiro#  ifndef USESETEUID
148290792Sgshapiro#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
1483363466Sgshapiro#  endif
1484112810Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
148590792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
148690792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
148790792Sgshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
148890792Sgshapiro#  define GIDSET_T	gid_t	/* from <linux/types.h> */
148990792Sgshapiro#  ifndef HASGETUSERSHELL
149090792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
1491363466Sgshapiro#  endif
149290792Sgshapiro#  ifndef IP_SRCROUTE
149390792Sgshapiro#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
1494363466Sgshapiro#  endif
149590792Sgshapiro#  ifndef HAS_IN_H
149690792Sgshapiro#   define HAS_IN_H	1	/* use netinet/in.h */
1497363466Sgshapiro#  endif
149890792Sgshapiro#  ifndef USE_SIGLONGJMP
149990792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1500363466Sgshapiro#  endif
150190792Sgshapiro#  ifndef HASFLOCK
150290792Sgshapiro#   if LINUX_VERSION_CODE < 66399
150390792Sgshapiro#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
150490792Sgshapiro#   else /* LINUX_VERSION_CODE < 66399 */
1505132943Sgshapiro#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
1506132943Sgshapiro#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1507363466Sgshapiro#     else
1508132943Sgshapiro#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1509363466Sgshapiro#     endif
151090792Sgshapiro#   endif /* LINUX_VERSION_CODE < 66399 */
151190792Sgshapiro#  endif /* ! HASFLOCK */
151290792Sgshapiro#  ifndef LA_TYPE
151390792Sgshapiro#   define LA_TYPE	LA_PROCSTR
1514363466Sgshapiro#  endif
151590792Sgshapiro#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
151690792Sgshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
151790792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
151890792Sgshapiro#   ifndef HASURANDOMDEV
151990792Sgshapiro#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
1520363466Sgshapiro#   endif
152190792Sgshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1522120256Sgshapiro#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1523132943Sgshapiro#   define HASSTRERROR	1	/* has strerror(3) */
1524363466Sgshapiro#  endif
152590792Sgshapiro#  ifndef TZ_TYPE
152690792Sgshapiro#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
1527363466Sgshapiro#  endif
152898841Sgshapiro#  if (__GLIBC__ >= 2)
152998841Sgshapiro#   include <paths.h>
1530363466Sgshapiro#  endif
153190792Sgshapiro#  ifndef _PATH_SENDMAILPID
153290792Sgshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
1533363466Sgshapiro#  endif
153490792Sgshapiro#  include <sys/sysmacros.h>
153590792Sgshapiro#  undef atol			/* wounded in <stdlib.h> */
1536363466Sgshapiro
1537363466Sgshapiro#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1538363466Sgshapiro#   define GLIBC_VERSION ((__GLIBC__ << 9) + __GLIBC_MINOR__)
1539363466Sgshapiro#   if (GLIBC_VERSION >= 0x201)
1540363466Sgshapiro#    define SOCKADDR_LEN_T     socklen_t
1541363466Sgshapiro#    define SOCKOPT_LEN_T      socklen_t
1542363466Sgshapiro#   endif
1543363466Sgshapiro#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1544363466Sgshapiro
154590792Sgshapiro#  if NETINET6
154690792Sgshapiro   /*
154790792Sgshapiro   **  Linux doesn't have a good way to tell userland what interfaces are
154890792Sgshapiro   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
154990792Sgshapiro   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
155090792Sgshapiro   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
155190792Sgshapiro   */
155290792Sgshapiro#   define ADDRCONFIG_IS_BROKEN	1
155390792Sgshapiro
155490792Sgshapiro   /*
155590792Sgshapiro   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
155690792Sgshapiro   **  in 2.1 and later, but the APIs appear before the functions.
155790792Sgshapiro   */
155890792Sgshapiro#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
155990792Sgshapiro#    if (GLIBC_VERSION >= 0x201)
156090792Sgshapiro#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
1561363466Sgshapiro#    else
156290792Sgshapiro#     include <linux/in6.h>	/* IPv6 support */
1563363466Sgshapiro#    endif
156490792Sgshapiro#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
156590792Sgshapiro     /* Have APIs in <netdb.h>, but no support in glibc */
156690792Sgshapiro#     define NEEDSGETIPNODE	1
1567363466Sgshapiro#    endif
156890792Sgshapiro#    undef GLIBC_VERSION
156990792Sgshapiro#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
157090792Sgshapiro#  endif /* NETINET6 */
157190792Sgshapiro#  ifndef HASFCHOWN
157290792Sgshapiro#   define HASFCHOWN	1	/* fchown(2) */
1573363466Sgshapiro#  endif
157490792Sgshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
157590792Sgshapiro#    define HASFCHMOD	1	/* fchmod(2) */
1576363466Sgshapiro#  endif
157790792Sgshapiro# endif /* __linux__ */
157890792Sgshapiro
157990792Sgshapiro
158090792Sgshapiro/*
158190792Sgshapiro**  DELL SVR4 Issue 2.2, and others
158290792Sgshapiro**	From Kimmo Suominen <kim@grendel.lut.fi>
158390792Sgshapiro**
158490792Sgshapiro**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
158590792Sgshapiro**	defined, and the definitions conflict.
158690792Sgshapiro**
158790792Sgshapiro**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
158890792Sgshapiro**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
158990792Sgshapiro**	(SVR4.0/386 version 3.0).
159090792Sgshapiro*/
159190792Sgshapiro
159290792Sgshapiro# ifdef DELL_SVR4
159390792Sgshapiro				/* no changes necessary */
159490792Sgshapiro				/* see general __svr4__ defines below */
159590792Sgshapiro# endif /* DELL_SVR4 */
159690792Sgshapiro
159790792Sgshapiro
159890792Sgshapiro/*
159990792Sgshapiro**  Apple A/UX 3.0
160090792Sgshapiro*/
160190792Sgshapiro
160290792Sgshapiro# ifdef _AUX_SOURCE
160390792Sgshapiro#  include <sys/sysmacros.h>
160490792Sgshapiro#  define BSD			/* has BSD routines */
160590792Sgshapiro#  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
160690792Sgshapiro#  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
160790792Sgshapiro#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
160890792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
160990792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
161090792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
161190792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) in libc */
161290792Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
161390792Sgshapiro#  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
161490792Sgshapiro#  define SIGFUNC_RETURN		/* POSIX-mode */
161590792Sgshapiro#  define SIGFUNC_DECL	void	/* POSIX-mode */
161690792Sgshapiro#  define ERRLIST_PREDEFINED	1
161790792Sgshapiro#  ifndef IDENTPROTO
161890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1619363466Sgshapiro#  endif
162090792Sgshapiro#  ifndef LA_TYPE
162190792Sgshapiro#   define LA_TYPE	LA_INT
162290792Sgshapiro#   define FSHIFT	16
1623363466Sgshapiro#  endif
162490792Sgshapiro#  define LA_AVENRUN	"avenrun"
162590792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
162690792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
162790792Sgshapiro#  ifndef _PATH_UNIX
162890792Sgshapiro#   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
1629363466Sgshapiro#  endif
163090792Sgshapiro#  ifndef _PATH_VENDOR_CF
163190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1632363466Sgshapiro#  endif
163390792Sgshapiro#  undef WIFEXITED
163490792Sgshapiro#  undef WEXITSTATUS
163590792Sgshapiro# endif /* _AUX_SOURCE */
163690792Sgshapiro
163790792Sgshapiro
163890792Sgshapiro/*
163990792Sgshapiro**  Encore UMAX V
164090792Sgshapiro**
164190792Sgshapiro**	Not extensively tested.
164290792Sgshapiro*/
164390792Sgshapiro
164490792Sgshapiro# ifdef UMAXV
164590792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
164690792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
164790792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
164890792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
164990792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
165090792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
165190792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
165290792Sgshapiro#  define MAXPATHLEN	PATH_MAX
165390792Sgshapiroextern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
165490792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
165590792Sgshapiro#  undef WIFEXITED
165690792Sgshapiro#  undef WEXITSTATUS
165790792Sgshapiro# endif /* UMAXV */
165890792Sgshapiro
165990792Sgshapiro
166090792Sgshapiro/*
166190792Sgshapiro**  Stardent Titan 3000 running TitanOS 4.2.
166290792Sgshapiro**
166390792Sgshapiro**	Must be compiled in "cc -43" mode.
166490792Sgshapiro**
166590792Sgshapiro**	From Kate Hedstrom <kate@ahab.rutgers.edu>.
166690792Sgshapiro**
166790792Sgshapiro**	Note the tweaking below after the BSD defines are set.
166890792Sgshapiro*/
166990792Sgshapiro
167090792Sgshapiro# ifdef titan
167190792Sgshapiro#  define setpgid	setpgrp
167290792Sgshapirotypedef int		pid_t;
167390792Sgshapiro#  undef WIFEXITED
167490792Sgshapiro#  undef WEXITSTATUS
167590792Sgshapiro# endif /* titan */
167690792Sgshapiro
167790792Sgshapiro
167890792Sgshapiro/*
167990792Sgshapiro**  Sequent DYNIX 3.2.0
168090792Sgshapiro**
168190792Sgshapiro**	From Jim Davis <jdavis@cs.arizona.edu>.
168290792Sgshapiro*/
168390792Sgshapiro
168490792Sgshapiro# ifdef sequent
168590792Sgshapiro
168690792Sgshapiro#  define BSD		1
168790792Sgshapiro#  define HASUNSETENV	1
168890792Sgshapiro#  define BSD4_3		1	/* to get signal() in conf.c */
168990792Sgshapiro#  define WAITUNION	1
169090792Sgshapiro#  define LA_TYPE	LA_FLOAT
169190792Sgshapiro#  ifdef _POSIX_VERSION
169290792Sgshapiro#   undef _POSIX_VERSION		/* set in <unistd.h> */
1693363466Sgshapiro#  endif
169490792Sgshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
169590792Sgshapiro#  define setpgid	setpgrp
169690792Sgshapiro
169790792Sgshapiro/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
169890792Sgshapiro#  undef	WIFEXITED
169990792Sgshapiro#  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
170090792Sgshapiro			 ((union wait*)&(s))->w_termsig == 0)
170190792Sgshapiro#  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
170290792Sgshapirotypedef int		pid_t;
170390792Sgshapiro#  define isgraph(c)	(isprint(c) && (c != ' '))
170490792Sgshapiro
170590792Sgshapiro#  ifndef IDENTPROTO
170690792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1707363466Sgshapiro#  endif
170890792Sgshapiro
170990792Sgshapiro#  ifndef _PATH_UNIX
171090792Sgshapiro#   define _PATH_UNIX		"/dynix"
1711363466Sgshapiro#  endif
171290792Sgshapiro#  ifndef _PATH_VENDOR_CF
171390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1714363466Sgshapiro#  endif
171590792Sgshapiro# endif /* sequent */
171690792Sgshapiro
171790792Sgshapiro
171890792Sgshapiro/*
171990792Sgshapiro**  Sequent DYNIX/ptx v2.0 (and higher)
172090792Sgshapiro**
172190792Sgshapiro**	For DYNIX/ptx v1.x, undefine HASSETREUID.
172290792Sgshapiro**
172390792Sgshapiro**	From Tim Wright <timw@sequent.com>.
172490792Sgshapiro**	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
172590792Sgshapiro**		for DYNIX/ptx 4.0.2.
172690792Sgshapiro*/
172790792Sgshapiro
172890792Sgshapiro# ifdef _SEQUENT_
172990792Sgshapiro#  include <sys/stream.h>
173090792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
173190792Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
173290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
173390792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
173490792Sgshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
173590792Sgshapiro#  define GIDSET_T	gid_t
173690792Sgshapiro#  define LA_TYPE	LA_INT
173790792Sgshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
173890792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
173990792Sgshapiro#  ifndef IDENTPROTO
174090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1741363466Sgshapiro#  endif
174290792Sgshapiro#  ifndef _PATH_VENDOR_CF
174390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1744363466Sgshapiro#  endif
174590792Sgshapiro#  ifndef _PATH_SENDMAILPID
174690792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1747363466Sgshapiro#  endif
174890792Sgshapiro# endif /* _SEQUENT_ */
174990792Sgshapiro
175090792Sgshapiro/*
1751132943Sgshapiro**  Cray UNICOS, UNICOS/mk, and UNICOS/mp
175290792Sgshapiro**
1753132943Sgshapiro**    UNICOS:
1754363466Sgshapiro**	Ported by David L. Kensiski, Sterling Software <kensiski@nas.nasa.gov>
1755132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1756132943Sgshapiro**    UNICOS/mk (Cray T3E):
1757132943Sgshapiro**	Contributed by Manu Mahonen <mailadm@csc.fi>
1758132943Sgshapiro**	of Center for Scientific Computing.
1759132943Sgshapiro**	Update Brian Ginsbach <ginsbach@cray.com>
1760132943Sgshapiro**    UNICOS/mp:
1761132943Sgshapiro**	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
176290792Sgshapiro*/
176390792Sgshapiro
1764132943Sgshapiro# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
176590792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
1766132943Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1767132943Sgshapiro#  define HASFCHOWN	1	/* has fchown(2) */
1768132943Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
1769132943Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
1770132943Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
1771132943Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
1772132943Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
1773132943Sgshapiro#  define HASSTRERROR	1	/* has strerror(3) */
1774132943Sgshapiro#  define GIDSET_T	gid_t
177590792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1776132943Sgshapiro#  define SFS_BAVAIL	f_bfree	/* alternate field name */
1777132943Sgshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1778132943Sgshapiro#  ifdef UNICOS
1779132943Sgshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1780132943Sgshapiro#   define LA_TYPE	LA_ZERO
1781132943Sgshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
1782132943Sgshapiro#   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
1783132943Sgshapiro#   ifndef MAXPATHLEN
1784132943Sgshapiro#    define MAXPATHLEN PATHSIZE
1785363466Sgshapiro#   endif
1786132943Sgshapiro#   ifndef _PATH_UNIX
1787132943Sgshapiro#    ifdef UNICOSMK
1788132943Sgshapiro#     define _PATH_UNIX		"/unicosmk.ar"
1789132943Sgshapiro#    else
1790132943Sgshapiro#     define _PATH_UNIX		"/unicos"
1791363466Sgshapiro#    endif
1792132943Sgshapiro#   endif /* ! _PATH_UNIX */
1793132943Sgshapiro#   ifndef _PATH_VENDOR_CF
1794132943Sgshapiro#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1795363466Sgshapiro#   endif
1796132943Sgshapiro#  endif /* UNICOS */
1797132943Sgshapiro#  ifdef _UNICOSMP
1798132943Sgshapiro#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1799132943Sgshapiro    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1800132943Sgshapiro#   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1801363466Sgshapiro#  endif
1802132943Sgshapiro#   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
1803132943Sgshapiro#   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
1804132943Sgshapiro#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1805132943Sgshapiro#   include <sys/cdefs.h>
1806132943Sgshapiro#   include <paths.h>
1807132943Sgshapiro#   define ARGV_T char *const *
1808132943Sgshapiro#  endif /* _UNICOSMP */
1809132943Sgshapiro# endif /* _CRAY */
181090792Sgshapiro
181190792Sgshapiro/*
181290792Sgshapiro**  Apollo DomainOS
181390792Sgshapiro**
181490792Sgshapiro**  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
181590792Sgshapiro**
181690792Sgshapiro**  15 Jan 1994; updated 2 Aug 1995
181790792Sgshapiro**
181890792Sgshapiro*/
181990792Sgshapiro
182090792Sgshapiro# ifdef apollo
182190792Sgshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
182290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(2) call */
182390792Sgshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
182490792Sgshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
182590792Sgshapiro#  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
182690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
182790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
182890792Sgshapiro#  define TZ_TYPE	TZ_TZNAME
182990792Sgshapiro#  ifndef _PATH_VENDOR_CF
183090792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1831363466Sgshapiro#  endif
183290792Sgshapiro#  ifndef _PATH_SENDMAILPID
183390792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1834363466Sgshapiro#  endif
183590792Sgshapiro#  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
183690792Sgshapiro#  undef	 S_IFIFO
183790792Sgshapiro#  define S_IFIFO	0010000
183890792Sgshapiro#  ifndef IDENTPROTO
183990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1840363466Sgshapiro#  endif
184190792Sgshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
184290792Sgshapiro#  if defined(NGROUPS_MAX) && !NGROUPS_MAX
184390792Sgshapiro#   undef NGROUPS_MAX
1844363466Sgshapiro#  endif
184590792Sgshapiro# endif /* apollo */
184690792Sgshapiro
184790792Sgshapiro/*
184890792Sgshapiro**  MPE-iX
184990792Sgshapiro**
185090792Sgshapiro**	Requires MPE 6.0 or greater.  See sendmail/README for more info.
185190792Sgshapiro**
185290792Sgshapiro**	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
185390792Sgshapiro*/
185490792Sgshapiro
185590792Sgshapiro# ifdef MPE
185690792Sgshapiro
185790792Sgshapiro#  include <sys/sysmacros.h>
185890792Sgshapiro#  include <fcntl.h>
185990792Sgshapiro
186090792Sgshapiro/* Sendmail stuff */
186190792Sgshapiro#  define HASFCHOWN		0	/* lacks fchown() */
186290792Sgshapiro#  define HASGETUSERSHELL	0	/* lacks getusershell() */
186390792Sgshapiro#  ifdef HASNICE
186490792Sgshapiro#   undef  HASNICE
1865363466Sgshapiro#  endif
186690792Sgshapiro#  define HASNICE		0	/* lacks nice() */
186790792Sgshapiro#  define HASRANDOM		0	/* lacks random() */
186890792Sgshapiro#  ifdef HASRRESVPORT
186990792Sgshapiro#   undef HASRRESVPORT
1870363466Sgshapiro#  endif
187190792Sgshapiro#  define HASRRESVPORT		0	/* lacks rresvport() */
187290792Sgshapiro#  define IP_SRCROUTE		0	/* lacks IP source routing fields */
187390792Sgshapiro#  ifdef MATCHGECOS
187490792Sgshapiro#   undef MATCHGECOS
1875363466Sgshapiro#  endif
187690792Sgshapiro#  define MATCHGECOS		0	/* lacks an initialized GECOS field */
187790792Sgshapiro#  define NEEDFSYNC		1	/* use sendmail's fsync() */
187890792Sgshapiro#  define NEEDLINK		1	/* use sendmail's link() */
187990792Sgshapiro#  define NOFTRUNCATE		1	/* lacks ftruncate() */
188090792Sgshapiro#  define SFS_TYPE		SFS_NONE /* can't determine disk space */
188190792Sgshapiro#  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
188290792Sgshapiro#  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
188390792Sgshapiro#  define USE_ENVIRON		1	/* use environ instead of envp */
188490792Sgshapiro
188590792Sgshapiro/* Missing header stuff */
188690792Sgshapiro#  define AF_UNSPEC		0
188790792Sgshapiro#  define AF_MAX		AF_INET
188890792Sgshapiro#  define IFF_LOOPBACK		0x8
188990792Sgshapiro#  define IN_LOOPBACKNET	127
189090792Sgshapiro#  define MAXNAMLEN		NAME_MAX
189190792Sgshapiro#  define S_IEXEC		S_IXUSR
189290792Sgshapiro#  define S_IREAD		S_IRUSR
189390792Sgshapiro#  define S_IWRITE		S_IWUSR
189490792Sgshapiro
189590792Sgshapiro/* Present header stuff that needs to be missing */
189690792Sgshapiro#  undef NGROUPS_MAX
189790792Sgshapiro
189890792Sgshapiro/* Shadow functions */
189990792Sgshapiro#  define bind		sendmail_mpe_bind
190090792Sgshapiro#  define _exit		sendmail_mpe__exit
190190792Sgshapiro#  define exit		sendmail_mpe_exit
190290792Sgshapiro#  define fcntl		sendmail_mpe_fcntl
190390792Sgshapiro#  define getegid	sendmail_mpe_getegid
190490792Sgshapiro#  define geteuid	sendmail_mpe_geteuid
190590792Sgshapiro#  define getpwnam	sendmail_mpe_getpwnam
190690792Sgshapiro#  define getpwuid	sendmail_mpe_getpwuid
190790792Sgshapiro#  define setgid	sendmail_mpe_setgid
190890792Sgshapiro#  define setuid	sendmail_mpe_setuid
190990792Sgshapiroextern int		sendmail_mpe_fcntl __P((int, int, ...));
191090792Sgshapiroextern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
191190792Sgshapiroextern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
191290792Sgshapiro# endif /* MPE */
191390792Sgshapiro
191490792Sgshapiro/*
191590792Sgshapiro**  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
191690792Sgshapiro**
191790792Sgshapiro**	Contributed by Paul Gampe <paulg@apnic.net>
191890792Sgshapiro*/
191990792Sgshapiro
192090792Sgshapiro# ifdef __svr5__
192190792Sgshapiro#  include <sys/mkdev.h>
192290792Sgshapiro#  define __svr4__
192390792Sgshapiro#  define SYS5SIGNALS		1
192490792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
1925132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
192690792Sgshapiro#  define HASSETREUID		1
192790792Sgshapiro#  define HASWAITPID		1
192890792Sgshapiro#  define HASGETDTABLESIZE	1
192990792Sgshapiro#  define GIDSET_T		gid_t
1930147078Sgshapiro#  define SOCKADDR_LEN_T	size_t
193190792Sgshapiro#  define SOCKOPT_LEN_T		size_t
1932285229Sgshapiro#  define SIGWAIT_TAKES_1_ARG	1
193390792Sgshapiro#  ifndef _PATH_UNIX
193490792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
1935363466Sgshapiro#  endif
193690792Sgshapiro#  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
193790792Sgshapiro#  ifndef SYSLOG_BUFSIZE
193890792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* unsure */
1939363466Sgshapiro#  endif
194090792Sgshapiro#  ifndef _PATH_VENDOR_CF
194190792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
1942363466Sgshapiro#  endif
194390792Sgshapiro#  ifndef _PATH_SENDMAILPID
194490792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1945363466Sgshapiro#  endif
194690792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
194790792Sgshapiro#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
194890792Sgshapiro# define SM_SET_H_ERRNO(err)	set_h_errno((err))
1949363466Sgshapiro#endif
195090792Sgshapiro# endif /* __svr5__ */
195190792Sgshapiro
195290792Sgshapiro/* ###################################################################### */
195390792Sgshapiro
195490792Sgshapiro/*
195590792Sgshapiro**  UnixWare 2.x
195690792Sgshapiro*/
195790792Sgshapiro
195890792Sgshapiro# ifdef UNIXWARE2
195990792Sgshapiro#  define UNIXWARE	1
196090792Sgshapiro#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
196190792Sgshapiro# endif /* UNIXWARE2 */
196290792Sgshapiro
196390792Sgshapiro
196490792Sgshapiro/*
196590792Sgshapiro**  UnixWare 1.1.2.
196690792Sgshapiro**
196790792Sgshapiro**	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
196890792Sgshapiro**	From Evan Champion <evanc@spatial.synapse.org>.
196990792Sgshapiro*/
197090792Sgshapiro
197190792Sgshapiro# ifdef UNIXWARE
197290792Sgshapiro#  include <sys/mkdev.h>
197390792Sgshapiro#  define SYSTEM5		1
197490792Sgshapiro#  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
197590792Sgshapiro#  define HASSETREUID		1
1976132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
197790792Sgshapiro#  define HASINITGROUPS		1
197890792Sgshapiro#  define GIDSET_T		gid_t
197990792Sgshapiro#  define SLEEP_T		unsigned
198090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
198190792Sgshapiro#  define LA_TYPE		LA_ZERO
198290792Sgshapiro#  undef WIFEXITED
198390792Sgshapiro#  undef WEXITSTATUS
198490792Sgshapiro#  ifndef _PATH_UNIX
198590792Sgshapiro#   define _PATH_UNIX		"/unix"
1986363466Sgshapiro#  endif
198790792Sgshapiro#  ifndef _PATH_VENDOR_CF
198890792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
1989363466Sgshapiro#  endif
199090792Sgshapiro#  ifndef _PATH_SENDMAILPID
199190792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
1992363466Sgshapiro#  endif
199390792Sgshapiro#  define SYSLOG_BUFSIZE	128
199490792Sgshapiro# endif /* UNIXWARE */
199590792Sgshapiro
199690792Sgshapiro
199790792Sgshapiro/*
199890792Sgshapiro**  Intergraph CLIX 3.1
199990792Sgshapiro**
200090792Sgshapiro**	From Paul Southworth <pauls@locust.cic.net>
200190792Sgshapiro*/
200290792Sgshapiro
200390792Sgshapiro# ifdef CLIX
200490792Sgshapiro#  define SYSTEM5	1	/* looks like System V */
200590792Sgshapiro#  ifndef HASGETUSERSHELL
200690792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2007363466Sgshapiro#  endif
200890792Sgshapiro#  define DEV_BSIZE	512	/* device block size not defined */
200990792Sgshapiro#  define GIDSET_T	gid_t
201090792Sgshapiro#  undef LOG			/* syslog not available */
201190792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
201290792Sgshapiro#  define GETSHORT	_getshort
201390792Sgshapiro# endif /* CLIX */
201490792Sgshapiro
201590792Sgshapiro
201690792Sgshapiro/*
201790792Sgshapiro**  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
201890792Sgshapiro**
201990792Sgshapiro**	From Kevin Darcy <kevin@tech.mis.cfc.com>.
202090792Sgshapiro*/
202190792Sgshapiro
202290792Sgshapiro# ifdef NCR_MP_RAS2
202390792Sgshapiro#  include <sys/sockio.h>
202490792Sgshapiro#  define __svr4__
202590792Sgshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
202690792Sgshapiro#  define SYSLOG_BUFSIZE	1024
202790792Sgshapiro#  define SPT_TYPE  SPT_NONE
202890792Sgshapiro# endif /* NCR_MP_RAS2 */
202990792Sgshapiro
203090792Sgshapiro
203190792Sgshapiro/*
203290792Sgshapiro**  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
203390792Sgshapiro**
203490792Sgshapiro**	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
203590792Sgshapiro*/
203690792Sgshapiro
203790792Sgshapiro# ifdef NCR_MP_RAS3
203890792Sgshapiro#  define __svr4__
203990792Sgshapiro#  define HASFCHOWN		1	/* has fchown(2) call */
204090792Sgshapiro#  define LDA_USE_LOCKF		1
204190792Sgshapiro#  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
204290792Sgshapiro#  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
204390792Sgshapiro#  define SYSLOG_BUFSIZE	1024
204490792Sgshapiro#  define SPT_TYPE	SPT_NONE
204590792Sgshapiro#  define _PATH_MAILDIR	"/var/mail"
204690792Sgshapiro#  ifndef _XOPEN_SOURCE
204790792Sgshapiro#   define _XOPEN_SOURCE
204890792Sgshapiro#   define _XOPEN_SOURCE_EXTENDED 1
204990792Sgshapiro#   include <sys/resource.h>
205090792Sgshapiro#   undef _XOPEN_SOURCE
205190792Sgshapiro#   undef _XOPEN_SOURCE_EXTENDED
205290792Sgshapiro#  endif /* ! _XOPEN_SOURCE */
205390792Sgshapiro# endif /* NCR_MP_RAS3 */
205490792Sgshapiro
205590792Sgshapiro
205690792Sgshapiro/*
205790792Sgshapiro**  Tandem NonStop-UX SVR4
205890792Sgshapiro**
205990792Sgshapiro**	From Rick McCarty <mccarty@mpd.tandem.com>.
206090792Sgshapiro*/
206190792Sgshapiro
206290792Sgshapiro# ifdef NonStop_UX_BXX
206390792Sgshapiro#  define __svr4__
206490792Sgshapiro# endif /* NonStop_UX_BXX */
206590792Sgshapiro
206690792Sgshapiro
206790792Sgshapiro/*
206890792Sgshapiro**  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
206990792Sgshapiro**
207090792Sgshapiro**	Tested for 1.04, 1.03
207190792Sgshapiro**	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
207290792Sgshapiro**
207390792Sgshapiro**	Tested for 4.02, 6.10 and 7.10
207490792Sgshapiro**	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
207590792Sgshapiro*/
207690792Sgshapiro
207790792Sgshapiro# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
207890792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
207990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
208090792Sgshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
208190792Sgshapiro#  define setreuid(r, e)	setresuid(r, e, -1)
208290792Sgshapiro#  define LA_TYPE	LA_FLOAT
208390792Sgshapiro#  define SPT_TYPE	SPT_PSTAT
208490792Sgshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
208590792Sgshapiro#  ifndef HASSETVBUF
208690792Sgshapiro#   define HASSETVBUF	/* HI-UX has no setlinebuf */
2087363466Sgshapiro#  endif
208890792Sgshapiro#  ifndef GIDSET_T
208990792Sgshapiro#   define GIDSET_T	gid_t
2090363466Sgshapiro#  endif
209190792Sgshapiro#  ifndef _PATH_UNIX
209290792Sgshapiro#   define _PATH_UNIX		"/HI-UX"
2093363466Sgshapiro#  endif
209490792Sgshapiro#  ifndef _PATH_VENDOR_CF
209590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2096363466Sgshapiro#  endif
209790792Sgshapiro#  ifndef IDENTPROTO
209890792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2099363466Sgshapiro#  endif
210090792Sgshapiro#  ifndef HASGETUSERSHELL
210190792Sgshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
2102363466Sgshapiro#  endif
210390792Sgshapiro#  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
210490792Sgshapiro
210590792Sgshapiro/*
210690792Sgshapiro**  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
210790792Sgshapiro**  on HIUX 3050
210890792Sgshapiro*/
210990792Sgshapiro#  undef m_flags
211090792Sgshapiro
211190792Sgshapiro#  define SM_CONF_SYSLOG	0
211290792Sgshapiro
211390792Sgshapiro# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
211490792Sgshapiro
211590792Sgshapiro
211690792Sgshapiro/*
211790792Sgshapiro**  Amdahl UTS System V 2.1.5 (SVr3-based)
211890792Sgshapiro**
211990792Sgshapiro**    From: Janet Jackson <janet@dialix.oz.au>.
212090792Sgshapiro*/
212190792Sgshapiro
212290792Sgshapiro# ifdef _UTS
212390792Sgshapiro#  include <sys/sysmacros.h>
212490792Sgshapiro#  undef HASLSTAT		/* has symlinks, but they cause problems */
212590792Sgshapiro#  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
212690792Sgshapiro#  define SYS5SIGNALS	1	/* System V signal semantics */
212790792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
212890792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
212990792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) function */
213090792Sgshapiro#  define HASSETVBUF	1	/* has setvbuf(3) function */
213190792Sgshapiro#  ifndef HASGETUSERSHELL
213290792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
2133363466Sgshapiro#  endif
213490792Sgshapiro#  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
213590792Sgshapiro#  define LA_TYPE	LA_ZERO		/* doesn't have load average */
213690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
213790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
213890792Sgshapiro#  define _PATH_UNIX		"/unix"
213990792Sgshapiro#  ifndef _PATH_VENDOR_CF
214090792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2141363466Sgshapiro#  endif
214290792Sgshapiro# endif /* _UTS */
214390792Sgshapiro
214490792Sgshapiro/*
214590792Sgshapiro**  Cray Computer Corporation's CSOS
214690792Sgshapiro**
214790792Sgshapiro**	From Scott Bolte <scott@craycos.com>.
214890792Sgshapiro*/
214990792Sgshapiro
215090792Sgshapiro# ifdef _CRAYCOM
215190792Sgshapiro#  define SYSTEM5	1	/* include all the System V defines */
215290792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
215390792Sgshapiro#  define NEEDFSYNC	1	/* no fsync in system library */
215490792Sgshapiro#  define MAXPATHLEN	PATHSIZE
215590792Sgshapiro#  define LA_TYPE	LA_ZERO
215690792Sgshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
215790792Sgshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
215890792Sgshapiro#  define _POSIX_CHOWN_RESTRICTED	-1
215990792Sgshapiroextern struct group	*getgrent(), *getgrnam(), *getgrgid();
216090792Sgshapiro# endif /* _CRAYCOM */
216190792Sgshapiro
216290792Sgshapiro
216390792Sgshapiro/*
216490792Sgshapiro**  Sony NEWS-OS 4.2.1R and 6.0.3
216590792Sgshapiro**
216690792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
216790792Sgshapiro*/
216890792Sgshapiro
216990792Sgshapiro# ifdef sony_news
217090792Sgshapiro#  ifndef __svr4
217190792Sgshapiro			/* NEWS-OS 4.2.1R */
217290792Sgshapiro#   ifndef BSD
217390792Sgshapiro#    define BSD			/* has BSD routines */
2174363466Sgshapiro#   endif
217590792Sgshapiro#   define HASUNSETENV	1	/* has unsetenv(2) call */
217690792Sgshapiro#   undef HASSETVBUF		/* don't actually have setvbuf(3) */
217790792Sgshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
217890792Sgshapiro#   define LA_TYPE	LA_INT
217990792Sgshapiro#   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
218090792Sgshapiro#   ifndef HASFLOCK
218190792Sgshapiro#    define HASFLOCK	1	/* has flock(2) call */
2182363466Sgshapiro#   endif
218390792Sgshapiro#   define setpgid	setpgrp
218490792Sgshapiro#   undef WIFEXITED
218590792Sgshapiro#   undef WEXITSTATUS
218690792Sgshapiro#   define MODE_T	int	/* system include files have no mode_t */
218790792Sgshapirotypedef int		pid_t;
218890792Sgshapirotypedef int		(*sigfunc_t)();
218990792Sgshapiro#   define SIGFUNC_DEFINED
219090792Sgshapiro#   define SIGFUNC_RETURN	(0)
219190792Sgshapiro#   define SIGFUNC_DECL		int
219290792Sgshapiro
219390792Sgshapiro#  else /* ! __svr4 */
219490792Sgshapiro			/* NEWS-OS 6.0.3 with /bin/cc */
219590792Sgshapiro#   ifndef __svr4__
219690792Sgshapiro#    define __svr4__		/* use all System V Release 4 defines below */
2197363466Sgshapiro#   endif
2198132943Sgshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
219990792Sgshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
220090792Sgshapiro#   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
220190792Sgshapiro#   ifndef SPT_TYPE
220290792Sgshapiro#    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
2203363466Sgshapiro#   endif
220490792Sgshapiro#   define GIDSET_T	gid_t
220590792Sgshapiro#   undef WIFEXITED
220690792Sgshapiro#   undef WEXITSTATUS
220790792Sgshapiro#   ifndef SYSLOG_BUFSIZE
220890792Sgshapiro#    define SYSLOG_BUFSIZE	256
2209363466Sgshapiro#   endif
221090792Sgshapiro#   define _PATH_UNIX		"/stand/unix"
221190792Sgshapiro#   ifndef _PATH_VENDOR_CF
221290792Sgshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2213363466Sgshapiro#   endif
221490792Sgshapiro#   ifndef _PATH_SENDMAILPID
221590792Sgshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2216363466Sgshapiro#   endif
221790792Sgshapiro
221890792Sgshapiro#  endif /* ! __svr4 */
221990792Sgshapiro# endif /* sony_news */
222090792Sgshapiro
222190792Sgshapiro
222290792Sgshapiro/*
222390792Sgshapiro**  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
222490792Sgshapiro**
222590792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
222690792Sgshapiro*/
222790792Sgshapiro
222890792Sgshapiro# ifdef luna
222990792Sgshapiro#  ifndef IDENTPROTO
223090792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2231363466Sgshapiro#  endif
223290792Sgshapiro#  define HASUNSETENV	1	/* has unsetenv(2) call */
223390792Sgshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
223490792Sgshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
223590792Sgshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
223690792Sgshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
223790792Sgshapiro#  ifdef uniosb
223890792Sgshapiro#   include <sys/time.h>
223990792Sgshapiro#   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
224090792Sgshapiro#   define LA_TYPE	LA_INT
224190792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
224290792Sgshapiro#  endif /* uniosb */
224390792Sgshapiro#  ifdef luna2
224490792Sgshapiro#   define LA_TYPE	LA_SUBR
224590792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
224690792Sgshapiro#  endif /* luna2 */
224790792Sgshapiro#  ifdef luna88k
224890792Sgshapiro#   define LA_TYPE	LA_INT
2249363466Sgshapiro#  endif
225090792Sgshapiro#  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
225190792Sgshapiro#  define setpgid	setpgrp
225290792Sgshapiro#  undef WIFEXITED
225390792Sgshapiro#  undef WEXITSTATUS
225490792Sgshapirotypedef int		pid_t;
225590792Sgshapirotypedef int		(*sigfunc_t)();
225690792Sgshapiro#  define SIGFUNC_DEFINED
225790792Sgshapiro#  define SIGFUNC_RETURN	(0)
225890792Sgshapiro#  define SIGFUNC_DECL	int
225990792Sgshapiroextern char	*getenv();
226090792Sgshapiro#  ifndef _PATH_VENDOR_CF
226190792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
226290792Sgshapiro#  endif /* ! _PATH_VENDOR_CF */
226390792Sgshapiro# endif /* luna */
226490792Sgshapiro
226590792Sgshapiro
226690792Sgshapiro/*
226790792Sgshapiro**  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
226890792Sgshapiro**
226990792Sgshapiro**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
227090792Sgshapiro*/
227190792Sgshapiro
227290792Sgshapiro# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
227390792Sgshapiro#  ifndef __svr4__
227490792Sgshapiro#   define __svr4__		/* use all System V Release 4 defines below */
2275363466Sgshapiro#  endif
227690792Sgshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2277132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
227890792Sgshapiro#  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
227990792Sgshapiro#  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
228090792Sgshapiro#  define GIDSET_T	gid_t
228190792Sgshapiro#  undef WIFEXITED
228290792Sgshapiro#  undef WEXITSTATUS
228390792Sgshapiro#  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
228490792Sgshapiro#  ifndef _PATH_VENDOR_CF
228590792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2286363466Sgshapiro#  endif
228790792Sgshapiro#  ifndef _PATH_SENDMAILPID
228890792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2289363466Sgshapiro#  endif
229090792Sgshapiro#  ifndef SYSLOG_BUFSIZE
229190792Sgshapiro#   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
2292363466Sgshapiro#  endif
229390792Sgshapiro# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
229490792Sgshapiro
229590792Sgshapiro
229690792Sgshapiro/*
229790792Sgshapiro**  Fujitsu/ICL UXP/DS (For the DS/90 Series)
229890792Sgshapiro**
229990792Sgshapiro**	From Diego R. Lopez <drlopez@cica.es>.
230090792Sgshapiro**	Additional changes from Fumio Moriya and Toshiaki Nomura of the
230190792Sgshapiro**		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
230290792Sgshapiro*/
230390792Sgshapiro
230490792Sgshapiro# ifdef __uxp__
230590792Sgshapiro#  include <arpa/nameser.h>
230690792Sgshapiro#  include <sys/sysmacros.h>
230790792Sgshapiro#  include <sys/mkdev.h>
230890792Sgshapiro#  define __svr4__
230990792Sgshapiro#  define HASGETUSERSHELL	0
231090792Sgshapiro#  define HASFLOCK		0
231190792Sgshapiro#  define _PATH_UNIX		"/stand/unix"
231290792Sgshapiro#  ifndef _PATH_VENDOR_CF
231390792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2314363466Sgshapiro#  endif
231590792Sgshapiro#  ifndef _PATH_SENDMAILPID
231690792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2317363466Sgshapiro#  endif
231890792Sgshapiro# endif /* __uxp__ */
231990792Sgshapiro
232090792Sgshapiro/*
232190792Sgshapiro**  Pyramid DC/OSx
232290792Sgshapiro**
232390792Sgshapiro**	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
232490792Sgshapiro*/
232590792Sgshapiro
232690792Sgshapiro# ifdef DCOSx
232790792Sgshapiro#  define GIDSET_T	gid_t
232890792Sgshapiro#  ifndef IDENTPROTO
232990792Sgshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2330363466Sgshapiro#  endif
233190792Sgshapiro# endif /* DCOSx */
233290792Sgshapiro
233390792Sgshapiro/*
233490792Sgshapiro**  Concurrent Computer Corporation Maxion
233590792Sgshapiro**
233690792Sgshapiro**	From Donald R. Laster Jr. <laster@access.digex.net>.
233790792Sgshapiro*/
233890792Sgshapiro
233990792Sgshapiro# ifdef __MAXION__
234090792Sgshapiro
234190792Sgshapiro#  include <sys/stream.h>
234290792Sgshapiro#  define __svr4__		1	/* SVR4.2MP */
234390792Sgshapiro#  define HASSETREUID		1	/* have setreuid(2) */
234490792Sgshapiro#  define HASLSTAT		1	/* have lstat(2) */
234590792Sgshapiro#  define HASSETRLIMIT		1	/* have setrlimit(2) */
234690792Sgshapiro#  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
234790792Sgshapiro#  define HASGETUSERSHELL	1	/* have getusershell(3) */
234890792Sgshapiro#  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
234990792Sgshapiro#  define SLEEP_T		unsigned
235090792Sgshapiro#  define SFS_TYPE		SFS_STATVFS
235190792Sgshapiro#  define SFS_BAVAIL		f_bavail
235290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
235390792Sgshapiro#   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
2354363466Sgshapiro#  endif
235590792Sgshapiro
235690792Sgshapiro#  undef WUNTRACED
235790792Sgshapiro#  undef WIFEXITED
235890792Sgshapiro#  undef WIFSIGNALED
235990792Sgshapiro#  undef WIFSTOPPED
236090792Sgshapiro#  undef WEXITSTATUS
236190792Sgshapiro#  undef WTERMSIG
236290792Sgshapiro#  undef WSTOPSIG
236390792Sgshapiro
236490792Sgshapiro# endif /* __MAXION__ */
236590792Sgshapiro
236690792Sgshapiro/*
236790792Sgshapiro**  Harris Nighthawk PowerUX (nh6000 box)
236890792Sgshapiro**
236990792Sgshapiro**  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
237090792Sgshapiro*/
237190792Sgshapiro
237290792Sgshapiro# ifdef _PowerUX
237390792Sgshapiro#  ifndef __svr4__
237490792Sgshapiro#   define __svr4__
2375363466Sgshapiro#  endif
237690792Sgshapiro#  ifndef _PATH_VENDOR_CF
237790792Sgshapiro#   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2378363466Sgshapiro#  endif
237990792Sgshapiro#  ifndef _PATH_SENDMAILPID
238090792Sgshapiro#   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2381363466Sgshapiro#  endif
238290792Sgshapiro#  define SYSLOG_BUFSIZE		1024
238390792Sgshapiro#  define LA_TYPE		LA_ZERO
238490792Sgshapirotypedef struct msgb		mblk_t;
238590792Sgshapiro#  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
238690792Sgshapiro# endif /* _PowerUX */
238790792Sgshapiro
238890792Sgshapiro/*
238990792Sgshapiro**  Siemens Nixdorf Informationssysteme AG SINIX
239090792Sgshapiro**
239190792Sgshapiro**	Contributed by Gerald Rinske of Siemens Business Services VAS.
239290792Sgshapiro*/
239390792Sgshapiro# ifdef sinix
239490792Sgshapiro#  define HASRANDOM		0	/* has random(3) */
239590792Sgshapiro#  define SYSLOG_BUFSIZE	1024
239690792Sgshapiro#  define SM_INT32		int	/* 32bit integer */
239790792Sgshapiro# endif /* sinix */
239890792Sgshapiro
239990792Sgshapiro
240090792Sgshapiro/*
240190792Sgshapiro**  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
240290792Sgshapiro**
240390792Sgshapiro**	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
240490792Sgshapiro*/
240590792Sgshapiro
240690792Sgshapiro# ifdef MOTO
240790792Sgshapiro#  define HASFCHMOD		1
240890792Sgshapiro#  define HASSETRLIMIT		0
2409132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
241090792Sgshapiro#  define HASSETREUID		1
241190792Sgshapiro#  define HASULIMIT		1
241290792Sgshapiro#  define HASWAITPID		1
241390792Sgshapiro#  define HASGETDTABLESIZE	1
241490792Sgshapiro#  define HASGETUSERSHELL	1
241590792Sgshapiro#  define IP_SRCROUTE		0
241690792Sgshapiro#  define IDENTPROTO		0
241790792Sgshapiro#  define RES_DNSRCH_VARIABLE	_res_dnsrch
241890792Sgshapiro#  define _PATH_UNIX		"/unix"
241990792Sgshapiro#  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
242090792Sgshapiro#  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
242190792Sgshapiro# endif /* MOTO */
242290792Sgshapiro
2423110560Sgshapiro/*
2424110560Sgshapiro**  Interix
2425110560Sgshapiro**	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2426110560Sgshapiro**
2427110560Sgshapiro**	Used for Interix support.
2428110560Sgshapiro*/
242990792Sgshapiro
2430110560Sgshapiro# if defined(__INTERIX)
2431110560Sgshapiro#  define HASURANDOMDEV		1
2432110560Sgshapiro#  define HASGETUSERSHELL	0
2433110560Sgshapiro#  define HASSTRERROR		1
2434110560Sgshapiro#  define HASUNSETENV		1
2435110560Sgshapiro#  define HASFCHOWN		1
2436110560Sgshapiro#  undef HAVE_SYS_ERRLIST
2437110560Sgshapiro#  define sys_errlist		__sys_errlist
2438110560Sgshapiro#  define sys_nerr		__sys_nerr
2439132943Sgshapiro#  include <sys/mkdev.h>
2440132943Sgshapiro#  ifndef major
2441132943Sgshapiro#   define major(dev)		((int)(((dev) >> 8) & 0xff))
2442363466Sgshapiro#  endif
2443132943Sgshapiro#  ifndef minor
2444132943Sgshapiro#   define minor(dev)		((int)((dev) & 0xff))
2445363466Sgshapiro#  endif
2446110560Sgshapiro# endif /* defined(__INTERIX) */
2447110560Sgshapiro
2448110560Sgshapiro
244990792Sgshapiro/**********************************************************************
245090792Sgshapiro**  End of Per-Operating System defines
245190792Sgshapiro**********************************************************************/
245290792Sgshapiro/**********************************************************************
245390792Sgshapiro**  More general defines
245490792Sgshapiro**********************************************************************/
245590792Sgshapiro
245690792Sgshapiro/* general BSD defines */
245790792Sgshapiro# ifdef BSD
245890792Sgshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
245990792Sgshapiro#  ifndef HASSETREUID
246090792Sgshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
2461363466Sgshapiro#  endif
246290792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
246390792Sgshapiro#  ifndef IP_SRCROUTE
246490792Sgshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
2465363466Sgshapiro#  endif
246690792Sgshapiro#  ifndef HASSETRLIMIT
246790792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2468363466Sgshapiro#  endif
246990792Sgshapiro#  ifndef HASFLOCK
247090792Sgshapiro#   define HASFLOCK	1	/* has flock(2) call */
2471363466Sgshapiro#  endif
247290792Sgshapiro#  ifndef TZ_TYPE
247390792Sgshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
2474363466Sgshapiro#  endif
247590792Sgshapiro# endif /* BSD */
247690792Sgshapiro
247790792Sgshapiro/* general System V Release 4 defines */
247890792Sgshapiro# ifdef __svr4__
247990792Sgshapiro#  define SYSTEM5	1
248090792Sgshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
248190792Sgshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
248290792Sgshapiro#  define BSD_COMP	1	/* get BSD ioctl calls */
248390792Sgshapiro#  ifndef HASSETRLIMIT
248490792Sgshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2485363466Sgshapiro#  endif
248690792Sgshapiro#  ifndef HASGETUSERSHELL
248790792Sgshapiro#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2488363466Sgshapiro#  endif
248990792Sgshapiro#  ifndef HASFCHMOD
249090792Sgshapiro#   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
2491363466Sgshapiro#  endif
249290792Sgshapiro
249390792Sgshapiro#  ifndef _PATH_UNIX
249490792Sgshapiro#   define _PATH_UNIX		"/unix"
2495363466Sgshapiro#  endif
249690792Sgshapiro#  ifndef _PATH_VENDOR_CF
249790792Sgshapiro#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2498363466Sgshapiro#  endif
249990792Sgshapiro#  ifndef _PATH_SENDMAILPID
250090792Sgshapiro#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2501363466Sgshapiro#  endif
250290792Sgshapiro#  ifndef SYSLOG_BUFSIZE
250390792Sgshapiro#   define SYSLOG_BUFSIZE	128
2504363466Sgshapiro#  endif
250590792Sgshapiro#  ifndef SFS_TYPE
250690792Sgshapiro#   define SFS_TYPE		SFS_STATVFS
2507363466Sgshapiro#  endif
250890792Sgshapiro
250990792Sgshapiro#  ifndef USE_SIGLONGJMP
251090792Sgshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
2511363466Sgshapiro#  endif
251290792Sgshapiro# endif /* __svr4__ */
251390792Sgshapiro
251490792Sgshapiro# ifdef __SVR4
251590792Sgshapiro#  define LDA_USE_LOCKF		1
251690792Sgshapiro#  define LDA_USE_SETEUID	1
251790792Sgshapiro#  define _PATH_MAILDIR		"/var/mail"
251890792Sgshapiro# endif /* __SVR4 */
251990792Sgshapiro
252090792Sgshapiro/* general System V defines */
252190792Sgshapiro# ifdef SYSTEM5
252290792Sgshapiro#  include <sys/sysmacros.h>
252390792Sgshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
252490792Sgshapiro#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
252590792Sgshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
252690792Sgshapiro#  ifndef HASULIMIT
252790792Sgshapiro#   define HASULIMIT	1	/* has the ulimit(2) syscall */
2528363466Sgshapiro#  endif
252990792Sgshapiro#  ifndef LA_TYPE
253090792Sgshapiro#   ifdef MIOC_READKSYM
253190792Sgshapiro#    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2532363466Sgshapiro#   else
253390792Sgshapiro#    define LA_TYPE	LA_INT		/* assume integer load average */
2534363466Sgshapiro#   endif
253590792Sgshapiro#  endif /* ! LA_TYPE */
253690792Sgshapiro#  ifndef SFS_TYPE
253790792Sgshapiro#   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2538363466Sgshapiro#  endif
253990792Sgshapiro#  ifndef TZ_TYPE
254090792Sgshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2541363466Sgshapiro#  endif
254290792Sgshapiro# endif /* SYSTEM5 */
254390792Sgshapiro
254490792Sgshapiro/* general POSIX defines */
254590792Sgshapiro# ifdef _POSIX_VERSION
2546132943Sgshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
2547132943Sgshapiro#  define HASWAITPID	1	/* has POSIX waitpid(2) call */
254890792Sgshapiro#  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
254990792Sgshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
255090792Sgshapiro#  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
255190792Sgshapiro# endif /* _POSIX_VERSION */
255290792Sgshapiro/*
255390792Sgshapiro**  Tweaking for systems that (for example) claim to be BSD or POSIX
255490792Sgshapiro**  but don't have all the standard BSD or POSIX routines (boo hiss).
255590792Sgshapiro*/
255690792Sgshapiro
255790792Sgshapiro# ifdef titan
255890792Sgshapiro#  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
2559363466Sgshapiro# endif
256090792Sgshapiro
256190792Sgshapiro# ifdef _CRAYCOM
256290792Sgshapiro#  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
2563363466Sgshapiro# endif
256490792Sgshapiro
256590792Sgshapiro# ifdef MOTO
256690792Sgshapiro#  undef USESETEUID
2567363466Sgshapiro# endif
256890792Sgshapiro
256990792Sgshapiro/*
257090792Sgshapiro**  Due to a "feature" in some operating systems such as Ultrix 4.3 and
257190792Sgshapiro**  HPUX 8.0, if you receive a "No route to host" message (ICMP message
257290792Sgshapiro**  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
257390792Sgshapiro**  are closed.  Some firewalls return this error if you try to connect
257490792Sgshapiro**  to the IDENT port (113), so you can't receive email from these hosts
257590792Sgshapiro**  on these systems.  The firewall really should use a more specific
257690792Sgshapiro**  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
257790792Sgshapiro**  not explicitly set to zero above, default it on.
257890792Sgshapiro*/
257990792Sgshapiro
258090792Sgshapiro# ifndef IDENTPROTO
258190792Sgshapiro#  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
2582363466Sgshapiro# endif
258390792Sgshapiro
258490792Sgshapiro# ifndef IP_SRCROUTE
258590792Sgshapiro#  define IP_SRCROUTE	1	/* Detect IP source routing */
2586363466Sgshapiro# endif
258790792Sgshapiro
258890792Sgshapiro# ifndef HASGETUSERSHELL
258990792Sgshapiro#  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
2590363466Sgshapiro# endif
259190792Sgshapiro
259290792Sgshapiro# ifndef NETUNIX
259390792Sgshapiro#  define NETUNIX	1	/* include unix domain support */
2594363466Sgshapiro# endif
259590792Sgshapiro
259690792Sgshapiro# ifndef HASRANDOM
259790792Sgshapiro#  define HASRANDOM	1	/* has random(3) support */
2598363466Sgshapiro# endif
259990792Sgshapiro
260090792Sgshapiro# ifndef HASFLOCK
260190792Sgshapiro#  define HASFLOCK	0	/* assume no flock(2) support */
2602363466Sgshapiro# endif
260390792Sgshapiro
260490792Sgshapiro# ifndef HASSETREUID
260590792Sgshapiro#  define HASSETREUID	0	/* assume no setreuid(2) call */
2606363466Sgshapiro# endif
260790792Sgshapiro
260890792Sgshapiro# ifndef HASFCHMOD
260990792Sgshapiro#  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
2610363466Sgshapiro# endif
261190792Sgshapiro
261290792Sgshapiro# ifndef USESETEUID
261390792Sgshapiro#  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
2614363466Sgshapiro# endif
261590792Sgshapiro
261690792Sgshapiro# ifndef HASSETRLIMIT
261790792Sgshapiro#  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
2618363466Sgshapiro# endif
261990792Sgshapiro
262090792Sgshapiro# ifndef HASULIMIT
262190792Sgshapiro#  define HASULIMIT	0	/* assume no ulimit(2) support */
2622363466Sgshapiro# endif
262390792Sgshapiro
262490792Sgshapiro# ifndef SECUREWARE
262590792Sgshapiro#  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
2626363466Sgshapiro# endif
262790792Sgshapiro
262890792Sgshapiro# ifndef USE_DOUBLE_FORK
262990792Sgshapiro#  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
2630363466Sgshapiro# endif
263190792Sgshapiro
263290792Sgshapiro# ifndef USE_ENVIRON
263390792Sgshapiro#  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
2634363466Sgshapiro# endif
263590792Sgshapiro
263690792Sgshapiro# ifndef USE_SIGLONGJMP
263790792Sgshapiro#  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
2638363466Sgshapiro# endif
263990792Sgshapiro
264090792Sgshapiro# ifndef FDSET_CAST
264190792Sgshapiro#  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
2642363466Sgshapiro# endif
264390792Sgshapiro
264490792Sgshapiro/*
264590792Sgshapiro**  Pick a mailer setuid method for changing the current uid
264690792Sgshapiro*/
264790792Sgshapiro
264890792Sgshapiro# define USE_SETEUID	0
264990792Sgshapiro# define USE_SETREUID	1
265090792Sgshapiro# define USE_SETUID	2
265190792Sgshapiro
265290792Sgshapiro# if USESETEUID
265390792Sgshapiro#  define MAILER_SETUID_METHOD	USE_SETEUID
265490792Sgshapiro# else /* USESETEUID */
265590792Sgshapiro#  if HASSETREUID
265690792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETREUID
2657363466Sgshapiro#  else
265890792Sgshapiro#   define MAILER_SETUID_METHOD	USE_SETUID
2659363466Sgshapiro#  endif
266090792Sgshapiro# endif /* USESETEUID */
266190792Sgshapiro
266290792Sgshapiro/*
266390792Sgshapiro**  If no type for argument two of getgroups call is defined, assume
266490792Sgshapiro**  it's an integer -- unfortunately, there seem to be several choices
266590792Sgshapiro**  here.
266690792Sgshapiro*/
266790792Sgshapiro
266890792Sgshapiro# ifndef GIDSET_T
266990792Sgshapiro#  define GIDSET_T	int
2670363466Sgshapiro# endif
267190792Sgshapiro
267290792Sgshapiro# ifndef UID_T
267390792Sgshapiro#  define UID_T		uid_t
2674363466Sgshapiro# endif
267590792Sgshapiro
267690792Sgshapiro# ifndef GID_T
267790792Sgshapiro#  define GID_T		gid_t
2678363466Sgshapiro# endif
267990792Sgshapiro
268090792Sgshapiro# ifndef MODE_T
268190792Sgshapiro#  define MODE_T		mode_t
2682363466Sgshapiro# endif
268390792Sgshapiro
268490792Sgshapiro# ifndef ARGV_T
268590792Sgshapiro#  define ARGV_T		char **
2686363466Sgshapiro# endif
268790792Sgshapiro
268890792Sgshapiro# ifndef SOCKADDR_LEN_T
268990792Sgshapiro#  define SOCKADDR_LEN_T	int
2690363466Sgshapiro# endif
269190792Sgshapiro
269290792Sgshapiro# ifndef SOCKOPT_LEN_T
269390792Sgshapiro#  define SOCKOPT_LEN_T	int
2694363466Sgshapiro# endif
269590792Sgshapiro
269690792Sgshapiro# ifndef QUAD_T
269790792Sgshapiro#  define QUAD_T	unsigned long
2698363466Sgshapiro# endif
269990792Sgshapiro/**********************************************************************
270090792Sgshapiro**  Remaining definitions should never have to be changed.  They are
270190792Sgshapiro**  primarily to provide back compatibility for older systems -- for
270290792Sgshapiro**  example, it includes some POSIX compatibility definitions
270390792Sgshapiro**********************************************************************/
270490792Sgshapiro
270590792Sgshapiro/* System 5 compatibility */
270690792Sgshapiro# ifndef S_ISREG
270790792Sgshapiro#  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
2708363466Sgshapiro# endif
270990792Sgshapiro# ifndef S_ISDIR
271090792Sgshapiro#  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
2711363466Sgshapiro# endif
271290792Sgshapiro# if !defined(S_ISLNK) && defined(S_IFLNK)
271390792Sgshapiro#  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
2714363466Sgshapiro# endif
271590792Sgshapiro# if !defined(S_ISFIFO)
271690792Sgshapiro#  if defined(S_IFIFO)
271790792Sgshapiro#   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
2718363466Sgshapiro#  else
271990792Sgshapiro#   define S_ISFIFO(foo)	false
2720363466Sgshapiro#  endif
272190792Sgshapiro# endif /* !defined(S_ISFIFO) */
272290792Sgshapiro# ifndef S_IRUSR
272390792Sgshapiro#  define S_IRUSR		0400
2724363466Sgshapiro# endif
272590792Sgshapiro# ifndef S_IWUSR
272690792Sgshapiro#  define S_IWUSR		0200
2727363466Sgshapiro# endif
272890792Sgshapiro# ifndef S_IRGRP
272990792Sgshapiro#  define S_IRGRP		0040
2730363466Sgshapiro# endif
273190792Sgshapiro# ifndef S_IWGRP
273290792Sgshapiro#  define S_IWGRP		0020
2733363466Sgshapiro# endif
273490792Sgshapiro# ifndef S_IROTH
273590792Sgshapiro#  define S_IROTH		0004
2736363466Sgshapiro# endif
273790792Sgshapiro# ifndef S_IWOTH
273890792Sgshapiro#  define S_IWOTH		0002
2739363466Sgshapiro# endif
274090792Sgshapiro
274190792Sgshapiro/* close-on-exec flag */
274290792Sgshapiro# ifndef FD_CLOEXEC
274390792Sgshapiro#  define FD_CLOEXEC	1
2744363466Sgshapiro# endif
274590792Sgshapiro
274690792Sgshapiro/*
274790792Sgshapiro**  Older systems don't have this error code -- it should be in
274890792Sgshapiro**  /usr/include/sysexits.h.
274990792Sgshapiro*/
275090792Sgshapiro
275190792Sgshapiro# ifndef EX_CONFIG
275290792Sgshapiro#  define EX_CONFIG	78	/* configuration error */
2753363466Sgshapiro# endif
275490792Sgshapiro
275590792Sgshapiro/* pseudo-codes */
2756120256Sgshapiro# define EX_QUIT	22	/* drop out of server immediately */
275790792Sgshapiro# define EX_RESTART	23	/* restart sendmail daemon */
275890792Sgshapiro# define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
275990792Sgshapiro
276090792Sgshapiro#ifndef EX_NOTFOUND
276190792Sgshapiro# define EX_NOTFOUND	EX_NOHOST
2762363466Sgshapiro#endif
276390792Sgshapiro
276490792Sgshapiro/* pseudo-code used for mci_setstat */
2765132943Sgshapiro# define EX_NOTSTICKY	(-5)	/* don't save persistent status */
276690792Sgshapiro
276790792Sgshapiro
276890792Sgshapiro/*
276990792Sgshapiro**  An "impossible" file mode to indicate that the file does not exist.
277090792Sgshapiro*/
277190792Sgshapiro
277290792Sgshapiro# define ST_MODE_NOFILE	0171147		/* unlikely to occur */
277390792Sgshapiro
277490792Sgshapiro
277590792Sgshapiro/* type of arbitrary pointer */
277690792Sgshapiro# ifndef ARBPTR_T
277790792Sgshapiro#  define ARBPTR_T	void *
2778363466Sgshapiro# endif
277990792Sgshapiro
278090792Sgshapiro# ifndef __P
278190792Sgshapiro#  include "sm/cdefs.h"
2782363466Sgshapiro# endif
278390792Sgshapiro
278490792Sgshapiro# if HESIOD && !defined(NAMED_BIND)
278590792Sgshapiro#  define NAMED_BIND	1	/* not one without the other */
2786363466Sgshapiro# endif
278790792Sgshapiro
278890792Sgshapiro#  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
278990792Sgshapiroextern int	h_errno;
2790363466Sgshapiro#  endif
279190792Sgshapiro
279290792Sgshapiro# if NEEDPUTENV
279390792Sgshapiroextern int	putenv __P((char *));
2794363466Sgshapiro# endif
279590792Sgshapiro
279690792Sgshapiro#if !HASUNSETENV
279790792Sgshapiroextern void	unsetenv __P((char *));
2798363466Sgshapiro#endif
279990792Sgshapiro
280090792Sgshapiro# ifdef LDAPMAP
280190792Sgshapiro#  include <sys/time.h>
280290792Sgshapiro#  include <lber.h>
280390792Sgshapiro#  include <ldap.h>
280490792Sgshapiro
280590792Sgshapiro/* Some LDAP constants */
280690792Sgshapiro#  define LDAPMAP_FALSE		0
280790792Sgshapiro#  define LDAPMAP_TRUE		1
280890792Sgshapiro
280990792Sgshapiro/*
281090792Sgshapiro**  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
281190792Sgshapiro**  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
281290792Sgshapiro**  and assume (falsely) that all old API implementations are broken.
281390792Sgshapiro**  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
281490792Sgshapiro*/
281590792Sgshapiro
281690792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
281790792Sgshapiro#   define USE_LDAP_INIT	1
2818363466Sgshapiro#  endif
281990792Sgshapiro
2820363466Sgshapiro#  if !defined(LDAP_NETWORK_TIMEOUT) && defined(_FFR_LDAP_NETWORK_TIMEOUT)
2821363466Sgshapiro#   define LDAP_NETWORK_TIMEOUT	_FFR_LDAP_NETWORK_TIMEOUT
2822363466Sgshapiro#  endif
2823363466Sgshapiro
2824363466Sgshapiro#  if !defined(LDAP_NETWORK_TIMEOUT) && defined(LDAP_OPT_NETWORK_TIMEOUT)
2825363466Sgshapiro#   define LDAP_NETWORK_TIMEOUT	1
2826363466Sgshapiro#  endif
2827363466Sgshapiro
282890792Sgshapiro/*
282990792Sgshapiro**  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
283090792Sgshapiro**  hence ldap_set_option() must not exist.
283190792Sgshapiro*/
283290792Sgshapiro
283390792Sgshapiro#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
283490792Sgshapiro#   define USE_LDAP_SET_OPTION	1
2835363466Sgshapiro#  endif
283690792Sgshapiro
283790792Sgshapiro# endif /* LDAPMAP */
283890792Sgshapiro
283990792Sgshapiro# if HASUNAME
284090792Sgshapiro#  include <sys/utsname.h>
284190792Sgshapiro#  ifdef newstr
284290792Sgshapiro#   undef newstr
2843363466Sgshapiro#  endif
284490792Sgshapiro# else /* HASUNAME */
284590792Sgshapiro#  define NODE_LENGTH 32
284690792Sgshapirostruct utsname
284790792Sgshapiro{
284890792Sgshapiro	char nodename[NODE_LENGTH + 1];
284990792Sgshapiro};
285090792Sgshapiro# endif /* HASUNAME */
285190792Sgshapiro
285290792Sgshapiro# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
285390792Sgshapiro#  define MAXHOSTNAMELEN	256
2854363466Sgshapiro# endif
285590792Sgshapiro
2856203004Sgshapiro
2857363466Sgshapiro# if defined(__linux__) && MAXHOSTNAMELEN < 255
2858203004Sgshapiro   /*
2859223067Sgshapiro   **  override Linux weirdness: a FQHN can be 255 chars long
2860203004Sgshapiro   **  SUSv3 requires HOST_NAME_MAX ("Maximum length of a host
2861203004Sgshapiro   **  name (not including the terminating null) as returned from the
2862203004Sgshapiro   **  gethostname() function.") to be at least 255.  c.f.:
2863203004Sgshapiro   **  http://www.opengroup.org/onlinepubs/009695399
2864203004Sgshapiro   **  but Linux defines that to 64 too.
2865203004Sgshapiro   */
2866203004Sgshapiro#  undef MAXHOSTNAMELEN
2867203004Sgshapiro#  define MAXHOSTNAMELEN	256
2868363466Sgshapiro# endif /* defined(__linux__) && MAXHOSTNAMELEN < 255 */
2869203004Sgshapiro
287090792Sgshapiro# if !defined(SIGCHLD) && defined(SIGCLD)
287190792Sgshapiro#  define SIGCHLD	SIGCLD
2872363466Sgshapiro# endif
287390792Sgshapiro
287490792Sgshapiro# ifndef STDIN_FILENO
287590792Sgshapiro#  define STDIN_FILENO	0
2876363466Sgshapiro# endif
287790792Sgshapiro
287890792Sgshapiro# ifndef STDOUT_FILENO
287990792Sgshapiro#  define STDOUT_FILENO	1
2880363466Sgshapiro# endif
288190792Sgshapiro
288290792Sgshapiro# ifndef STDERR_FILENO
288390792Sgshapiro#  define STDERR_FILENO	2
2884363466Sgshapiro# endif
288590792Sgshapiro
288690792Sgshapiro# ifndef LOCK_SH
288790792Sgshapiro#  define LOCK_SH	0x01	/* shared lock */
288890792Sgshapiro#  define LOCK_EX	0x02	/* exclusive lock */
288990792Sgshapiro#  define LOCK_NB	0x04	/* non-blocking lock */
289090792Sgshapiro#  define LOCK_UN	0x08	/* unlock */
289190792Sgshapiro# endif /* ! LOCK_SH */
289290792Sgshapiro
289390792Sgshapiro# ifndef S_IXOTH
289490792Sgshapiro#  define S_IXOTH	(S_IEXEC >> 6)
2895363466Sgshapiro# endif
289690792Sgshapiro
289790792Sgshapiro# ifndef S_IXGRP
289890792Sgshapiro#  define S_IXGRP	(S_IEXEC >> 3)
2899363466Sgshapiro# endif
290090792Sgshapiro
290190792Sgshapiro# ifndef S_IXUSR
290290792Sgshapiro#  define S_IXUSR	(S_IEXEC)
2903363466Sgshapiro# endif
290490792Sgshapiro
290590792Sgshapiro#ifndef O_ACCMODE
290690792Sgshapiro# define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
2907363466Sgshapiro#endif
290890792Sgshapiro
290990792Sgshapiro# ifndef SEEK_SET
291090792Sgshapiro#  define SEEK_SET	0
291190792Sgshapiro#  define SEEK_CUR	1
291290792Sgshapiro#  define SEEK_END	2
291390792Sgshapiro# endif /* ! SEEK_SET */
291490792Sgshapiro
291590792Sgshapiro# ifndef SIG_ERR
291690792Sgshapiro#  define SIG_ERR	((void (*)()) -1)
2917363466Sgshapiro# endif
291890792Sgshapiro
291990792Sgshapiro# ifndef WEXITSTATUS
292090792Sgshapiro#  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
2921363466Sgshapiro# endif
292290792Sgshapiro# ifndef WIFEXITED
292390792Sgshapiro#  define WIFEXITED(st)		(((st) & 0377) == 0)
2924363466Sgshapiro# endif
292590792Sgshapiro# ifndef WIFSTOPPED
292690792Sgshapiro#  define WIFSTOPPED(st)		(((st) & 0100) == 0)
2927363466Sgshapiro# endif
292890792Sgshapiro# ifndef WCOREDUMP
292990792Sgshapiro#  define WCOREDUMP(st)		(((st) & 0200) != 0)
2930363466Sgshapiro# endif
293190792Sgshapiro# ifndef WTERMSIG
293290792Sgshapiro#  define WTERMSIG(st)		(((st) & 0177))
2933363466Sgshapiro# endif
293490792Sgshapiro
293590792Sgshapiro# ifndef SIGFUNC_DEFINED
293690792Sgshapirotypedef void		(*sigfunc_t) __P((int));
2937363466Sgshapiro# endif
293890792Sgshapiro# ifndef SIGFUNC_RETURN
293990792Sgshapiro#  define SIGFUNC_RETURN
2940363466Sgshapiro# endif
294190792Sgshapiro# ifndef SIGFUNC_DECL
294290792Sgshapiro#  define SIGFUNC_DECL	void
2943363466Sgshapiro# endif
294490792Sgshapiro
294590792Sgshapiro/* size of syslog buffer */
294690792Sgshapiro# ifndef SYSLOG_BUFSIZE
294790792Sgshapiro#  define SYSLOG_BUFSIZE	1024
2948363466Sgshapiro# endif
294990792Sgshapiro
2950110560Sgshapiro/* for FD_SET() */
2951110560Sgshapiro#ifndef FD_SETSIZE
2952110560Sgshapiro# define FD_SETSIZE	256
2953363466Sgshapiro#endif
2954110560Sgshapiro
2955285229Sgshapiro#ifndef SIGWAIT_TAKES_1_ARG
2956285229Sgshapiro# define SIGWAIT_TAKES_1_ARG	0
2957363466Sgshapiro#endif
2958285229Sgshapiro
295990792Sgshapiro/*
296090792Sgshapiro**  Size of prescan buffer.
296190792Sgshapiro**	Despite comments in the _sendmail_ book, this probably should
296290792Sgshapiro**	not be changed; there are some hard-to-define dependencies.
296390792Sgshapiro*/
296490792Sgshapiro
296590792Sgshapiro# define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
296690792Sgshapiro
296790792Sgshapiro/* fork routine -- set above using #ifdef _osname_ or in Makefile */
296890792Sgshapiro# ifndef FORK
296990792Sgshapiro#  define FORK		fork		/* function to call to fork mailer */
2970363466Sgshapiro# endif
297190792Sgshapiro
297290792Sgshapiro/* setting h_errno */
297390792Sgshapiro# ifndef SM_SET_H_ERRNO
297490792Sgshapiro#  define SM_SET_H_ERRNO(err)	h_errno = (err)
2975363466Sgshapiro# endif
297690792Sgshapiro
297790792Sgshapiro# ifndef SM_CONF_GETOPT
297890792Sgshapiro#  define SM_CONF_GETOPT	1
2979363466Sgshapiro# endif
298090792Sgshapiro
298190792Sgshapiro/* random routine -- set above using #ifdef _osname_ or in Makefile */
298290792Sgshapiro# if HASRANDOM
298390792Sgshapiro#  define get_random()	random()
298490792Sgshapiro# else /* HASRANDOM */
298590792Sgshapiro#  define get_random()	((long) rand())
298690792Sgshapiro#  ifndef RANDOMSHIFT
298790792Sgshapiro#   define RANDOMSHIFT	8
2988363466Sgshapiro#  endif
298990792Sgshapiro# endif /* HASRANDOM */
299090792Sgshapiro
299190792Sgshapiro/*
299290792Sgshapiro**  Default to using scanf in readcf.
299390792Sgshapiro*/
299490792Sgshapiro
299590792Sgshapiro# ifndef SCANF
299690792Sgshapiro#  define SCANF		1
2997363466Sgshapiro# endif
299890792Sgshapiro
299990792Sgshapiro/* XXX  32 bit type */
300090792Sgshapiro# ifndef SM_INT32
300190792Sgshapiro#  define SM_INT32	int32_t
3002363466Sgshapiro# endif
300390792Sgshapiro
3004261194Sgshapiro/* XXX  16 bit type */
3005261194Sgshapiro# ifndef SM_UINT16
3006261194Sgshapiro#  define SM_UINT16	uint16_t
3007363466Sgshapiro# endif
3008261194Sgshapiro
3009285229Sgshapiro/* additional valid chars in user/group names in passwd */
3010285229Sgshapiro# ifndef SM_PWN_CHARS
3011285229Sgshapiro#  define SM_PWN_CHARS "-_."
3012285229Sgshapiro# endif
3013285229Sgshapiro
3014285229Sgshapiro
301590792Sgshapiro/*
301690792Sgshapiro**  SVr4 and similar systems use different routines for setjmp/longjmp
301790792Sgshapiro**  with signal support
301890792Sgshapiro*/
301990792Sgshapiro
302090792Sgshapiro# if USE_SIGLONGJMP
302190792Sgshapiro#  ifdef jmp_buf
302290792Sgshapiro#   undef jmp_buf
3023363466Sgshapiro#  endif
302490792Sgshapiro#  define jmp_buf		sigjmp_buf
302590792Sgshapiro#  ifdef setjmp
302690792Sgshapiro#   undef setjmp
3027363466Sgshapiro#  endif
302890792Sgshapiro#  define setjmp(env)		sigsetjmp(env, 1)
302990792Sgshapiro#  ifdef longjmp
303090792Sgshapiro#   undef longjmp
3031363466Sgshapiro#  endif
303290792Sgshapiro#  define longjmp(env, val)	siglongjmp(env, val)
303390792Sgshapiro# endif /* USE_SIGLONGJMP */
303490792Sgshapiro
303590792Sgshapiro# if !defined(NGROUPS_MAX) && defined(NGROUPS)
303690792Sgshapiro#  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
3037363466Sgshapiro# endif
303890792Sgshapiro
303990792Sgshapiro/*
304090792Sgshapiro**  Some snprintf() implementations are rumored not to NUL terminate.
304190792Sgshapiro*/
304290792Sgshapiro# if SNPRINTF_IS_BROKEN
304390792Sgshapiro#  ifdef snprintf
304490792Sgshapiro#   undef snprintf
3045363466Sgshapiro#  endif
304690792Sgshapiro#  define snprintf	sm_snprintf
304790792Sgshapiro#  ifdef vsnprintf
304890792Sgshapiro#   undef vsnprintf
3049363466Sgshapiro#  endif
305090792Sgshapiro#  define vsnprintf	sm_vsnprintf
305190792Sgshapiro# endif /* SNPRINTF_IS_BROKEN */
305290792Sgshapiro
305390792Sgshapiro/*
305490792Sgshapiro**  If we don't have a system syslog, simulate it.
305590792Sgshapiro*/
305690792Sgshapiro
305790792Sgshapiro# if !LOG
305890792Sgshapiro#  define LOG_EMERG	0	/* system is unusable */
305990792Sgshapiro#  define LOG_ALERT	1	/* action must be taken immediately */
306090792Sgshapiro#  define LOG_CRIT	2	/* critical conditions */
306190792Sgshapiro#  define LOG_ERR	3	/* error conditions */
306290792Sgshapiro#  define LOG_WARNING	4	/* warning conditions */
306390792Sgshapiro#  define LOG_NOTICE	5	/* normal but significant condition */
306490792Sgshapiro#  define LOG_INFO	6	/* informational */
306590792Sgshapiro#  define LOG_DEBUG	7	/* debug-level messages */
306690792Sgshapiro# endif /* !LOG */
306790792Sgshapiro
306890792Sgshapiro# ifndef SM_CONF_SYSLOG
306990792Sgshapiro#  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
3070363466Sgshapiro# endif
307190792Sgshapiro
307290792Sgshapiro# if !SM_CONF_SYSLOG
307390792Sgshapiro#   ifdef __STDC__
307490792Sgshapiroextern void	syslog(int, const char *, ...);
3075363466Sgshapiro#   else
307690792Sgshapiroextern void	syslog();
3077363466Sgshapiro#   endif
307890792Sgshapiro# endif /* !SM_CONF_SYSLOG */
307990792Sgshapiro
308090792Sgshapiro/* portable(?) definition for alignment */
308190792Sgshapiro# ifndef SM_ALIGN_SIZE
308290792Sgshapirostruct sm_align
308390792Sgshapiro{
308490792Sgshapiro	char al_c;
308590792Sgshapiro	union
308690792Sgshapiro	{
308790792Sgshapiro		long	al_l;
308890792Sgshapiro		void	*al_p;
308990792Sgshapiro		double	al_d;
3090141858Sgshapiro		void	(*al_f) __P((void));
309190792Sgshapiro	} al_u;
309290792Sgshapiro};
309390792Sgshapiro#  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
309490792Sgshapiro# endif /* ! SM_ALIGN_SIZE */
309590792Sgshapiro# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
309690792Sgshapiro
3097261194Sgshapirochar *sm_inet6_ntop __P((const void *, char *, size_t));
3098261194Sgshapiro
309990792Sgshapiro#endif /* ! SM_CONF_H */
3100