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