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