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