xref: /titanic_51/usr/src/cmd/sendmail/include/sm/conf.h (revision 32885d593baf8bac788fa78885893a51b3ad0f28)
1 /*
2  * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
5  * Copyright (c) 1988, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * By using this file, you agree to the terms and conditions set
9  * forth in the LICENSE file which can be found at the top level of
10  * the sendmail distribution.
11  *
12  *
13  *	$Id: conf.h,v 1.134 2007/09/24 23:05:37 ca Exp $
14  */
15 
16 /*
17  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
18  * Use is subject to license terms.
19  */
20 
21 #pragma ident	"%Z%%M%	%I%	%E% SMI"
22 
23 /*
24 **  CONF.H -- All user-configurable parameters for sendmail
25 **
26 **	Send updates to Sendmail.ORG so they will be
27 **	included in the next release; see
28 **	http://www.sendmail.org/email-addresses.html
29 **	for current e-mail address.
30 */
31 
32 #ifndef SM_CONF_H
33 # define SM_CONF_H 1
34 
35 
36 # include <sm/config.h>
37 # include <sm/varargs.h>
38 
39 /*
40 **  General "standard C" defines.
41 **
42 **	These may be undone later, to cope with systems that claim to
43 **	be Standard C but aren't.  Gcc is the biggest offender -- it
44 **	doesn't realize that the library is part of the language.
45 **
46 **	Life would be much easier if we could get rid of this sort
47 **	of bozo problems.
48 */
49 
50 # ifdef __STDC__
51 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
52 # endif /* __STDC__ */
53 
54 /*
55 **  Assume you have standard calls; can be #undefed below if necessary.
56 */
57 
58 # ifndef HASLSTAT
59 #  define HASLSTAT	1	/* has lstat(2) call */
60 # endif /* ! HASLSTAT */
61 
62 # ifndef HASNICE
63 #  define HASNICE	1	/* has nice(2) call */
64 # endif /* ! HASNICE */
65 
66 # ifndef HASRRESVPORT
67 #  define HASRRESVPORT	1	/* has rrsevport(3) call */
68 # endif /* ! HASRRESVPORT */
69 
70 /**********************************************************************
71 **  "Hard" compilation options.
72 **	#define these if they are available; comment them out otherwise.
73 **  These cannot be overridden from the Makefile, and should really not
74 **  be turned off unless absolutely necessary.
75 **********************************************************************/
76 
77 #define LOG		1	/* enable logging -- don't turn off */
78 
79 /**********************************************************************
80 **  Operating system configuration.
81 **
82 **	Unless you are porting to a new OS, you shouldn't have to
83 **	change these.
84 **********************************************************************/
85 
86 /*
87 **  HP-UX -- tested for 8.07, 9.00, and 9.01.
88 **
89 **	If V4FS is defined, compile for HP-UX 10.0.
90 **	11.x support from Richard Allen <ra@hp.is>.
91 */
92 
93 # ifdef __hpux
94 		/* common definitions for HP-UX 9.x and 10.x */
95 #  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
96 #  define SYSTEM5	1	/* include all the System V defines */
97 #  define HASINITGROUPS	1	/* has initgroups(3) call */
98 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
99 #  define USESETEUID	1	/* has usable seteuid(2) call */
100 #  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
101 #  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
102 #  define seteuid(e)	setresuid(-1, e, -1)
103 #  define IP_SRCROUTE	1	/* can check IP source routing */
104 #  define LA_TYPE	LA_HPUX
105 #  define SPT_TYPE	SPT_PSTAT
106 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
107 #  define GIDSET_T	gid_t
108 #  define LDA_USE_LOCKF	1
109 #  ifndef HASGETUSERSHELL
110 #   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
111 #  endif /* ! HASGETUSERSHELL */
112 #  ifdef HPUX10
113 #   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
114 #   ifndef SMRSH_CMDDIR
115 #    define SMRSH_CMDDIR	"/var/adm/sm.bin"
116 #   endif /* ! SMRSH_CMDDIR */
117 #  endif /* HPUX10 */
118 #  ifdef HPUX11
119 #   define HASSETREUID	1	/* setreuid(2) works on HP-UX 11.x */
120 #   define HASFCHOWN	1	/* has fchown(2) */
121 #   ifndef BROKEN_RES_SEARCH
122 #    define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
123 #   endif /* ! BROKEN_RES_SEARCH */
124 #   ifndef SMRSH_CMDDIR
125 #    define SMRSH_CMDDIR	"/var/adm/sm.bin"
126 #   endif /* ! SMRSH_CMDDIR */
127 #   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
128 #  else /* HPUX11 */
129 #   ifndef NOT_SENDMAIL
130 #    define syslog	hard_syslog
131 #   endif /* ! NOT_SENDMAIL */
132 #  endif /* HPUX11 */
133 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
134 
135 #  ifdef V4FS
136 		/* HP-UX 10.x */
137 #   define _PATH_UNIX		"/stand/vmunix"
138 #   ifndef _PATH_VENDOR_CF
139 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
140 #   endif /* ! _PATH_VENDOR_CF */
141 #   ifndef _PATH_SENDMAILPID
142 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
143 #   endif /* ! _PATH_SENDMAILPID */
144 #   ifndef IDENTPROTO
145 #    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
146 #   endif /* ! IDENTPROTO */
147 #   include <sys/mpctl.h>	/* for mpctl() in get_num_procs_online() */
148 #  else /* V4FS */
149 		/* HP-UX 9.x */
150 #   define _PATH_UNIX		"/hp-ux"
151 #   ifndef _PATH_VENDOR_CF
152 #    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
153 #   endif /* ! _PATH_VENDOR_CF */
154 #   ifndef IDENTPROTO
155 #    define IDENTPROTO	0	/* TCP/IP implementation is broken */
156 #   endif /* ! IDENTPROTO */
157 #   ifdef __STDC__
158 extern void	hard_syslog(int, char *, ...);
159 #   else /* __STDC__ */
160 extern void	hard_syslog();
161 #   endif /* __STDC__ */
162 #   define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
163 #  endif /* V4FS */
164 
165 # endif /* __hpux */
166 
167 /*
168 **  IBM AIX 5.x
169 */
170 
171 # ifdef _AIX5
172 #  include <sys/signal.h>
173 #  include <sys/wait.h>
174 #  define _AIX4		40300
175 #  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
176 #  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
177 #  if _AIX5 >= 50200
178 #   define HASUNSETENV	1	/* has unsetenv(3) call */
179 #  endif /* _AIX5 >= 50200 */
180 # endif /* _AIX5 */
181 
182 /*
183 **  IBM AIX 4.x
184 */
185 
186 # ifdef _AIX4
187 #  define _AIX3		1	/* pull in AIX3 stuff */
188 #  define BSD4_4_SOCKADDR	/* has sa_len */
189 #  define USESETEUID	1	/* seteuid(2) works */
190 #  define TZ_TYPE	TZ_NAME	/* use tzname[] vector */
191 #  ifndef SOCKOPT_LEN_T
192 #   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
193 #  endif /* SOCKOPT_LEN_T */
194 #  if _AIX4 >= 40200
195 #   define HASSETREUID	1	/* setreuid(2) works as of AIX 4.2 */
196 #   ifndef SOCKADDR_LEN_T
197 #    define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
198 #   endif /* SOCKADDR_LEN_T */
199 #  endif /* _AIX4 >= 40200 */
200 #  if defined(_ILS_MACROS)	/* IBM versions aren't side-effect clean */
201 #   undef isascii
202 #   define isascii(c)		!(c & ~0177)
203 #   undef isdigit
204 #   define isdigit(__a)		(_IS(__a,_ISDIGIT))
205 #   undef isspace
206 #   define isspace(__a)		(_IS(__a,_ISSPACE))
207 #  endif /* defined(_ILS_MACROS) */
208 # endif /* _AIX4 */
209 
210 
211 /*
212 **  IBM AIX 3.x -- actually tested for 3.2.3
213 */
214 
215 # ifdef _AIX3
216 #  include <paths.h>
217 #  include <sys/machine.h>	/* to get byte order */
218 #  include <sys/select.h>
219 #  define HASFCHOWN	1	/* has fchown(2) */
220 #  define HASINITGROUPS	1	/* has initgroups(3) call */
221 #  define HASUNAME	1	/* use System V uname(2) system call */
222 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
223 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
224 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
225 #  define GIDSET_T	gid_t
226 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
227 #  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
228 #  ifndef LA_TYPE
229 #   define LA_TYPE	LA_INT
230 #  endif /* LA_TYPE */
231 #  define FSHIFT	16
232 #  define LA_AVENRUN	"avenrun"
233 #  if !defined(_AIX4) || _AIX4 < 40300
234 #   ifndef __BIT_TYPES_DEFINED__
235 #    define SM_INT32	int
236 #   endif /* __BIT_TYPES_DEFINED__ */
237 #  endif /* !defined(_AIX4) || _AIX4 < 40300 */
238 #  if !defined(_AIX4) || _AIX4 < 40200
239 #   define SM_CONF_SYSLOG	0
240 #  endif /* !defined(_AIX4) || _AIX4 < 40200 */
241 # endif /* _AIX3 */
242 
243 
244 /*
245 **  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
246 **
247 **	From Mark Whetzel <markw@wg.waii.com>.
248 */
249 
250 # ifdef AIX			/* AIX/RT compiler pre-defines this */
251 #  include <paths.h>
252 #  include <sys/time.h>		/* AIX/RT resource.h does NOT include this */
253 #  define HASINITGROUPS	1	/* has initgroups(3) call */
254 #  define HASUNAME	1	/* use System V uname(2) system call */
255 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
256 #  define HASFCHMOD	0	/* does not have fchmod(2) syscall */
257 #  define HASSETREUID	1	/* use setreuid(2) -lbsd system call */
258 #  define HASSETVBUF	1	/* use setvbuf(2) system call */
259 #  define HASSETRLIMIT	0	/* does not have setrlimit call */
260 #  define HASFLOCK	0	/* does not have flock call - use fcntl */
261 #  define HASULIMIT	1	/* use ulimit instead of setrlimit call */
262 #  define SM_CONF_GETOPT	0	/* Do we need theirs or ours */
263 #  define SYS5SETPGRP	1	/* don't have setpgid on AIX/RT */
264 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
265 #  define BSD4_3		1	/* NOT bsd 4.4 or posix signals */
266 #  define GIDSET_T	int
267 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
268 #  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
269 #  define LA_TYPE	LA_SUBR		/* use our ported loadavgd daemon */
270 #  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
271 #  define ARBPTR_T	int *
272 #  define void		int
273 typedef int		pid_t;
274 /* RTisms for BSD compatibility, specified in the Makefile
275   define BSD		1
276   define BSD_INCLUDES		1
277   define BSD_REMAP_SIGNAL_TO_SIGVEC
278     RTisms needed above */
279 /* make this sendmail in a completely different place */
280 #  ifndef _PATH_VENDOR_CF
281 #   define _PATH_VENDOR_CF	"/usr/local/newmail/sendmail.cf"
282 #  endif /* ! _PATH_VENDOR_CF */
283 #  ifndef _PATH_SENDMAILPID
284 #   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
285 #  endif /* ! _PATH_SENDMAILPID */
286 # endif /* AIX */
287 
288 # if defined(_AIX)
289 #  define LDA_USE_LOCKF		1
290 #  define LDA_USE_SETEUID	1
291 # endif /* defined(_AIX) */
292 
293 /*
294 **  Silicon Graphics IRIX
295 **
296 **	Compiles on 4.0.1.
297 **
298 **	Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
299 **	Use IRIX5 instead of IRIX for IRIX 5.x.
300 **
301 **	IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
302 **	IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
303 */
304 
305 # ifdef IRIX
306 #  define SYSTEM5	1	/* this is a System-V derived system */
307 #  define HASSETREUID	1	/* has setreuid(2) call */
308 #  define HASINITGROUPS	1	/* has initgroups(3) call */
309 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
310 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
311 #  define IP_SRCROUTE	1	/* can check IP source routing */
312 #  define setpgid	BSDsetpgrp
313 #  define GIDSET_T	gid_t
314 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
315 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
316 #  define SYSLOG_BUFSIZE 512
317 #  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
318     /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
319 #   define _SC_NPROCESSORS_ONLN	_SC_NPROC_ONLN
320 #  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
321 #  ifdef IRIX6
322 #   define STAT64	1
323 #   define QUAD_T	unsigned long long
324 #   define LA_TYPE	LA_IRIX6	/* figure out at run time */
325 #   define SAFENFSPATHCONF 0	/* pathconf(2) lies on NFS filesystems */
326 #  else /* IRIX6 */
327 #   define LA_TYPE	LA_INT
328 
329 #   ifdef IRIX64
330 #    define STAT64	1
331 #    define QUAD_T	unsigned long long
332 #    define NAMELISTMASK	0x7fffffffffffffff	/* mask for nlist() values */
333 #   else /* IRIX64 */
334 #    define STAT64	0
335 #    define NAMELISTMASK	0x7fffffff		/* mask for nlist() values */
336 #   endif /* IRIX64 */
337 #  endif /* IRIX6 */
338 #  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
339 #   include <sys/cdefs.h>
340 #   include <paths.h>
341 #   define ARGV_T	char *const *
342 #   define HASFCHOWN	1	/* has fchown(2) */
343 #   define HASSETRLIMIT	1	/* has setrlimit(2) syscall */
344 #   define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
345 #   define HASSTRERROR	1	/* has strerror(3) */
346 #  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
347 #   define ARGV_T	const char **
348 #   define WAITUNION	1	/* use "union wait" as wait argument type */
349 #  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
350 # endif /* IRIX */
351 
352 
353 /*
354 **  SunOS and Solaris
355 **
356 **	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
357 **	Solaris 2.4 (a.k.a. SunOS 5.4).
358 */
359 
360 # if defined(sun) && !defined(BSD)
361 
362 #  include <sys/time.h>
363 #  define HASINITGROUPS	1	/* has initgroups(3) call */
364 #  define HASUNAME	1	/* use System V uname(2) system call */
365 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
366 #  define IP_SRCROUTE	1	/* can check IP source routing */
367 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
368 #  ifndef HASFCHOWN
369 #   define HASFCHOWN	1	/* fchown(2) */
370 #  endif /* ! HASFCHOWN */
371 
372 #  ifdef __svr4__
373 #   define LDA_USE_LOCKF		1
374 #   define LDA_USE_SETEUID	1
375 #   define _PATH_MAILDIR		"/var/mail"
376 #  endif /* __svr4__ */
377 
378 #  ifdef SOLARIS_2_3
379 #   define SOLARIS	20300	/* for back compat only -- use -DSOLARIS=20300 */
380 #  endif /* SOLARIS_2_3 */
381 
382 #  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
383 #   define SOLARIS	1	/* unknown Solaris version */
384 #  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
385 
386 #  ifdef SOLARIS
387 			/* Solaris 2.x (a.k.a. SunOS 5.x) */
388 #   ifndef __svr4__
389 #    define __svr4__		/* use all System V Release 4 defines below */
390 #   endif /* ! __svr4__ */
391 #   define GIDSET_T	gid_t
392 #   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
393 #   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
394 #   define HASSTRERROR	1	/* has strerror(3) */
395 #   ifndef _PATH_UNIX
396 #    define _PATH_UNIX		"/dev/ksyms"
397 #   endif /* ! _PATH_UNIX */
398 #   ifndef _PATH_VENDOR_CF
399 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
400 #   endif /* ! _PATH_VENDOR_CF */
401 #   ifndef _PATH_SENDMAILPID
402 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
403 #   endif /* ! _PATH_SENDMAILPID */
404 #   ifndef _PATH_HOSTS
405 #    define _PATH_HOSTS		"/etc/inet/hosts"
406 #   endif /* ! _PATH_HOSTS */
407 #   ifndef SYSLOG_BUFSIZE
408 #    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
409 #   endif /* ! SYSLOG_BUFSIZE */
410 #   ifndef TZ_TYPE
411 #    define TZ_TYPE	TZ_TZNAME
412 #   endif /* ! TZ_TYPE */
413 #   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
414 #    define USESETEUID		1	/* seteuid works as of 2.3 */
415 #    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
416 #   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
417 #   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
418 #    define HASSETREUID	1		/* setreuid works as of 2.5 */
419 #    define HASSETREGID	1	/* use setregid(2) to set saved gid */
420 #   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
421 #    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
422 #   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
423 #    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
424 #     ifndef LA_TYPE
425 #      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
426 #     endif /* ! LA_TYPE */
427 #     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
428 #      define RANDOMSHIFT	8
429 #     endif /* ! RANDOMSHIFT */
430 #    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
431 #   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
432 #    ifndef HASRANDOM
433 #     define HASRANDOM	0		/* doesn't have random(3) */
434 #    endif /* ! HASRANDOM */
435 #   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
436 #   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
437 #    define SM_INT32	int	/* 32bit integer */
438 #   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
439 #   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
440 #    ifndef LA_TYPE
441 #     include <sys/loadavg.h>
442 #     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
443 #      include <sys/pset.h>
444 #      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
445 #     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
446 #      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
447 #     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
448 #    endif /* ! LA_TYPE */
449 #    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
450 #   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
451 #   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
452 #    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
453 #    define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
454 #    ifndef SMRSH_CMDDIR
455 #     define SMRSH_CMDDIR	"/var/adm/sm.bin"
456 #    endif /* ! SMRSH_CMDDIR */
457 #    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
458 #    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
459 #   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
460 #   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
461 #    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
462 #    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
463 #    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
464 #   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
465 #   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
466 #    define HASUNSETENV 1       /* unsetenv() added in S10 */
467 #   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
468 #   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
469 #    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
470 #   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
471 #   ifndef HASGETUSERSHELL
472 #    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
473 #   endif /* ! HASGETUSERSHELL */
474 
475 #  else /* SOLARIS */
476 			/* SunOS 4.0.3 or 4.1.x */
477 #   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
478 #   define HASSETREUID	1	/* has setreuid(2) call */
479 #   ifndef HASFLOCK
480 #    define HASFLOCK	1	/* has flock(2) call */
481 #   endif /* ! HASFLOCK */
482 #   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
483 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
484 #   include <memory.h>
485 #   include <vfork.h>
486 #   ifdef __GNUC__
487 #    define strtoul	strtol	/* gcc library bogosity */
488 #   endif /* __GNUC__ */
489 #   define memmove(d, s, l)	(bcopy((s), (d), (l)))
490 #   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
491 #   define SM_INT32	int	/* 32bit integer */
492 #   define SM_ALIGN_SIZE (sizeof(long))
493 #   define GIDSET_T	int
494 #   define SM_CONF_SYSLOG	0
495 
496 #   ifdef SUNOS403
497 			/* special tweaking for SunOS 4.0.3 */
498 #    include <malloc.h>
499 #    define BSD4_3	1	/* 4.3 BSD-based */
500 #    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
501 #    define WAITUNION	1	/* use "union wait" as wait argument type */
502 #    undef WIFEXITED
503 #    undef WEXITSTATUS
504 #    undef HASUNAME
505 #    define setpgid	setpgrp
506 #    define MODE_T	int
507 typedef int		pid_t;
508 extern char		*getenv();
509 
510 #   else /* SUNOS403 */
511 			/* 4.1.x specifics */
512 #    define HASSETSID	1	/* has POSIX setsid(2) call */
513 #    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
514 
515 #   endif /* SUNOS403 */
516 #  endif /* SOLARIS */
517 
518 #  ifndef LA_TYPE
519 #   define LA_TYPE	LA_INT
520 #  endif /* ! LA_TYPE */
521 
522 # endif /* defined(sun) && !defined(BSD) */
523 
524 /*
525 **  DG/UX
526 **
527 **	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
528 **	older support.
529 **	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
530 */
531 
532 # ifdef DGUX_5_4_2
533 #  define DGUX		1
534 # endif /* DGUX_5_4_2 */
535 
536 # ifdef DGUX
537 #  define SYSTEM5	1
538 #  define LA_TYPE	LA_DGUX
539 #  define HASSETREUID	1	/* has setreuid(2) call */
540 #  define HASUNAME	1	/* use System V uname(2) system call */
541 #  define HASSETSID	1	/* has POSIX setsid(2) call */
542 #  define HASINITGROUPS	1	/* has initgroups(3) call */
543 #  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
544 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
545 #  ifndef IDENTPROTO
546 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
547 #  endif /* ! IDENTPROTO */
548 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
549 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
550 #  define LDA_USE_LOCKF		1
551 
552 /* these include files must be included early on DG/UX */
553 #  include <netinet/in.h>
554 #  include <arpa/inet.h>
555 
556 /* compiler doesn't understand const? */
557 #  define const
558 
559 #  ifdef DGUX_5_4_2
560 #   define inet_addr	dgux_inet_addr
561 extern long	dgux_inet_addr();
562 #  endif /* DGUX_5_4_2 */
563 # endif /* DGUX */
564 
565 
566 /*
567 **  Digital Ultrix 4.2 - 4.5
568 **
569 **	Apparently, fcntl locking is broken on 4.2A, in that locks are
570 **	not dropped when the process exits.  This causes major problems,
571 **	so flock is the only alternative.
572 */
573 
574 # ifdef ultrix
575 #  define HASSETREUID	1	/* has setreuid(2) call */
576 #  define HASUNSETENV	1	/* has unsetenv(3) call */
577 #  define HASINITGROUPS	1	/* has initgroups(3) call */
578 #  define HASUNAME	1	/* use System V uname(2) system call */
579 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
580 #  define HASFCHOWN	1	/* has fchown(2) syscall */
581 #  ifndef HASFLOCK
582 #   define HASFLOCK	1	/* has flock(2) call */
583 #  endif /* ! HASFLOCK */
584 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
585 #  ifndef BROKEN_RES_SEARCH
586 #   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
587 #  endif /* ! BROKEN_RES_SEARCH */
588 #  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
589 #   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
590 #  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
591 #  ifdef vax
592 #   define LA_TYPE	LA_FLOAT
593 #  else /* vax */
594 #   define LA_TYPE	LA_INT
595 #   define LA_AVENRUN	"avenrun"
596 #  endif /* vax */
597 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
598 #  ifndef IDENTPROTO
599 #   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
600 #  endif /* ! IDENTPROTO */
601 #  define SYSLOG_BUFSIZE	256
602 #  define SM_CONF_SYSLOG	0
603 # endif /* ultrix */
604 
605 
606 /*
607 **  OSF/1 for KSR.
608 **
609 **	Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
610 */
611 
612 # ifdef __ksr__
613 #  define __osf__	1	/* get OSF/1 defines below */
614 #  ifndef TZ_TYPE
615 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
616 #  endif /* ! TZ_TYPE */
617 # endif /* __ksr__ */
618 
619 
620 /*
621 **  OSF/1 for Intel Paragon.
622 **
623 **	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
624 **	of Intel Scalable Systems Divison.
625 */
626 
627 # ifdef __PARAGON__
628 #  define __osf__	1	/* get OSF/1 defines below */
629 #  ifndef TZ_TYPE
630 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
631 #  endif /* ! TZ_TYPE */
632 #  define GIDSET_T	gid_t
633 #  define MAXNAMLEN	NAME_MAX
634 # endif /* __PARAGON__ */
635 
636 
637 /*
638 **  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
639 **
640 **	Tested for 3.2 and 4.0.
641 */
642 
643 # ifdef __osf__
644 #  define HASUNAME	1	/* has uname(2) call */
645 #  define HASUNSETENV	1	/* has unsetenv(3) call */
646 #  define USESETEUID	1	/* has usable seteuid(2) call */
647 #  define HASINITGROUPS	1	/* has initgroups(3) call */
648 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
649 #  define HASFCHOWN	1	/* has fchown(2) syscall */
650 #  define HASSETLOGIN	1	/* has setlogin(2) */
651 #  define IP_SRCROUTE	1	/* can check IP source routing */
652 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
653 #  define GIDSET_T	gid_t
654 #  define SM_INT32	int	/* 32bit integer */
655 #  ifndef HASFLOCK
656 #   include <standards.h>
657 #   if _XOPEN_SOURCE+0 >= 400
658 #    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
659 #   else /* _XOPEN_SOURCE+0 >= 400 */
660 #    define HASFLOCK	1	/* has flock(2) call */
661 #   endif /* _XOPEN_SOURCE+0 >= 400 */
662 #  endif /* ! HASFLOCK */
663 #  define LA_TYPE	LA_ALPHAOSF
664 #  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
665 #  ifndef _PATH_VENDOR_CF
666 #   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
667 #  endif /* ! _PATH_VENDOR_CF */
668 #  ifndef _PATH_SENDMAILPID
669 #   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
670 #  endif /* ! _PATH_SENDMAILPID */
671 #  if _FFR_DIGUNIX_SAFECHOWN
672 /*
673 **  Testing on a Digital UNIX 4.0a system showed this to be the correct
674 **  setting but given the security consequences, more testing and
675 **  verification is needed.  Unfortunately, the man page offers no
676 **  assistance.
677 */
678 #   define IS_SAFE_CHOWN >= 0
679 #  endif /* _FFR_DIGUNIX_SAFECHOWN */
680 # endif /* __osf__ */
681 
682 
683 /*
684 **  NeXTstep
685 */
686 
687 # ifdef NeXT
688 #  define HASINITGROUPS	1	/* has initgroups(3) call */
689 #  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
690 #  ifndef HASFLOCK
691 #   define HASFLOCK	1	/* has flock(2) call */
692 #  endif /* ! HASFLOCK */
693 #  define UID_T		int	/* compiler gripes on uid_t */
694 #  define GID_T		int	/* ditto for gid_t */
695 #  define MODE_T	int	/* and mode_t */
696 #  define setpgid	setpgrp
697 #  ifndef NOT_SENDMAIL
698 #   define sleep		sleepX
699 #  endif /* ! NOT_SENDMAIL */
700 #  ifndef LA_TYPE
701 #   define LA_TYPE	LA_MACH
702 #  endif /* ! LA_TYPE */
703 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
704 #  ifdef _POSIX_SOURCE
705 extern struct passwd	*getpwent();
706 #  else /* _POSIX_SOURCE */
707 #   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
708 #   define WAITUNION	1	/* use "union wait" as wait argument type */
709 typedef int		pid_t;
710 #   undef WEXITSTATUS
711 #   undef WIFEXITED
712 #   undef WIFSTOPPED
713 #   undef WTERMSIG
714 #  endif /* _POSIX_SOURCE */
715 #  ifndef _PATH_VENDOR_CF
716 #   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
717 #  endif /* ! _PATH_VENDOR_CF */
718 #  ifndef _PATH_SENDMAILPID
719 #   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
720 #  endif /* ! _PATH_SENDMAILPID */
721 #  define SM_INT32	int	/* 32bit integer */
722 
723 #  ifdef TCPWRAPPERS
724 #   ifndef HASUNSETENV
725 #    define HASUNSETENV	1
726 #   endif /* ! HASUNSETENV */
727 #   undef NEEDPUTENV
728 #  endif /* TCPWRAPPERS */
729 #  ifndef __APPLE__
730 #   include <libc.h>
731 #   ifndef S_IRUSR
732 #    define S_IRUSR	S_IREAD
733 #   endif /* ! S_IRUSR */
734 #   ifndef S_IWUSR
735 #    define S_IWUSR	S_IWRITE
736 #   endif /* ! S_IWUSR */
737 #   define _PATH_MAILDIR	"/usr/spool/mail"
738 #  endif /* ! __APPLE__ */
739 #  ifndef isascii
740 #   define isascii(c)	((unsigned)(c) <= 0177)
741 #  endif /* ! isascii */
742 # endif /* NeXT */
743 
744 /*
745 **  Apple Darwin
746 **      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
747 */
748 
749 # if defined(DARWIN)
750 #  define HASFCHMOD		1	/* has fchmod(2) */
751 #  define HASFCHOWN		1	/* has fchown(2) */
752 #  define HASFLOCK		1	/* has flock(2) */
753 #  define HASUNAME		1	/* has uname(2) */
754 #  define HASUNSETENV		1	/* has unsetenv(3) */
755 #  define HASSETSID		1	/* has POSIX setsid(2) call */
756 #  define HASINITGROUPS		1	/* has initgroups(3) */
757 #  define HASSETVBUF		1	/* has setvbuf (3) */
758 #  define HASSETREUID		0	/* setreuid(2) unusable */
759 #  define HASSETEUID		1	/* has seteuid(2) */
760 #  define USESETEUID		1	/* has seteuid(2) */
761 #  define HASSETEGID		1	/* has setegid(2) */
762 #  define HASSETREGID		1	/* has setregid(2) */
763 #  define HASSETRESGID		0	/* no setresgid(2) */
764 #  define HASLSTAT		1	/* has lstat(2) */
765 #  define HASSETRLIMIT		1	/* has setrlimit(2) */
766 #  define HASWAITPID		1	/* has waitpid(2) */
767 #  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
768 #  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
769 #  define HASURANDOMDEV		1	/* has urandom(4) */
770 #  define HASSTRERROR		1	/* has strerror(3) */
771 #  define HASGETUSERSHELL	1	/* had getusershell(3) */
772 #  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
773 #  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
774 #  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
775 #  if DARWIN >= 70000
776 #   define SOCKADDR_LEN_T	socklen_t
777 #  endif
778 #  if DARWIN >= 80000
779 #   define SPT_TYPE		SPT_REUSEARGV
780 #   define SPT_PADCHAR		'\0'
781 #   define SOCKOPT_LEN_T	socklen_t
782 #  else
783 #   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
784 #  endif
785 #  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
786 #  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
787 #  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
788 #  define HAS_IN_H		1
789 #  define NETLINK		1	/* supports AF_LINK */
790 #  ifndef NOT_SENDMAIL
791 #   define sleep sleepX
792 extern unsigned int sleepX __P((unsigned int seconds));
793 #  endif /* ! NOT_SENDMAIL */
794 # endif /* defined(DARWIN) */
795 
796 
797 /*
798 **  4.4 BSD
799 **
800 **	See also BSD defines.
801 */
802 
803 # if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
804 #  include <paths.h>
805 #  define HASUNSETENV	1	/* has unsetenv(3) call */
806 #  define USESETEUID	1	/* has usable seteuid(2) call */
807 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
808 #  define HASFCHOWN	1	/* has fchown(2) syscall */
809 #  define HASSTRERROR	1	/* has strerror(3) */
810 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
811 #  include <sys/cdefs.h>
812 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
813 #  define BSD4_4_SOCKADDR	/* has sa_len */
814 #  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
815 #  define NETLINK	1	/* supports AF_LINK */
816 #  ifndef LA_TYPE
817 #   define LA_TYPE	LA_SUBR
818 #  endif /* ! LA_TYPE */
819 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
820 #  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
821 # endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
822 
823 
824 /*
825 **  BSD/OS (was BSD/386) (all versions)
826 **	From Tony Sanders, BSDI
827 */
828 
829 # ifdef __bsdi__
830 #  include <paths.h>
831 #  define HASUNSETENV	1	/* has the unsetenv(3) call */
832 #  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
833 #  define HASSETSID	1	/* has POSIX setsid(2) call */
834 #  define USESETEUID	1	/* has usable seteuid(2) call */
835 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
836 #  define HASSETLOGIN	1	/* has setlogin(2) */
837 #  define HASUNAME	1	/* has uname(2) syscall */
838 #  define HASSTRERROR	1	/* has strerror(3) */
839 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
840 #  include <sys/cdefs.h>
841 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
842 #  define BSD4_4_SOCKADDR	/* has sa_len */
843 #  define NETLINK	1	/* supports AF_LINK */
844 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
845 #  ifndef LA_TYPE
846 #   define LA_TYPE	LA_SUBR
847 #  endif /* ! LA_TYPE */
848 #  define GIDSET_T	gid_t
849 #  define QUAD_T		quad_t
850 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
851 			/* version 1.1 or later */
852 #   undef SPT_TYPE
853 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
854 #  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
855 			/* version 1.0 or earlier */
856 #   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
857 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
858 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
859 #   define HASSETUSERCONTEXT 1	/* has setusercontext */
860 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
861 #  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
862 #   define MODE_T	int	/* va_arg() can't handle less than int */
863 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
864 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
865 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
866 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
867 # endif /* __bsdi__ */
868 
869 
870 # if defined(__QNX__)
871 #  if defined(__QNXNTO__)
872 /* QNX 6 */
873 #   include <unix.h>
874 #   define HASUNSETENV	1	/* has unsetenv(3) call */
875 #   define HASINITGROUPS	1	/* has initgroups(3) call */
876 #   define HASSETSID	1	/* has POSIX setsid(2) call */
877 #   define USESETEUID	1	/* has usable seteuid(2) call */
878 #   define HASFCHMOD	1	/* has fchmod(2) syscall */
879 #   define HASFCHOWN	1	/* has fchown(2) syscall */
880 #   define HASUNAME	1	/* has uname(2) syscall */
881 #   define HASSTRERROR	1	/* has strerror(3) */
882 #   define BSD4_4_SOCKADDR	/* has sa_len */
883 #   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
884 #   define NETLINK	1	/* supports AF_LINK */
885 #   define GIDSET_T	gid_t
886 #   define QUAD_T	uint64_t
887 #   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
888 #   define HASGETUSERSHELL 0
889 
890 /*
891 **  We have a strrev() that doesn't allocate anything.
892 **  Make sure the one here is used.
893 */
894 
895 #   define strrev strrev_sendmail
896 
897 #  else /* defined(__QNXNTO__) */
898 
899 /*
900 **  QNX 4.2x
901 **	Contributed by Glen McCready <glen@qnx.com>.
902 **
903 **	Should work with all versions of QNX 4.
904 */
905 
906 #   include <unix.h>
907 #   include <sys/select.h>
908 #   undef NGROUPS_MAX
909 #   define HASSETSID	1	/* has POSIX setsid(2) call */
910 #   define USESETEUID	1	/* has usable seteuid(2) call */
911 #   define HASFCHMOD	1	/* has fchmod(2) syscall */
912 #   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
913 #   define HASSETREUID	1	/* has setreuid(2) call */
914 #   define HASSTRERROR	1	/* has strerror(3) */
915 #   define HASFLOCK	0
916 #   undef HASINITGROUPS		/* has initgroups(3) call */
917 #   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
918 #   define IP_SRCROUTE	1	/* can check IP source routing */
919 #   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
920 #   define GIDSET_T	gid_t
921 #   define LA_TYPE	LA_ZERO
922 #   define SFS_TYPE	SFS_NONE
923 #   define SPT_TYPE	SPT_REUSEARGV
924 #   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
925 #   define HASGETUSERSHELL 0
926 #   define _FILE_H_INCLUDED
927 #  endif /* defined(__QNXNTO__) */
928 # endif /* defined(__QNX__) */
929 
930 
931 /*
932 **  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
933 **
934 **  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
935 **  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
936 **
937 **	See also BSD defines.
938 */
939 
940 # if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
941 #  include <paths.h>
942 #  define HASUNSETENV	1	/* has unsetenv(3) call */
943 #  define HASSETSID	1	/* has POSIX setsid(2) call */
944 #  define USESETEUID	1	/* has usable seteuid(2) call */
945 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
946 #  define HASFCHOWN	1	/* has fchown(2) syscall */
947 #  define HASUNAME	1	/* has uname(2) syscall */
948 #  define HASSTRERROR	1	/* has strerror(3) */
949 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
950 #  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
951 #  include <sys/cdefs.h>
952 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
953 #  define BSD4_4_SOCKADDR	/* has sa_len */
954 #  define NETLINK	1	/* supports AF_LINK */
955 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
956 #  define GIDSET_T	gid_t
957 #  define QUAD_T	unsigned long long
958 #  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
959 #  ifndef LA_TYPE
960 #   define LA_TYPE	LA_SUBR
961 #  endif /* ! LA_TYPE */
962 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
963     ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
964     (__NetBSD_Version__ >= 299000900))
965 #   undef SFS_TYPE
966 #   define SFS_TYPE	SFS_STATVFS
967 #  else
968 #   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
969 #  endif
970 #  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
971 #   undef SPT_TYPE
972 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
973 #  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
974 #  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
975 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
976 #  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
977 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
978 #   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
979 #  endif
980 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
981     ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
982     (__NetBSD_Version__ >= 299000900))
983 #   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
984 #  endif
985 #  if defined(__NetBSD__)
986 #   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
987 #   include <sys/param.h>
988 #   include <sys/sysctl.h>
989 #  endif
990 #  if defined(__DragonFly__)
991 #   define HASSETLOGIN		1	/* has setlogin(2) */
992 #   define HASSRANDOMDEV	1	/* has srandomdev(3) */
993 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
994 #   undef SPT_TYPE
995 #   include <libutil.h>
996 #   define SPT_TYPE		SPT_BUILTIN
997 #   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
998 #   ifndef SMRSH_CMDDIR
999 #    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1000 #   endif /* ! SMRSH_CMDDIR */
1001 #   ifndef SMRSH_PATH
1002 #    define SMRSH_PATH		"/bin:/usr/bin"
1003 #   endif /* ! SMRSH_PATH */
1004 #  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
1005 #  include <sys/sysctl.h>
1006 #  endif /* defined(__DragonFly__) */
1007 #  if defined(__FreeBSD__)
1008 #   define HASSETLOGIN	1	/* has setlogin(2) */
1009 #   if __FreeBSD_version >= 227001
1010 #    define HASSRANDOMDEV	1	/* has srandomdev(3) */
1011 #    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
1012 #   endif /* __FreeBSD_version >= 227001 */
1013 #   undef SPT_TYPE
1014 #   if __FreeBSD__ >= 2
1015 #    include <osreldate.h>
1016 #    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
1017 #     include <libutil.h>
1018 #     define SPT_TYPE	SPT_BUILTIN
1019 #    endif /* __FreeBSD_version >= 199512 */
1020 #    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
1021 #     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1022 #    endif /* __FreeBSD_version >= 222000 */
1023 #    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
1024 #     ifndef SMRSH_CMDDIR
1025 #      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
1026 #     endif /* ! SMRSH_CMDDIR */
1027 #     ifndef SMRSH_PATH
1028 #      define SMRSH_PATH	"/bin:/usr/bin"
1029 #     endif /* ! SMRSH_PATH */
1030 #    endif /* __FreeBSD_version >= 330000 */
1031 #    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
1032 #    include <sys/sysctl.h>
1033 #   endif /* __FreeBSD__ >= 2 */
1034 #   ifndef SPT_TYPE
1035 #    define SPT_TYPE	SPT_REUSEARGV
1036 #    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
1037 #   endif /* ! SPT_TYPE */
1038 #  endif /* defined(__FreeBSD__) */
1039 #  if defined(__OpenBSD__)
1040 #   undef SPT_TYPE
1041 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
1042 #   define HASSETLOGIN	1	/* has setlogin(2) */
1043 #   if OpenBSD < 200305
1044 #    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
1045 #   endif /* OpenBSD < 200305 */
1046 #   define HASSETEGID	1	/* use setegid(2) to set saved gid */
1047 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
1048 #   if OpenBSD >= 200006
1049 #    define HASSRANDOMDEV	1	/* has srandomdev(3) */
1050 #   endif /* OpenBSD >= 200006 */
1051 #   if OpenBSD >= 200012
1052 #    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
1053 #   endif /* OpenBSD >= 200012 */
1054 #   if OpenBSD >= 200405
1055 #    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
1056 #   endif /* OpenBSD >= 200405 */
1057 #   if OpenBSD >= 200505
1058 #    undef NETISO	/* iso.h removed in 3.7 */
1059 #   endif /* OpenBSD >= 200505 */
1060 #  endif /* defined(__OpenBSD__) */
1061 # endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
1062 
1063 
1064 /*
1065 **  Mach386
1066 **
1067 **	For mt Xinu's Mach386 system.
1068 */
1069 
1070 # if defined(MACH) && defined(i386) && !defined(__GNU__)
1071 #  define MACH386	1
1072 #  define HASUNSETENV	1	/* has unsetenv(3) call */
1073 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1074 #  ifndef HASFLOCK
1075 #   define HASFLOCK	1	/* has flock(2) call */
1076 #  endif /* ! HASFLOCK */
1077 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1078 #  define NEEDSTRTOL	1	/* need the strtol() function */
1079 #  define setpgid	setpgrp
1080 #  ifndef LA_TYPE
1081 #   define LA_TYPE	LA_FLOAT
1082 #  endif /* ! LA_TYPE */
1083 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1084 #  undef HASSETVBUF		/* don't actually have setvbuf(3) */
1085 #  undef WEXITSTATUS
1086 #  undef WIFEXITED
1087 #  ifndef _PATH_VENDOR_CF
1088 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1089 #  endif /* ! _PATH_VENDOR_CF */
1090 #  ifndef _PATH_SENDMAILPID
1091 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1092 #  endif /* ! _PATH_SENDMAILPID */
1093 # endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
1094 
1095 
1096 
1097 /*
1098 **  GNU OS (hurd)
1099 **	Largely BSD & posix compatible.
1100 **	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
1101 **	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
1102 */
1103 
1104 # if defined(__GNU__) && !defined(NeXT)
1105 #  include <paths.h>
1106 #  define HASFCHMOD	1	/* has fchmod(2) call */
1107 #  define HASFCHOWN	1	/* has fchown(2) call */
1108 #  define HASUNAME	1	/* has uname(2) call */
1109 #  define HASUNSETENV	1	/* has unsetenv(3) call */
1110 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
1111 #  define HASSTRERROR	1	/* has strerror(3) */
1112 #  define GIDSET_T	gid_t
1113 #  define SOCKADDR_LEN_T	socklen_t
1114 #  define SOCKOPT_LEN_T	socklen_t
1115 #  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
1116 #   define LA_TYPE	LA_SUBR
1117 #  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1118 #   define LA_TYPE	LA_MACH
1119    /* GNU uses mach[34], which renames some rpcs from mach2.x. */
1120 #   define host_self	mach_host_self
1121 #  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1122 #  define SFS_TYPE	SFS_STATFS
1123 #  define SPT_TYPE	SPT_CHANGEARGV
1124 #  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
1125 #  define BSD4_4_SOCKADDR	1	/* has sa_len */
1126 #  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
1127 #  define HAS_IN_H	1	/* GNU has netinet/in.h. */
1128 /* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
1129 #  define MAXPATHLEN	2048
1130 # endif /* defined(__GNU__) && !defined(NeXT) */
1131 
1132 /*
1133 **  4.3 BSD -- this is for very old systems
1134 **
1135 **	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
1136 **
1137 **	You'll also have to install a new resolver library.
1138 **	I don't guarantee that support for this environment is complete.
1139 */
1140 
1141 # if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
1142 #  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
1143 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1144 #  define ARBPTR_T	char *
1145 #  define setpgid	setpgrp
1146 #  ifndef LA_TYPE
1147 #   define LA_TYPE	LA_FLOAT
1148 #  endif /* ! LA_TYPE */
1149 #  ifndef _PATH_VENDOR_CF
1150 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1151 #  endif /* ! _PATH_VENDOR_CF */
1152 #  ifndef IDENTPROTO
1153 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1154 #  endif /* ! IDENTPROTO */
1155 #  undef WEXITSTATUS
1156 #  undef WIFEXITED
1157 typedef short		pid_t;
1158 # endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
1159 
1160 
1161 /*
1162 **  SCO Unix
1163 **
1164 **	This includes three parts:
1165 **
1166 **	The first is for SCO OpenServer 5.
1167 **	(Contributed by Keith Reynolds <keithr@sco.COM>).
1168 **
1169 **		SCO OpenServer 5 has a compiler version number macro,
1170 **		which we can use to figure out what version we're on.
1171 **		This may have to change in future releases.
1172 **
1173 **	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
1174 **	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
1175 **
1176 **	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
1177 */
1178 
1179 /* SCO OpenServer 5 */
1180 # if _SCO_DS >= 1
1181 #  include <paths.h>
1182 #  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
1183 #  define HASFCHMOD	1	/* has fchmod(2) call */
1184 #  define HASFCHOWN	1	/* has fchown(2) call */
1185 #  define HASSETRLIMIT	1	/* has setrlimit(2) call */
1186 #  define USESETEUID	1	/* has seteuid(2) call */
1187 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1188 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
1189 #  define RLIMIT_NEEDS_SYS_TIME_H	1
1190 #  define LDA_USE_LOCKF	1
1191 #  ifndef LA_TYPE
1192 #   define LA_TYPE	LA_DEVSHORT
1193 #  endif /* ! LA_TYPE */
1194 #  define _PATH_AVENRUN	"/dev/table/avenrun"
1195 #  ifndef _SCO_unix_4_2
1196 #   define _SCO_unix_4_2
1197 #  else /* ! _SCO_unix_4_2 */
1198 #   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1199 #   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
1200 #  endif /* ! _SCO_unix_4_2 */
1201 # endif /* _SCO_DS >= 1 */
1202 
1203 /* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
1204 # ifdef _SCO_unix_4_2
1205 #  define _SCO_unix_
1206 #  define HASSETREUID	1	/* has setreuid(2) call */
1207 # endif /* _SCO_unix_4_2 */
1208 
1209 /* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
1210 # ifdef _SCO_unix_
1211 #  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1212 #  define SYSTEM5	1	/* include all the System V defines */
1213 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1214 #  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
1215 #  ifndef USE_SIGLONGJMP
1216 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1217 #  endif /* ! USE_SIGLONGJMP */
1218 #  define MAXPATHLEN	PATHSIZE
1219 #  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
1220 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
1221 #  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
1222 #  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
1223 #  define UID_T		uid_t
1224 #  define GID_T		gid_t
1225 #  define GIDSET_T	gid_t
1226 #  define _PATH_UNIX		"/unix"
1227 #  ifndef _PATH_VENDOR_CF
1228 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1229 #  endif /* ! _PATH_VENDOR_CF */
1230 #  ifndef _PATH_SENDMAILPID
1231 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1232 #  endif /* ! _PATH_SENDMAILPID */
1233 
1234 /* stuff fixed in later releases */
1235 #  ifndef _SCO_unix_4_2
1236 #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1237 #  endif /* ! _SCO_unix_4_2 */
1238 
1239 #  ifndef _SCO_DS
1240 #   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
1241 #   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1242 #   define NETUNIX	0	/* no unix domain socket support */
1243 #   define LA_TYPE	LA_SHORT
1244 #  endif /* ! _SCO_DS */
1245 
1246 # endif /* _SCO_unix_ */
1247 
1248 /*
1249 **  ISC (SunSoft) Unix.
1250 **
1251 **	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
1252 */
1253 
1254 # ifdef ISC_UNIX
1255 #  include <net/errno.h>
1256 #  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1257 #  include <sys/bsdtypes.h>
1258 #  define SYSTEM5	1	/* include all the System V defines */
1259 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1260 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1261 #  define HASSETREUID	1	/* has setreuid(2) call */
1262 #  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1263 #  define NETUNIX	0	/* no unix domain socket support */
1264 #  define MAXPATHLEN	1024
1265 #  define LA_TYPE	LA_SHORT
1266 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1267 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
1268 #  define _PATH_UNIX		"/unix"
1269 #  ifndef _PATH_VENDOR_CF
1270 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1271 #  endif /* ! _PATH_VENDOR_CF */
1272 #  ifndef _PATH_SENDMAILPID
1273 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1274 #  endif /* ! _PATH_SENDMAILPID */
1275 # endif /* ISC_UNIX */
1276 
1277 
1278 /*
1279 **  Altos System V (5.3.1)
1280 **	Contributed by Tim Rice <tim@trr.metro.net>.
1281 */
1282 
1283 # ifdef ALTOS_SYSTEM_V
1284 #  include <sys/stream.h>
1285 #  include <limits.h>
1286 #  define SYSTEM5	1	/* include all the System V defines */
1287 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1288 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1289 #  define WAITUNION	1	/* use "union wait" as wait argument type */
1290 #  define NEEDFSYNC	1	/* no fsync(2) in system library */
1291 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
1292 #  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
1293 #  define MAXPATHLEN	PATH_MAX
1294 #  define LA_TYPE	LA_SHORT
1295 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1296 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
1297 #  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
1298 #  define NETUNIX	0	/* no unix domain socket support */
1299 #  undef WIFEXITED
1300 #  undef WEXITSTATUS
1301 #  define strtoul	strtol	/* gcc library bogosity */
1302 
1303 typedef unsigned short	uid_t;
1304 typedef unsigned short	gid_t;
1305 typedef short		pid_t;
1306 typedef unsigned long	mode_t;
1307 
1308 /* some stuff that should have been in the include files */
1309 extern char		*malloc();
1310 extern struct passwd	*getpwent();
1311 extern struct passwd	*getpwnam();
1312 extern struct passwd	*getpwuid();
1313 extern char		*getenv();
1314 extern struct group	*getgrgid();
1315 extern struct group	*getgrnam();
1316 
1317 # endif /* ALTOS_SYSTEM_V */
1318 
1319 
1320 /*
1321 **  ConvexOS 11.0 and later
1322 **
1323 **	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
1324 **	works on 9.1 as well.
1325 **
1326 **  ConvexOS 11.5 and later, should work on 11.0 as defined.
1327 **  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
1328 **
1329 **	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
1330 **		(now the CONVEX Technologies Center of Hewlett Packard)
1331 */
1332 
1333 # ifdef _CONVEX_SOURCE
1334 #  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
1335 #  define HASINITGROUPS	1	/* has initgroups(3) */
1336 #  define HASUNAME	1	/* use System V uname(2) system call */
1337 #  define HASSETSID	1	/* has POSIX setsid(2) call */
1338 #  define HASUNSETENV	1	/* has unsetenv(3) */
1339 #  define HASFLOCK	1	/* has flock(2) */
1340 #  define HASSETRLIMIT	1	/* has setrlimit(2) */
1341 #  define HASSETREUID	1	/* has setreuid(2) */
1342 #  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
1343 #  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
1344 #  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
1345 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
1346 #  define LA_TYPE	LA_FLOAT
1347 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1348 #  ifndef _PATH_VENDOR_CF
1349 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1350 #  endif /* ! _PATH_VENDOR_CF */
1351 #  ifndef S_IREAD
1352 #   define S_IREAD	_S_IREAD
1353 #   define S_IWRITE	_S_IWRITE
1354 #   define S_IEXEC	_S_IEXEC
1355 #   define S_IFMT	_S_IFMT
1356 #   define S_IFCHR	_S_IFCHR
1357 #   define S_IFBLK	_S_IFBLK
1358 #  endif /* ! S_IREAD */
1359 #  ifndef TZ_TYPE
1360 #   define TZ_TYPE	TZ_TIMEZONE
1361 #  endif /* ! TZ_TYPE */
1362 #  ifndef IDENTPROTO
1363 #   define IDENTPROTO	1
1364 #  endif /* ! IDENTPROTO */
1365 #  ifndef SHARE_V1
1366 #   define SHARE_V1	1	/* version 1 of the fair share scheduler */
1367 #  endif /* ! SHARE_V1 */
1368 #  if !defined(__GNUC__ )
1369 #   define UID_T	int		/* GNUC gets it right, ConvexC botches */
1370 #   define GID_T	int		/* GNUC gets it right, ConvexC botches */
1371 #  endif /* !defined(__GNUC__ ) */
1372 #  if SECUREWARE
1373 #   define FORK	fork		/* SecureWare wants the real fork! */
1374 #  else /* SECUREWARE */
1375 #   define FORK	vfork		/* the rest of the OS versions don't care */
1376 #  endif /* SECUREWARE */
1377 # endif /* _CONVEX_SOURCE */
1378 
1379 
1380 /*
1381 **  RISC/os 4.52
1382 **
1383 **	Gives a ton of warning messages, but otherwise compiles.
1384 */
1385 
1386 # ifdef RISCOS
1387 
1388 #  define HASUNSETENV	1	/* has unsetenv(3) call */
1389 #  ifndef HASFLOCK
1390 #   define HASFLOCK	1	/* has flock(2) call */
1391 #  endif /* ! HASFLOCK */
1392 #  define WAITUNION	1	/* use "union wait" as wait argument type */
1393 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1394 #  define NEEDPUTENV	1	/* need putenv(3) call */
1395 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
1396 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1397 #  define LA_TYPE	LA_INT
1398 #  define LA_AVENRUN	"avenrun"
1399 #  define _PATH_UNIX	"/unix"
1400 #  undef WIFEXITED
1401 
1402 #  define setpgid	setpgrp
1403 
1404 typedef int		pid_t;
1405 #  define SIGFUNC_DEFINED
1406 #  define SIGFUNC_RETURN	(0)
1407 #  define SIGFUNC_DECL	int
1408 typedef int		(*sigfunc_t)();
1409 extern char		*getenv();
1410 extern void		*malloc();
1411 
1412 /* added for RISC/os 4.01...which is dumber than 4.50 */
1413 #  ifdef RISCOS_4_0
1414 #   ifndef ARBPTR_T
1415 #    define ARBPTR_T	char *
1416 #   endif /* ! ARBPTR_T */
1417 #   undef HASFLOCK
1418 #   define HASFLOCK	0
1419 #  endif /* RISCOS_4_0 */
1420 
1421 #  include <sys/time.h>
1422 
1423 # endif /* RISCOS */
1424 
1425 
1426 /*
1427 **  Linux 0.99pl10 and above...
1428 **
1429 **  Thanks to, in reverse order of contact:
1430 **
1431 **	John Kennedy <warlock@csuchico.edu>
1432 **	Andrew Pam <avatar@aus.xanadu.com>
1433 **	Florian La Roche <rzsfl@rz.uni-sb.de>
1434 **	Karl London <karl@borg.demon.co.uk>
1435 **
1436 **  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
1437 **	file locking is no longer allowed.  In particular, make sure
1438 **	your DBM library and sendmail are both using either flock(2)
1439 **	*or* fcntl(2) file locking, but not both.
1440 */
1441 
1442 # ifdef __linux__
1443 #  include <linux/version.h>
1444 #  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
1445 #   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
1446 #  endif /* !defined(KERNEL_VERSION) */
1447 #  define BSD		1	/* include BSD defines */
1448 #  define HASSETREGID	1	/* use setregid(2) to set saved gid */
1449 #  ifndef REQUIRES_DIR_FSYNC
1450 #   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
1451 #  endif /* REQUIRES_DIR_FSYNC */
1452 #  ifndef USESETEUID
1453 #   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
1454 #  endif /* USESETEUID */
1455 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1456 #  define HASUNAME	1	/* use System V uname(2) system call */
1457 #  define HASUNSETENV	1	/* has unsetenv(3) call */
1458 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
1459 #  define GIDSET_T	gid_t	/* from <linux/types.h> */
1460 #  ifndef HASGETUSERSHELL
1461 #   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
1462 #  endif /* HASGETUSERSHELL */
1463 #  ifndef IP_SRCROUTE
1464 #   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
1465 #  endif /* ! IP_SRCROUTE */
1466 #  ifndef HAS_IN_H
1467 #   define HAS_IN_H	1	/* use netinet/in.h */
1468 #  endif /* ! HAS_IN_H */
1469 #  ifndef USE_SIGLONGJMP
1470 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1471 #  endif /* ! USE_SIGLONGJMP */
1472 #  ifndef HASFLOCK
1473 #   if LINUX_VERSION_CODE < 66399
1474 #    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
1475 #   else /* LINUX_VERSION_CODE < 66399 */
1476 #     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
1477 #      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1478 #     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1479 #      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1480 #     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1481 #   endif /* LINUX_VERSION_CODE < 66399 */
1482 #  endif /* ! HASFLOCK */
1483 #  ifndef LA_TYPE
1484 #   define LA_TYPE	LA_PROCSTR
1485 #  endif /* ! LA_TYPE */
1486 #  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
1487 #  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
1488 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
1489 #   ifndef HASURANDOMDEV
1490 #    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
1491 #   endif /* ! HASURANDOMDEV */
1492 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1493 #  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1494 #   define HASSTRERROR	1	/* has strerror(3) */
1495 #  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1496 #  ifndef TZ_TYPE
1497 #   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
1498 #  endif /* ! TZ_TYPE */
1499 #  if (__GLIBC__ >= 2)
1500 #   include <paths.h>
1501 #  endif /* (__GLIBC__ >= 2) */
1502 #  ifndef _PATH_SENDMAILPID
1503 #   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
1504 #  endif /* ! _PATH_SENDMAILPID */
1505 #  include <sys/sysmacros.h>
1506 #  undef atol			/* wounded in <stdlib.h> */
1507 #  if NETINET6
1508    /*
1509    **  Linux doesn't have a good way to tell userland what interfaces are
1510    **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
1511    **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
1512    **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
1513    */
1514 #   define ADDRCONFIG_IS_BROKEN	1
1515 
1516    /*
1517    **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
1518    **  in 2.1 and later, but the APIs appear before the functions.
1519    */
1520 #   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1521 #    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
1522 #    if (GLIBC_VERSION >= 0x201)
1523 #     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
1524 #    else /* (GLIBC_VERSION >= 0x201) */
1525 #     include <linux/in6.h>	/* IPv6 support */
1526 #    endif /* (GLIBC_VERSION >= 0x201) */
1527 #    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
1528      /* Have APIs in <netdb.h>, but no support in glibc */
1529 #     define NEEDSGETIPNODE	1
1530 #    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
1531 #    undef GLIBC_VERSION
1532 #   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1533 #  endif /* NETINET6 */
1534 #  ifndef HASFCHOWN
1535 #   define HASFCHOWN	1	/* fchown(2) */
1536 #  endif /* ! HASFCHOWN */
1537 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
1538 #    define HASFCHMOD	1	/* fchmod(2) */
1539 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
1540 # endif /* __linux__ */
1541 
1542 
1543 /*
1544 **  DELL SVR4 Issue 2.2, and others
1545 **	From Kimmo Suominen <kim@grendel.lut.fi>
1546 **
1547 **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
1548 **	defined, and the definitions conflict.
1549 **
1550 **	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
1551 **	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
1552 **	(SVR4.0/386 version 3.0).
1553 */
1554 
1555 # ifdef DELL_SVR4
1556 				/* no changes necessary */
1557 				/* see general __svr4__ defines below */
1558 # endif /* DELL_SVR4 */
1559 
1560 
1561 /*
1562 **  Apple A/UX 3.0
1563 */
1564 
1565 # ifdef _AUX_SOURCE
1566 #  include <sys/sysmacros.h>
1567 #  define BSD			/* has BSD routines */
1568 #  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
1569 #  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
1570 #  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
1571 #  define HASUNAME	1	/* use System V uname(2) system call */
1572 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
1573 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1574 #  define HASSETVBUF	1	/* has setvbuf(3) in libc */
1575 #  define HASSTRERROR	1	/* has strerror(3) */
1576 #  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
1577 #  define SIGFUNC_RETURN		/* POSIX-mode */
1578 #  define SIGFUNC_DECL	void	/* POSIX-mode */
1579 #  define ERRLIST_PREDEFINED	1
1580 #  ifndef IDENTPROTO
1581 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1582 #  endif /* ! IDENTPROTO */
1583 #  ifndef LA_TYPE
1584 #   define LA_TYPE	LA_INT
1585 #   define FSHIFT	16
1586 #  endif /* ! LA_TYPE */
1587 #  define LA_AVENRUN	"avenrun"
1588 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1589 #  define TZ_TYPE	TZ_TZNAME
1590 #  ifndef _PATH_UNIX
1591 #   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
1592 #  endif /* ! _PATH_UNIX */
1593 #  ifndef _PATH_VENDOR_CF
1594 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1595 #  endif /* ! _PATH_VENDOR_CF */
1596 #  undef WIFEXITED
1597 #  undef WEXITSTATUS
1598 # endif /* _AUX_SOURCE */
1599 
1600 
1601 /*
1602 **  Encore UMAX V
1603 **
1604 **	Not extensively tested.
1605 */
1606 
1607 # ifdef UMAXV
1608 #  define HASUNAME	1	/* use System V uname(2) system call */
1609 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
1610 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1611 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1612 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1613 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
1614 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1615 #  define MAXPATHLEN	PATH_MAX
1616 extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
1617 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
1618 #  undef WIFEXITED
1619 #  undef WEXITSTATUS
1620 # endif /* UMAXV */
1621 
1622 
1623 /*
1624 **  Stardent Titan 3000 running TitanOS 4.2.
1625 **
1626 **	Must be compiled in "cc -43" mode.
1627 **
1628 **	From Kate Hedstrom <kate@ahab.rutgers.edu>.
1629 **
1630 **	Note the tweaking below after the BSD defines are set.
1631 */
1632 
1633 # ifdef titan
1634 #  define setpgid	setpgrp
1635 typedef int		pid_t;
1636 #  undef WIFEXITED
1637 #  undef WEXITSTATUS
1638 # endif /* titan */
1639 
1640 
1641 /*
1642 **  Sequent DYNIX 3.2.0
1643 **
1644 **	From Jim Davis <jdavis@cs.arizona.edu>.
1645 */
1646 
1647 # ifdef sequent
1648 
1649 #  define BSD		1
1650 #  define HASUNSETENV	1
1651 #  define BSD4_3		1	/* to get signal() in conf.c */
1652 #  define WAITUNION	1
1653 #  define LA_TYPE	LA_FLOAT
1654 #  ifdef _POSIX_VERSION
1655 #   undef _POSIX_VERSION		/* set in <unistd.h> */
1656 #  endif /* _POSIX_VERSION */
1657 #  undef HASSETVBUF		/* don't actually have setvbuf(3) */
1658 #  define setpgid	setpgrp
1659 
1660 /* Have to redefine WIFEXITED to take an int, to work with waitfor() */
1661 #  undef	WIFEXITED
1662 #  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
1663 			 ((union wait*)&(s))->w_termsig == 0)
1664 #  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
1665 typedef int		pid_t;
1666 #  define isgraph(c)	(isprint(c) && (c != ' '))
1667 
1668 #  ifndef IDENTPROTO
1669 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1670 #  endif /* ! IDENTPROTO */
1671 
1672 #  ifndef _PATH_UNIX
1673 #   define _PATH_UNIX		"/dynix"
1674 #  endif /* ! _PATH_UNIX */
1675 #  ifndef _PATH_VENDOR_CF
1676 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1677 #  endif /* ! _PATH_VENDOR_CF */
1678 # endif /* sequent */
1679 
1680 
1681 /*
1682 **  Sequent DYNIX/ptx v2.0 (and higher)
1683 **
1684 **	For DYNIX/ptx v1.x, undefine HASSETREUID.
1685 **
1686 **	From Tim Wright <timw@sequent.com>.
1687 **	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
1688 **		for DYNIX/ptx 4.0.2.
1689 */
1690 
1691 # ifdef _SEQUENT_
1692 #  include <sys/stream.h>
1693 #  define SYSTEM5	1	/* include all the System V defines */
1694 #  define HASSETSID	1	/* has POSIX setsid(2) call */
1695 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1696 #  define HASSETREUID	1	/* has setreuid(2) call */
1697 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1698 #  define GIDSET_T	gid_t
1699 #  define LA_TYPE	LA_INT
1700 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1701 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
1702 #  ifndef IDENTPROTO
1703 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1704 #  endif /* ! IDENTPROTO */
1705 #  ifndef _PATH_VENDOR_CF
1706 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1707 #  endif /* ! _PATH_VENDOR_CF */
1708 #  ifndef _PATH_SENDMAILPID
1709 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1710 #  endif /* ! _PATH_SENDMAILPID */
1711 # endif /* _SEQUENT_ */
1712 
1713 /*
1714 **  Cray UNICOS, UNICOS/mk, and UNICOS/mp
1715 **
1716 **    UNICOS:
1717 **	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
1718 **	Update Brian Ginsbach <ginsbach@cray.com>
1719 **    UNICOS/mk (Cray T3E):
1720 **	Contributed by Manu Mahonen <mailadm@csc.fi>
1721 **	of Center for Scientific Computing.
1722 **	Update Brian Ginsbach <ginsbach@cray.com>
1723 **    UNICOS/mp:
1724 **	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
1725 */
1726 
1727 # if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
1728 #  define SYSTEM5	1	/* include all the System V defines */
1729 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
1730 #  define HASFCHOWN	1	/* has fchown(2) */
1731 #  define HASUNSETENV	1	/* has unsetenv(3) call */
1732 #  define HASINITGROUPS	1	/* has initgroups(3) call */
1733 #  define HASSETREUID	1	/* has setreuid(2) call */
1734 #  define USESETEUID	1	/* has usable seteuid(2) call */
1735 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
1736 #  define HASSTRERROR	1	/* has strerror(3) */
1737 #  define GIDSET_T	gid_t
1738 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1739 #  define SFS_BAVAIL	f_bfree	/* alternate field name */
1740 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1741 #  ifdef UNICOS
1742 #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1743 #   define LA_TYPE	LA_ZERO
1744 #   define _PATH_MAILDIR	"/usr/spool/mail"
1745 #   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
1746 #   ifndef MAXPATHLEN
1747 #    define MAXPATHLEN PATHSIZE
1748 #   endif /* ! MAXPATHLEN */
1749 #   ifndef _PATH_UNIX
1750 #    ifdef UNICOSMK
1751 #     define _PATH_UNIX		"/unicosmk.ar"
1752 #    else
1753 #     define _PATH_UNIX		"/unicos"
1754 #    endif /* UNICOSMK */
1755 #   endif /* ! _PATH_UNIX */
1756 #   ifndef _PATH_VENDOR_CF
1757 #    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1758 #   endif /* ! _PATH_VENDOR_CF */
1759 #  endif /* UNICOS */
1760 #  ifdef _UNICOSMP
1761 #  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1762     /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1763 #   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1764 #  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
1765 #   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
1766 #   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
1767 #   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1768 #   include <sys/cdefs.h>
1769 #   include <paths.h>
1770 #   define ARGV_T char *const *
1771 #  endif /* _UNICOSMP */
1772 # endif /* _CRAY */
1773 
1774 /*
1775 **  Apollo DomainOS
1776 **
1777 **  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
1778 **
1779 **  15 Jan 1994; updated 2 Aug 1995
1780 **
1781 */
1782 
1783 # ifdef apollo
1784 #  define HASSETREUID	1	/* has setreuid(2) call */
1785 #  define HASINITGROUPS	1	/* has initgroups(2) call */
1786 #  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
1787 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
1788 #  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
1789 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1790 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
1791 #  define TZ_TYPE	TZ_TZNAME
1792 #  ifndef _PATH_VENDOR_CF
1793 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1794 #  endif /* ! _PATH_VENDOR_CF */
1795 #  ifndef _PATH_SENDMAILPID
1796 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1797 #  endif /* ! _PATH_SENDMAILPID */
1798 #  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
1799 #  undef	 S_IFIFO
1800 #  define S_IFIFO	0010000
1801 #  ifndef IDENTPROTO
1802 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1803 #  endif /* ! IDENTPROTO */
1804 #  define RLIMIT_NEEDS_SYS_TIME_H	1
1805 #  if defined(NGROUPS_MAX) && !NGROUPS_MAX
1806 #   undef NGROUPS_MAX
1807 #  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
1808 # endif /* apollo */
1809 
1810 /*
1811 **  MPE-iX
1812 **
1813 **	Requires MPE 6.0 or greater.  See sendmail/README for more info.
1814 **
1815 **	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
1816 */
1817 
1818 # ifdef MPE
1819 
1820 #  include <sys/sysmacros.h>
1821 #  include <fcntl.h>
1822 
1823 /* Sendmail stuff */
1824 #  define HASFCHOWN		0	/* lacks fchown() */
1825 #  define HASGETUSERSHELL	0	/* lacks getusershell() */
1826 #  ifdef HASNICE
1827 #   undef  HASNICE
1828 #  endif /* HASNICE */
1829 #  define HASNICE		0	/* lacks nice() */
1830 #  define HASRANDOM		0	/* lacks random() */
1831 #  ifdef HASRRESVPORT
1832 #   undef HASRRESVPORT
1833 #  endif /* HASRRESVPORT */
1834 #  define HASRRESVPORT		0	/* lacks rresvport() */
1835 #  define IP_SRCROUTE		0	/* lacks IP source routing fields */
1836 #  ifdef MATCHGECOS
1837 #   undef MATCHGECOS
1838 #  endif /* MATCHGECOS */
1839 #  define MATCHGECOS		0	/* lacks an initialized GECOS field */
1840 #  define NEEDFSYNC		1	/* use sendmail's fsync() */
1841 #  define NEEDLINK		1	/* use sendmail's link() */
1842 #  define NOFTRUNCATE		1	/* lacks ftruncate() */
1843 #  define SFS_TYPE		SFS_NONE /* can't determine disk space */
1844 #  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
1845 #  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
1846 #  define USE_ENVIRON		1	/* use environ instead of envp */
1847 
1848 /* Missing header stuff */
1849 #  define AF_UNSPEC		0
1850 #  define AF_MAX		AF_INET
1851 #  define IFF_LOOPBACK		0x8
1852 #  define IN_LOOPBACKNET	127
1853 #  define MAXNAMLEN		NAME_MAX
1854 #  define S_IEXEC		S_IXUSR
1855 #  define S_IREAD		S_IRUSR
1856 #  define S_IWRITE		S_IWUSR
1857 
1858 /* Present header stuff that needs to be missing */
1859 #  undef NGROUPS_MAX
1860 
1861 /* Shadow functions */
1862 #  define bind		sendmail_mpe_bind
1863 #  define _exit		sendmail_mpe__exit
1864 #  define exit		sendmail_mpe_exit
1865 #  define fcntl		sendmail_mpe_fcntl
1866 #  define getegid	sendmail_mpe_getegid
1867 #  define geteuid	sendmail_mpe_geteuid
1868 #  define getpwnam	sendmail_mpe_getpwnam
1869 #  define getpwuid	sendmail_mpe_getpwuid
1870 #  define setgid	sendmail_mpe_setgid
1871 #  define setuid	sendmail_mpe_setuid
1872 extern int		sendmail_mpe_fcntl __P((int, int, ...));
1873 extern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
1874 extern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
1875 # endif /* MPE */
1876 
1877 /*
1878 **  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
1879 **
1880 **	Contributed by Paul Gampe <paulg@apnic.net>
1881 */
1882 
1883 # ifdef __svr5__
1884 #  include <sys/mkdev.h>
1885 #  define __svr4__
1886 #  define SYS5SIGNALS		1
1887 #  define HASFCHOWN		1	/* has fchown(2) call */
1888 #  define HASSETSID	1	/* has POSIX setsid(2) call */
1889 #  define HASSETREUID		1
1890 #  define HASWAITPID		1
1891 #  define HASGETDTABLESIZE	1
1892 #  define GIDSET_T		gid_t
1893 #  define SOCKADDR_LEN_T	size_t
1894 #  define SOCKOPT_LEN_T		size_t
1895 #  ifndef _PATH_UNIX
1896 #   define _PATH_UNIX		"/stand/unix"
1897 #  endif /* ! _PATH_UNIX */
1898 #  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
1899 #  ifndef SYSLOG_BUFSIZE
1900 #   define SYSLOG_BUFSIZE	1024	/* unsure */
1901 #  endif /* ! SYSLOG_BUFSIZE */
1902 #  ifndef _PATH_VENDOR_CF
1903 #   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
1904 #  endif /* ! _PATH_VENDOR_CF */
1905 #  ifndef _PATH_SENDMAILPID
1906 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1907 #  endif /* ! _PATH_SENDMAILPID */
1908 #  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
1909 #if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
1910 # define SM_SET_H_ERRNO(err)	set_h_errno((err))
1911 #endif /* ! SM_SET_H_ERRNO && _REENTRANT */
1912 # endif /* __svr5__ */
1913 
1914 /* ###################################################################### */
1915 
1916 /*
1917 **  UnixWare 2.x
1918 */
1919 
1920 # ifdef UNIXWARE2
1921 #  define UNIXWARE	1
1922 #  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
1923 # endif /* UNIXWARE2 */
1924 
1925 
1926 /*
1927 **  UnixWare 1.1.2.
1928 **
1929 **	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
1930 **	From Evan Champion <evanc@spatial.synapse.org>.
1931 */
1932 
1933 # ifdef UNIXWARE
1934 #  include <sys/mkdev.h>
1935 #  define SYSTEM5		1
1936 #  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
1937 #  define HASSETREUID		1
1938 #  define HASSETSID	1	/* has POSIX setsid(2) call */
1939 #  define HASINITGROUPS		1
1940 #  define GIDSET_T		gid_t
1941 #  define SLEEP_T		unsigned
1942 #  define SFS_TYPE		SFS_STATVFS
1943 #  define LA_TYPE		LA_ZERO
1944 #  undef WIFEXITED
1945 #  undef WEXITSTATUS
1946 #  ifndef _PATH_UNIX
1947 #   define _PATH_UNIX		"/unix"
1948 #  endif /* ! _PATH_UNIX */
1949 #  ifndef _PATH_VENDOR_CF
1950 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
1951 #  endif /* ! _PATH_VENDOR_CF */
1952 #  ifndef _PATH_SENDMAILPID
1953 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
1954 #  endif /* ! _PATH_SENDMAILPID */
1955 #  define SYSLOG_BUFSIZE	128
1956 # endif /* UNIXWARE */
1957 
1958 
1959 /*
1960 **  Intergraph CLIX 3.1
1961 **
1962 **	From Paul Southworth <pauls@locust.cic.net>
1963 */
1964 
1965 # ifdef CLIX
1966 #  define SYSTEM5	1	/* looks like System V */
1967 #  ifndef HASGETUSERSHELL
1968 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1969 #  endif /* ! HASGETUSERSHELL */
1970 #  define DEV_BSIZE	512	/* device block size not defined */
1971 #  define GIDSET_T	gid_t
1972 #  undef LOG			/* syslog not available */
1973 #  define NEEDFSYNC	1	/* no fsync in system library */
1974 #  define GETSHORT	_getshort
1975 # endif /* CLIX */
1976 
1977 
1978 /*
1979 **  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
1980 **
1981 **	From Kevin Darcy <kevin@tech.mis.cfc.com>.
1982 */
1983 
1984 # ifdef NCR_MP_RAS2
1985 #  include <sys/sockio.h>
1986 #  define __svr4__
1987 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
1988 #  define SYSLOG_BUFSIZE	1024
1989 #  define SPT_TYPE  SPT_NONE
1990 # endif /* NCR_MP_RAS2 */
1991 
1992 
1993 /*
1994 **  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
1995 **
1996 **	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
1997 */
1998 
1999 # ifdef NCR_MP_RAS3
2000 #  define __svr4__
2001 #  define HASFCHOWN		1	/* has fchown(2) call */
2002 #  define LDA_USE_LOCKF		1
2003 #  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
2004 #  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
2005 #  define SYSLOG_BUFSIZE	1024
2006 #  define SPT_TYPE	SPT_NONE
2007 #  define _PATH_MAILDIR	"/var/mail"
2008 #  ifndef _XOPEN_SOURCE
2009 #   define _XOPEN_SOURCE
2010 #   define _XOPEN_SOURCE_EXTENDED 1
2011 #   include <sys/resource.h>
2012 #   undef _XOPEN_SOURCE
2013 #   undef _XOPEN_SOURCE_EXTENDED
2014 #  endif /* ! _XOPEN_SOURCE */
2015 # endif /* NCR_MP_RAS3 */
2016 
2017 
2018 /*
2019 **  Tandem NonStop-UX SVR4
2020 **
2021 **	From Rick McCarty <mccarty@mpd.tandem.com>.
2022 */
2023 
2024 # ifdef NonStop_UX_BXX
2025 #  define __svr4__
2026 # endif /* NonStop_UX_BXX */
2027 
2028 
2029 /*
2030 **  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
2031 **
2032 **	Tested for 1.04, 1.03
2033 **	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
2034 **
2035 **	Tested for 4.02, 6.10 and 7.10
2036 **	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
2037 */
2038 
2039 # if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
2040 #  define SYSTEM5	1	/* include all the System V defines */
2041 #  define HASINITGROUPS	1	/* has initgroups(3) call */
2042 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
2043 #  define setreuid(r, e)	setresuid(r, e, -1)
2044 #  define LA_TYPE	LA_FLOAT
2045 #  define SPT_TYPE	SPT_PSTAT
2046 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
2047 #  ifndef HASSETVBUF
2048 #   define HASSETVBUF	/* HI-UX has no setlinebuf */
2049 #  endif /* ! HASSETVBUF */
2050 #  ifndef GIDSET_T
2051 #   define GIDSET_T	gid_t
2052 #  endif /* ! GIDSET_T */
2053 #  ifndef _PATH_UNIX
2054 #   define _PATH_UNIX		"/HI-UX"
2055 #  endif /* ! _PATH_UNIX */
2056 #  ifndef _PATH_VENDOR_CF
2057 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2058 #  endif /* ! _PATH_VENDOR_CF */
2059 #  ifndef IDENTPROTO
2060 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2061 #  endif /* ! IDENTPROTO */
2062 #  ifndef HASGETUSERSHELL
2063 #   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
2064 #  endif /* ! HASGETUSERSHELL */
2065 #  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
2066 
2067 /*
2068 **  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
2069 **  on HIUX 3050
2070 */
2071 #  undef m_flags
2072 
2073 #  define SM_CONF_SYSLOG	0
2074 
2075 # endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
2076 
2077 
2078 /*
2079 **  Amdahl UTS System V 2.1.5 (SVr3-based)
2080 **
2081 **    From: Janet Jackson <janet@dialix.oz.au>.
2082 */
2083 
2084 # ifdef _UTS
2085 #  include <sys/sysmacros.h>
2086 #  undef HASLSTAT		/* has symlinks, but they cause problems */
2087 #  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
2088 #  define SYS5SIGNALS	1	/* System V signal semantics */
2089 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
2090 #  define HASUNAME	1	/* use System V uname(2) system call */
2091 #  define HASINITGROUPS	1	/* has initgroups(3) function */
2092 #  define HASSETVBUF	1	/* has setvbuf(3) function */
2093 #  ifndef HASGETUSERSHELL
2094 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
2095 #  endif /* ! HASGETUSERSHELL */
2096 #  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
2097 #  define LA_TYPE	LA_ZERO		/* doesn't have load average */
2098 #  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
2099 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
2100 #  define _PATH_UNIX		"/unix"
2101 #  ifndef _PATH_VENDOR_CF
2102 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2103 #  endif /* ! _PATH_VENDOR_CF */
2104 # endif /* _UTS */
2105 
2106 /*
2107 **  Cray Computer Corporation's CSOS
2108 **
2109 **	From Scott Bolte <scott@craycos.com>.
2110 */
2111 
2112 # ifdef _CRAYCOM
2113 #  define SYSTEM5	1	/* include all the System V defines */
2114 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2115 #  define NEEDFSYNC	1	/* no fsync in system library */
2116 #  define MAXPATHLEN	PATHSIZE
2117 #  define LA_TYPE	LA_ZERO
2118 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
2119 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
2120 #  define _POSIX_CHOWN_RESTRICTED	-1
2121 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
2122 # endif /* _CRAYCOM */
2123 
2124 
2125 /*
2126 **  Sony NEWS-OS 4.2.1R and 6.0.3
2127 **
2128 **	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2129 */
2130 
2131 # ifdef sony_news
2132 #  ifndef __svr4
2133 			/* NEWS-OS 4.2.1R */
2134 #   ifndef BSD
2135 #    define BSD			/* has BSD routines */
2136 #   endif /* ! BSD */
2137 #   define HASUNSETENV	1	/* has unsetenv(2) call */
2138 #   undef HASSETVBUF		/* don't actually have setvbuf(3) */
2139 #   define WAITUNION	1	/* use "union wait" as wait argument type */
2140 #   define LA_TYPE	LA_INT
2141 #   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
2142 #   ifndef HASFLOCK
2143 #    define HASFLOCK	1	/* has flock(2) call */
2144 #   endif /* ! HASFLOCK */
2145 #   define setpgid	setpgrp
2146 #   undef WIFEXITED
2147 #   undef WEXITSTATUS
2148 #   define MODE_T	int	/* system include files have no mode_t */
2149 typedef int		pid_t;
2150 typedef int		(*sigfunc_t)();
2151 #   define SIGFUNC_DEFINED
2152 #   define SIGFUNC_RETURN	(0)
2153 #   define SIGFUNC_DECL		int
2154 
2155 #  else /* ! __svr4 */
2156 			/* NEWS-OS 6.0.3 with /bin/cc */
2157 #   ifndef __svr4__
2158 #    define __svr4__		/* use all System V Release 4 defines below */
2159 #   endif /* ! __svr4__ */
2160 #   define HASSETSID	1	/* has POSIX setsid(2) call */
2161 #   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
2162 #   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2163 #   ifndef SPT_TYPE
2164 #    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
2165 #   endif /* ! SPT_TYPE */
2166 #   define GIDSET_T	gid_t
2167 #   undef WIFEXITED
2168 #   undef WEXITSTATUS
2169 #   ifndef SYSLOG_BUFSIZE
2170 #    define SYSLOG_BUFSIZE	256
2171 #   endif /* ! SYSLOG_BUFSIZE */
2172 #   define _PATH_UNIX		"/stand/unix"
2173 #   ifndef _PATH_VENDOR_CF
2174 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2175 #   endif /* ! _PATH_VENDOR_CF */
2176 #   ifndef _PATH_SENDMAILPID
2177 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2178 #   endif /* ! _PATH_SENDMAILPID */
2179 
2180 #  endif /* ! __svr4 */
2181 # endif /* sony_news */
2182 
2183 
2184 /*
2185 **  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
2186 **
2187 **	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2188 */
2189 
2190 # ifdef luna
2191 #  ifndef IDENTPROTO
2192 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2193 #  endif /* ! IDENTPROTO */
2194 #  define HASUNSETENV	1	/* has unsetenv(2) call */
2195 #  define NEEDPUTENV	1	/* need putenv(3) call */
2196 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
2197 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
2198 #  define WAITUNION	1	/* use "union wait" as wait argument type */
2199 #  ifdef uniosb
2200 #   include <sys/time.h>
2201 #   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
2202 #   define LA_TYPE	LA_INT
2203 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2204 #  endif /* uniosb */
2205 #  ifdef luna2
2206 #   define LA_TYPE	LA_SUBR
2207 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2208 #  endif /* luna2 */
2209 #  ifdef luna88k
2210 #   define LA_TYPE	LA_INT
2211 #  endif /* luna88k */
2212 #  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
2213 #  define setpgid	setpgrp
2214 #  undef WIFEXITED
2215 #  undef WEXITSTATUS
2216 typedef int		pid_t;
2217 typedef int		(*sigfunc_t)();
2218 #  define SIGFUNC_DEFINED
2219 #  define SIGFUNC_RETURN	(0)
2220 #  define SIGFUNC_DECL	int
2221 extern char	*getenv();
2222 #  ifndef _PATH_VENDOR_CF
2223 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2224 #  endif /* ! _PATH_VENDOR_CF */
2225 # endif /* luna */
2226 
2227 
2228 /*
2229 **  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
2230 **
2231 **	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2232 */
2233 
2234 # if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
2235 #  ifndef __svr4__
2236 #   define __svr4__		/* use all System V Release 4 defines below */
2237 #  endif /* ! __svr4__ */
2238 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2239 #  define HASSETSID	1	/* has POSIX setsid(2) call */
2240 #  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
2241 #  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2242 #  define GIDSET_T	gid_t
2243 #  undef WIFEXITED
2244 #  undef WEXITSTATUS
2245 #  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
2246 #  ifndef _PATH_VENDOR_CF
2247 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2248 #  endif /* ! _PATH_VENDOR_CF */
2249 #  ifndef _PATH_SENDMAILPID
2250 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2251 #  endif /* ! _PATH_SENDMAILPID */
2252 #  ifndef SYSLOG_BUFSIZE
2253 #   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
2254 #  endif /* ! SYSLOG_BUFSIZE */
2255 # endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
2256 
2257 
2258 /*
2259 **  Fujitsu/ICL UXP/DS (For the DS/90 Series)
2260 **
2261 **	From Diego R. Lopez <drlopez@cica.es>.
2262 **	Additional changes from Fumio Moriya and Toshiaki Nomura of the
2263 **		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
2264 */
2265 
2266 # ifdef __uxp__
2267 #  include <arpa/nameser.h>
2268 #  include <sys/sysmacros.h>
2269 #  include <sys/mkdev.h>
2270 #  define __svr4__
2271 #  define HASGETUSERSHELL	0
2272 #  define HASFLOCK		0
2273 #  define _PATH_UNIX		"/stand/unix"
2274 #  ifndef _PATH_VENDOR_CF
2275 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2276 #  endif /* ! _PATH_VENDOR_CF */
2277 #  ifndef _PATH_SENDMAILPID
2278 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2279 #  endif /* ! _PATH_SENDMAILPID */
2280 # endif /* __uxp__ */
2281 
2282 /*
2283 **  Pyramid DC/OSx
2284 **
2285 **	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
2286 */
2287 
2288 # ifdef DCOSx
2289 #  define GIDSET_T	gid_t
2290 #  ifndef IDENTPROTO
2291 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2292 #  endif /* ! IDENTPROTO */
2293 # endif /* DCOSx */
2294 
2295 /*
2296 **  Concurrent Computer Corporation Maxion
2297 **
2298 **	From Donald R. Laster Jr. <laster@access.digex.net>.
2299 */
2300 
2301 # ifdef __MAXION__
2302 
2303 #  include <sys/stream.h>
2304 #  define __svr4__		1	/* SVR4.2MP */
2305 #  define HASSETREUID		1	/* have setreuid(2) */
2306 #  define HASLSTAT		1	/* have lstat(2) */
2307 #  define HASSETRLIMIT		1	/* have setrlimit(2) */
2308 #  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
2309 #  define HASGETUSERSHELL	1	/* have getusershell(3) */
2310 #  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
2311 #  define SLEEP_T		unsigned
2312 #  define SFS_TYPE		SFS_STATVFS
2313 #  define SFS_BAVAIL		f_bavail
2314 #  ifndef SYSLOG_BUFSIZE
2315 #   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
2316 #  endif /* ! SYSLOG_BUFSIZE */
2317 
2318 #  undef WUNTRACED
2319 #  undef WIFEXITED
2320 #  undef WIFSIGNALED
2321 #  undef WIFSTOPPED
2322 #  undef WEXITSTATUS
2323 #  undef WTERMSIG
2324 #  undef WSTOPSIG
2325 
2326 # endif /* __MAXION__ */
2327 
2328 /*
2329 **  Harris Nighthawk PowerUX (nh6000 box)
2330 **
2331 **  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
2332 */
2333 
2334 # ifdef _PowerUX
2335 #  ifndef __svr4__
2336 #   define __svr4__
2337 #  endif /* ! __svr4__ */
2338 #  ifndef _PATH_VENDOR_CF
2339 #   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2340 #  endif /* ! _PATH_VENDOR_CF */
2341 #  ifndef _PATH_SENDMAILPID
2342 #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2343 #  endif /* ! _PATH_SENDMAILPID */
2344 #  define SYSLOG_BUFSIZE		1024
2345 #  define LA_TYPE		LA_ZERO
2346 typedef struct msgb		mblk_t;
2347 #  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
2348 # endif /* _PowerUX */
2349 
2350 /*
2351 **  Siemens Nixdorf Informationssysteme AG SINIX
2352 **
2353 **	Contributed by Gerald Rinske of Siemens Business Services VAS.
2354 */
2355 # ifdef sinix
2356 #  define HASRANDOM		0	/* has random(3) */
2357 #  define SYSLOG_BUFSIZE	1024
2358 #  define SM_INT32		int	/* 32bit integer */
2359 # endif /* sinix */
2360 
2361 
2362 /*
2363 **  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
2364 **
2365 **	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
2366 */
2367 
2368 # ifdef MOTO
2369 #  define HASFCHMOD		1
2370 #  define HASSETRLIMIT		0
2371 #  define HASSETSID	1	/* has POSIX setsid(2) call */
2372 #  define HASSETREUID		1
2373 #  define HASULIMIT		1
2374 #  define HASWAITPID		1
2375 #  define HASGETDTABLESIZE	1
2376 #  define HASGETUSERSHELL	1
2377 #  define IP_SRCROUTE		0
2378 #  define IDENTPROTO		0
2379 #  define RES_DNSRCH_VARIABLE	_res_dnsrch
2380 #  define _PATH_UNIX		"/unix"
2381 #  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
2382 #  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
2383 # endif /* MOTO */
2384 
2385 /*
2386 **  Interix
2387 **	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2388 **
2389 **	Used for Interix support.
2390 */
2391 
2392 # if defined(__INTERIX)
2393 #  define HASURANDOMDEV		1
2394 #  define HASGETUSERSHELL	0
2395 #  define HASSTRERROR		1
2396 #  define HASUNSETENV		1
2397 #  define HASFCHOWN		1
2398 #  undef HAVE_SYS_ERRLIST
2399 #  define sys_errlist		__sys_errlist
2400 #  define sys_nerr		__sys_nerr
2401 #  include <sys/mkdev.h>
2402 #  ifndef major
2403 #   define major(dev)		((int)(((dev) >> 8) & 0xff))
2404 #  endif /* ! major */
2405 #  ifndef minor
2406 #   define minor(dev)		((int)((dev) & 0xff))
2407 #  endif /* ! minor */
2408 # endif /* defined(__INTERIX) */
2409 
2410 
2411 /**********************************************************************
2412 **  End of Per-Operating System defines
2413 **********************************************************************/
2414 /**********************************************************************
2415 **  More general defines
2416 **********************************************************************/
2417 
2418 /* general BSD defines */
2419 # ifdef BSD
2420 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
2421 #  ifndef HASSETREUID
2422 #   define HASSETREUID	1	/* has setreuid(2) call */
2423 #  endif /* ! HASSETREUID */
2424 #  define HASINITGROUPS	1	/* has initgroups(3) call */
2425 #  ifndef IP_SRCROUTE
2426 #   define IP_SRCROUTE	1	/* can check IP source routing */
2427 #  endif /* ! IP_SRCROUTE */
2428 #  ifndef HASSETRLIMIT
2429 #   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2430 #  endif /* ! HASSETRLIMIT */
2431 #  ifndef HASFLOCK
2432 #   define HASFLOCK	1	/* has flock(2) call */
2433 #  endif /* ! HASFLOCK */
2434 #  ifndef TZ_TYPE
2435 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
2436 #  endif /* ! TZ_TYPE */
2437 # endif /* BSD */
2438 
2439 /* general System V Release 4 defines */
2440 # ifdef __svr4__
2441 #  define SYSTEM5	1
2442 #  define USESETEUID	1	/* has usable seteuid(2) call */
2443 #  define HASINITGROUPS	1	/* has initgroups(3) call */
2444 #  define BSD_COMP	1	/* get BSD ioctl calls */
2445 #  ifndef HASSETRLIMIT
2446 #   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2447 #  endif /* ! HASSETRLIMIT */
2448 #  ifndef HASGETUSERSHELL
2449 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2450 #  endif /* ! HASGETUSERSHELL */
2451 #  ifndef HASFCHMOD
2452 #   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
2453 #  endif /* ! HASFCHMOD */
2454 
2455 #  ifndef _PATH_UNIX
2456 #   define _PATH_UNIX		"/unix"
2457 #  endif /* ! _PATH_UNIX */
2458 #  ifndef _PATH_VENDOR_CF
2459 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2460 #  endif /* ! _PATH_VENDOR_CF */
2461 #  ifndef _PATH_SENDMAILPID
2462 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2463 #  endif /* ! _PATH_SENDMAILPID */
2464 #  ifndef SYSLOG_BUFSIZE
2465 #   define SYSLOG_BUFSIZE	128
2466 #  endif /* ! SYSLOG_BUFSIZE */
2467 #  ifndef SFS_TYPE
2468 #   define SFS_TYPE		SFS_STATVFS
2469 #  endif /* ! SFS_TYPE */
2470 
2471 #  ifndef USE_SIGLONGJMP
2472 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
2473 #  endif /* ! USE_SIGLONGJMP */
2474 # endif /* __svr4__ */
2475 
2476 # ifdef __SVR4
2477 #  define LDA_USE_LOCKF		1
2478 #  define LDA_USE_SETEUID	1
2479 #  define _PATH_MAILDIR		"/var/mail"
2480 # endif /* __SVR4 */
2481 
2482 /* general System V defines */
2483 # ifdef SYSTEM5
2484 #  include <sys/sysmacros.h>
2485 #  define HASUNAME	1	/* use System V uname(2) system call */
2486 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
2487 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
2488 #  ifndef HASULIMIT
2489 #   define HASULIMIT	1	/* has the ulimit(2) syscall */
2490 #  endif /* ! HASULIMIT */
2491 #  ifndef LA_TYPE
2492 #   ifdef MIOC_READKSYM
2493 #    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2494 #   else /* MIOC_READKSYM */
2495 #    define LA_TYPE	LA_INT		/* assume integer load average */
2496 #   endif /* MIOC_READKSYM */
2497 #  endif /* ! LA_TYPE */
2498 #  ifndef SFS_TYPE
2499 #   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2500 #  endif /* ! SFS_TYPE */
2501 #  ifndef TZ_TYPE
2502 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2503 #  endif /* ! TZ_TYPE */
2504 # endif /* SYSTEM5 */
2505 
2506 /* general POSIX defines */
2507 # ifdef _POSIX_VERSION
2508 #  define HASSETSID	1	/* has POSIX setsid(2) call */
2509 #  define HASWAITPID	1	/* has POSIX waitpid(2) call */
2510 #  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
2511 #   define USESETEUID	1	/* has usable seteuid(2) call */
2512 #  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
2513 # endif /* _POSIX_VERSION */
2514 /*
2515 **  Tweaking for systems that (for example) claim to be BSD or POSIX
2516 **  but don't have all the standard BSD or POSIX routines (boo hiss).
2517 */
2518 
2519 # ifdef titan
2520 #  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
2521 # endif /* titan */
2522 
2523 # ifdef _CRAYCOM
2524 #  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
2525 # endif /* _CRAYCOM */
2526 
2527 # ifdef MOTO
2528 #  undef USESETEUID
2529 # endif /* MOTO */
2530 
2531 /*
2532 **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
2533 **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
2534 **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
2535 **  are closed.  Some firewalls return this error if you try to connect
2536 **  to the IDENT port (113), so you can't receive email from these hosts
2537 **  on these systems.  The firewall really should use a more specific
2538 **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
2539 **  not explicitly set to zero above, default it on.
2540 */
2541 
2542 # ifndef IDENTPROTO
2543 #  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
2544 # endif /* ! IDENTPROTO */
2545 
2546 # ifndef IP_SRCROUTE
2547 #  define IP_SRCROUTE	1	/* Detect IP source routing */
2548 # endif /* ! IP_SRCROUTE */
2549 
2550 # ifndef HASGETUSERSHELL
2551 #  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
2552 # endif /* ! HASGETUSERSHELL */
2553 
2554 # ifndef NETUNIX
2555 #  define NETUNIX	1	/* include unix domain support */
2556 # endif /* ! NETUNIX */
2557 
2558 # ifndef HASRANDOM
2559 #  define HASRANDOM	1	/* has random(3) support */
2560 # endif /* ! HASRANDOM */
2561 
2562 # ifndef HASFLOCK
2563 #  define HASFLOCK	0	/* assume no flock(2) support */
2564 # endif /* ! HASFLOCK */
2565 
2566 # ifndef HASSETREUID
2567 #  define HASSETREUID	0	/* assume no setreuid(2) call */
2568 # endif /* ! HASSETREUID */
2569 
2570 # ifndef HASFCHMOD
2571 #  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
2572 # endif /* ! HASFCHMOD */
2573 
2574 # ifndef USESETEUID
2575 #  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
2576 # endif /* ! USESETEUID */
2577 
2578 # ifndef HASSETRLIMIT
2579 #  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
2580 # endif /* ! HASSETRLIMIT */
2581 
2582 # ifndef HASULIMIT
2583 #  define HASULIMIT	0	/* assume no ulimit(2) support */
2584 # endif /* ! HASULIMIT */
2585 
2586 # ifndef SECUREWARE
2587 #  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
2588 # endif /* ! SECUREWARE */
2589 
2590 # ifndef USE_DOUBLE_FORK
2591 #  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
2592 # endif /* ! USE_DOUBLE_FORK */
2593 
2594 # ifndef USE_ENVIRON
2595 #  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
2596 # endif /* ! USE_ENVIRON */
2597 
2598 # ifndef USE_SIGLONGJMP
2599 #  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
2600 # endif /* ! USE_SIGLONGJMP */
2601 
2602 # ifndef FDSET_CAST
2603 #  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
2604 # endif /* ! FDSET_CAST */
2605 
2606 /*
2607 **  Pick a mailer setuid method for changing the current uid
2608 */
2609 
2610 # define USE_SETEUID	0
2611 # define USE_SETREUID	1
2612 # define USE_SETUID	2
2613 
2614 # if USESETEUID
2615 #  define MAILER_SETUID_METHOD	USE_SETEUID
2616 # else /* USESETEUID */
2617 #  if HASSETREUID
2618 #   define MAILER_SETUID_METHOD	USE_SETREUID
2619 #  else /* HASSETREUID */
2620 #   define MAILER_SETUID_METHOD	USE_SETUID
2621 #  endif /* HASSETREUID */
2622 # endif /* USESETEUID */
2623 
2624 /*
2625 **  If no type for argument two of getgroups call is defined, assume
2626 **  it's an integer -- unfortunately, there seem to be several choices
2627 **  here.
2628 */
2629 
2630 # ifndef GIDSET_T
2631 #  define GIDSET_T	int
2632 # endif /* ! GIDSET_T */
2633 
2634 # ifndef UID_T
2635 #  define UID_T		uid_t
2636 # endif /* ! UID_T */
2637 
2638 # ifndef GID_T
2639 #  define GID_T		gid_t
2640 # endif /* ! GID_T */
2641 
2642 # ifndef MODE_T
2643 #  define MODE_T		mode_t
2644 # endif /* ! MODE_T */
2645 
2646 # ifndef ARGV_T
2647 #  define ARGV_T		char **
2648 # endif /* ! ARGV_T */
2649 
2650 # ifndef SOCKADDR_LEN_T
2651 #  define SOCKADDR_LEN_T	int
2652 # endif /* ! SOCKADDR_LEN_T */
2653 
2654 # ifndef SOCKOPT_LEN_T
2655 #  define SOCKOPT_LEN_T	int
2656 # endif /* ! SOCKOPT_LEN_T */
2657 
2658 # ifndef QUAD_T
2659 #  define QUAD_T	unsigned long
2660 # endif /* ! QUAD_T */
2661 /**********************************************************************
2662 **  Remaining definitions should never have to be changed.  They are
2663 **  primarily to provide back compatibility for older systems -- for
2664 **  example, it includes some POSIX compatibility definitions
2665 **********************************************************************/
2666 
2667 /* System 5 compatibility */
2668 # ifndef S_ISREG
2669 #  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
2670 # endif /* ! S_ISREG */
2671 # ifndef S_ISDIR
2672 #  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
2673 # endif /* ! S_ISDIR */
2674 # if !defined(S_ISLNK) && defined(S_IFLNK)
2675 #  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
2676 # endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
2677 # if !defined(S_ISFIFO)
2678 #  if defined(S_IFIFO)
2679 #   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
2680 #  else /* defined(S_IFIFO) */
2681 #   define S_ISFIFO(foo)	false
2682 #  endif /* defined(S_IFIFO) */
2683 # endif /* !defined(S_ISFIFO) */
2684 # ifndef S_IRUSR
2685 #  define S_IRUSR		0400
2686 # endif /* ! S_IRUSR */
2687 # ifndef S_IWUSR
2688 #  define S_IWUSR		0200
2689 # endif /* ! S_IWUSR */
2690 # ifndef S_IRGRP
2691 #  define S_IRGRP		0040
2692 # endif /* ! S_IRGRP */
2693 # ifndef S_IWGRP
2694 #  define S_IWGRP		0020
2695 # endif /* ! S_IWGRP */
2696 # ifndef S_IROTH
2697 #  define S_IROTH		0004
2698 # endif /* ! S_IROTH */
2699 # ifndef S_IWOTH
2700 #  define S_IWOTH		0002
2701 # endif /* ! S_IWOTH */
2702 
2703 /* close-on-exec flag */
2704 # ifndef FD_CLOEXEC
2705 #  define FD_CLOEXEC	1
2706 # endif /* ! FD_CLOEXEC */
2707 
2708 /*
2709 **  Older systems don't have this error code -- it should be in
2710 **  /usr/include/sysexits.h.
2711 */
2712 
2713 # ifndef EX_CONFIG
2714 #  define EX_CONFIG	78	/* configuration error */
2715 # endif /* ! EX_CONFIG */
2716 
2717 /* pseudo-codes */
2718 # define EX_QUIT	22	/* drop out of server immediately */
2719 # define EX_RESTART	23	/* restart sendmail daemon */
2720 # define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
2721 
2722 #ifndef EX_NOTFOUND
2723 # define EX_NOTFOUND	EX_NOHOST
2724 #endif /* ! EX_NOTFOUND */
2725 
2726 /* pseudo-code used for mci_setstat */
2727 # define EX_NOTSTICKY	(-5)	/* don't save persistent status */
2728 
2729 
2730 /*
2731 **  An "impossible" file mode to indicate that the file does not exist.
2732 */
2733 
2734 # define ST_MODE_NOFILE	0171147		/* unlikely to occur */
2735 
2736 
2737 /* type of arbitrary pointer */
2738 # ifndef ARBPTR_T
2739 #  define ARBPTR_T	void *
2740 # endif /* ! ARBPTR_T */
2741 
2742 # ifndef __P
2743 #  include "sm/cdefs.h"
2744 # endif /* ! __P */
2745 
2746 # if HESIOD && !defined(NAMED_BIND)
2747 #  define NAMED_BIND	1	/* not one without the other */
2748 # endif /* HESIOD && !defined(NAMED_BIND) */
2749 
2750 #  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
2751 extern int	h_errno;
2752 #  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
2753 
2754 # if NEEDPUTENV
2755 extern int	putenv __P((char *));
2756 # endif /* NEEDPUTENV */
2757 
2758 #if !HASUNSETENV
2759 extern void	unsetenv __P((char *));
2760 #endif /* !HASUNSETENV */
2761 
2762 # ifdef LDAPMAP
2763 #  include <sys/time.h>
2764 #  include <lber.h>
2765 #  include <ldap.h>
2766 
2767 /* Some LDAP constants */
2768 #  define LDAPMAP_FALSE		0
2769 #  define LDAPMAP_TRUE		1
2770 
2771 /*
2772 **  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
2773 **  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
2774 **  and assume (falsely) that all old API implementations are broken.
2775 **  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
2776 */
2777 
2778 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
2779 #   define USE_LDAP_INIT	1
2780 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
2781 
2782 /*
2783 **  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
2784 **  hence ldap_set_option() must not exist.
2785 */
2786 
2787 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
2788 #   define USE_LDAP_SET_OPTION	1
2789 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
2790 
2791 # endif /* LDAPMAP */
2792 
2793 # if HASUNAME
2794 #  include <sys/utsname.h>
2795 #  ifdef newstr
2796 #   undef newstr
2797 #  endif /* newstr */
2798 # else /* HASUNAME */
2799 #  define NODE_LENGTH 32
2800 struct utsname
2801 {
2802 	char nodename[NODE_LENGTH + 1];
2803 };
2804 # endif /* HASUNAME */
2805 
2806 # if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
2807 #  define MAXHOSTNAMELEN	256
2808 # endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
2809 
2810 # if !defined(SIGCHLD) && defined(SIGCLD)
2811 #  define SIGCHLD	SIGCLD
2812 # endif /* !defined(SIGCHLD) && defined(SIGCLD) */
2813 
2814 # ifndef STDIN_FILENO
2815 #  define STDIN_FILENO	0
2816 # endif /* ! STDIN_FILENO */
2817 
2818 # ifndef STDOUT_FILENO
2819 #  define STDOUT_FILENO	1
2820 # endif /* ! STDOUT_FILENO */
2821 
2822 # ifndef STDERR_FILENO
2823 #  define STDERR_FILENO	2
2824 # endif /* ! STDERR_FILENO */
2825 
2826 # ifndef LOCK_SH
2827 #  define LOCK_SH	0x01	/* shared lock */
2828 #  define LOCK_EX	0x02	/* exclusive lock */
2829 #  define LOCK_NB	0x04	/* non-blocking lock */
2830 #  define LOCK_UN	0x08	/* unlock */
2831 # endif /* ! LOCK_SH */
2832 
2833 # ifndef S_IXOTH
2834 #  define S_IXOTH	(S_IEXEC >> 6)
2835 # endif /* ! S_IXOTH */
2836 
2837 # ifndef S_IXGRP
2838 #  define S_IXGRP	(S_IEXEC >> 3)
2839 # endif /* ! S_IXGRP */
2840 
2841 # ifndef S_IXUSR
2842 #  define S_IXUSR	(S_IEXEC)
2843 # endif /* ! S_IXUSR */
2844 
2845 #ifndef O_ACCMODE
2846 # define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
2847 #endif /* ! O_ACCMODE */
2848 
2849 # ifndef SEEK_SET
2850 #  define SEEK_SET	0
2851 #  define SEEK_CUR	1
2852 #  define SEEK_END	2
2853 # endif /* ! SEEK_SET */
2854 
2855 # ifndef SIG_ERR
2856 #  define SIG_ERR	((void (*)()) -1)
2857 # endif /* ! SIG_ERR */
2858 
2859 # ifndef WEXITSTATUS
2860 #  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
2861 # endif /* ! WEXITSTATUS */
2862 # ifndef WIFEXITED
2863 #  define WIFEXITED(st)		(((st) & 0377) == 0)
2864 # endif /* ! WIFEXITED */
2865 # ifndef WIFSTOPPED
2866 #  define WIFSTOPPED(st)		(((st) & 0100) == 0)
2867 # endif /* ! WIFSTOPPED */
2868 # ifndef WCOREDUMP
2869 #  define WCOREDUMP(st)		(((st) & 0200) != 0)
2870 # endif /* ! WCOREDUMP */
2871 # ifndef WTERMSIG
2872 #  define WTERMSIG(st)		(((st) & 0177))
2873 # endif /* ! WTERMSIG */
2874 
2875 # ifndef SIGFUNC_DEFINED
2876 typedef void		(*sigfunc_t) __P((int));
2877 # endif /* ! SIGFUNC_DEFINED */
2878 # ifndef SIGFUNC_RETURN
2879 #  define SIGFUNC_RETURN
2880 # endif /* ! SIGFUNC_RETURN */
2881 # ifndef SIGFUNC_DECL
2882 #  define SIGFUNC_DECL	void
2883 # endif /* ! SIGFUNC_DECL */
2884 
2885 /* size of syslog buffer */
2886 # ifndef SYSLOG_BUFSIZE
2887 #  define SYSLOG_BUFSIZE	1024
2888 # endif /* ! SYSLOG_BUFSIZE */
2889 
2890 /* for FD_SET() */
2891 #ifndef FD_SETSIZE
2892 # define FD_SETSIZE	256
2893 #endif /* ! FD_SETSIZE */
2894 
2895 /*
2896 **  Size of prescan buffer.
2897 **	Despite comments in the _sendmail_ book, this probably should
2898 **	not be changed; there are some hard-to-define dependencies.
2899 */
2900 
2901 # define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
2902 
2903 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
2904 # ifndef FORK
2905 #  define FORK		fork		/* function to call to fork mailer */
2906 # endif /* ! FORK */
2907 
2908 /* setting h_errno */
2909 # ifndef SM_SET_H_ERRNO
2910 #  define SM_SET_H_ERRNO(err)	h_errno = (err)
2911 # endif /* SM_SET_H_ERRNO */
2912 
2913 # ifndef SM_CONF_GETOPT
2914 #  define SM_CONF_GETOPT	1
2915 # endif /* ! SM_CONF_GETOPT */
2916 
2917 /* random routine -- set above using #ifdef _osname_ or in Makefile */
2918 # if HASRANDOM
2919 #  define get_random()	random()
2920 # else /* HASRANDOM */
2921 #  define get_random()	((long) rand())
2922 #  ifndef RANDOMSHIFT
2923 #   define RANDOMSHIFT	8
2924 #  endif /* ! RANDOMSHIFT */
2925 # endif /* HASRANDOM */
2926 
2927 /*
2928 **  Default to using scanf in readcf.
2929 */
2930 
2931 # ifndef SCANF
2932 #  define SCANF		1
2933 # endif /* ! SCANF */
2934 
2935 /* XXX  32 bit type */
2936 # ifndef SM_INT32
2937 #  define SM_INT32	int32_t
2938 # endif /* ! SM_INT32 */
2939 
2940 /*
2941 **  SVr4 and similar systems use different routines for setjmp/longjmp
2942 **  with signal support
2943 */
2944 
2945 # if USE_SIGLONGJMP
2946 #  ifdef jmp_buf
2947 #   undef jmp_buf
2948 #  endif /* jmp_buf */
2949 #  define jmp_buf		sigjmp_buf
2950 #  ifdef setjmp
2951 #   undef setjmp
2952 #  endif /* setjmp */
2953 #  define setjmp(env)		sigsetjmp(env, 1)
2954 #  ifdef longjmp
2955 #   undef longjmp
2956 #  endif /* longjmp */
2957 #  define longjmp(env, val)	siglongjmp(env, val)
2958 # endif /* USE_SIGLONGJMP */
2959 
2960 # if !defined(NGROUPS_MAX) && defined(NGROUPS)
2961 #  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
2962 # endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
2963 
2964 /*
2965 **  Some snprintf() implementations are rumored not to NUL terminate.
2966 */
2967 # if SNPRINTF_IS_BROKEN
2968 #  ifdef snprintf
2969 #   undef snprintf
2970 #  endif /* snprintf */
2971 #  define snprintf	sm_snprintf
2972 #  ifdef vsnprintf
2973 #   undef vsnprintf
2974 #  endif /* vsnprintf */
2975 #  define vsnprintf	sm_vsnprintf
2976 # endif /* SNPRINTF_IS_BROKEN */
2977 
2978 /*
2979 **  If we don't have a system syslog, simulate it.
2980 */
2981 
2982 # if !LOG
2983 #  define LOG_EMERG	0	/* system is unusable */
2984 #  define LOG_ALERT	1	/* action must be taken immediately */
2985 #  define LOG_CRIT	2	/* critical conditions */
2986 #  define LOG_ERR	3	/* error conditions */
2987 #  define LOG_WARNING	4	/* warning conditions */
2988 #  define LOG_NOTICE	5	/* normal but significant condition */
2989 #  define LOG_INFO	6	/* informational */
2990 #  define LOG_DEBUG	7	/* debug-level messages */
2991 # endif /* !LOG */
2992 
2993 # ifndef SM_CONF_SYSLOG
2994 #  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
2995 # endif /* SM_CONF_SYSLOG */
2996 
2997 # if !SM_CONF_SYSLOG
2998 #   ifdef __STDC__
2999 extern void	syslog(int, const char *, ...);
3000 #   else /* __STDC__ */
3001 extern void	syslog();
3002 #   endif /* __STDC__ */
3003 # endif /* !SM_CONF_SYSLOG */
3004 
3005 /* portable(?) definition for alignment */
3006 # ifndef SM_ALIGN_SIZE
3007 struct sm_align
3008 {
3009 	char al_c;
3010 	union
3011 	{
3012 		long	al_l;
3013 		void	*al_p;
3014 		double	al_d;
3015 		void	(*al_f) __P((void));
3016 	} al_u;
3017 };
3018 #  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
3019 # endif /* ! SM_ALIGN_SIZE */
3020 # define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
3021 
3022 #endif /* ! SM_CONF_H */
3023