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