1 /*        $NetBSD: sys_defs.h,v 1.15 2025/02/25 19:15:52 christos Exp $         */
2 
3 #ifndef _SYS_DEFS_H_INCLUDED_
4 #define _SYS_DEFS_H_INCLUDED_
5 
6 /*++
7 /* NAME
8 /*        sys_defs 3h
9 /* SUMMARY
10 /*        portability header
11 /* SYNOPSIS
12 /*        #include <sys_defs.h>
13 /* DESCRIPTION
14 /* .nf
15 
16  /*
17   * Specific platforms. Major release numbers differ for a good reason. So be
18   * a good girl, plan for the future, and at least include the major release
19   * number in the system type (for example, SUNOS5 or FREEBSD2). The system
20   * type is determined by the makedefs shell script in the top-level
21   * directory. Adding support for a new system type means updating the
22   * makedefs script, and adding a section below for the new system.
23   */
24 #ifdef SUNOS5
25 #define _SVID_GETTOD                              /* Solaris 2.5, XSH4.2 versus SVID */
26 #endif
27 #include <sys/types.h>
28 
29  /*
30   * 4.4BSD and close derivatives.
31   */
32 #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
33     || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \
34     || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \
35     || defined(FREEBSD11) || defined(FREEBSD12) || defined(FREEBSD13) \
36     || defined(FREEBSD14) \
37     || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
38     || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
39     || defined(OPENBSD5) || defined(OPENBSD6) || defined(OPENBSD7) \
40     || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
41     || defined(NETBSD4) || defined(NETBSD5) || defined(NETBSD6) \
42     || defined(NETBSD7) | defined(NETBSD8) || defined(NETBSD9) \
43     || defined(NETBSD10) \
44     || defined(EKKOBSD1) || defined(DRAGONFLY)
45 #define SUPPORTED
46 #include <sys/param.h>
47 #define UINT32_TYPE unsigned int
48 #define UINT16_TYPE unsigned short
49 #define USE_PATHS_H
50 #define HAS_FLOCK_LOCK
51 #define HAS_FCNTL_LOCK
52 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
53 #define DEF_MAILBOX_LOCK "flock, dotlock"
54 #define HAS_SUN_LEN
55 #define HAS_FSYNC
56 #define HAS_DB
57 #define HAS_SA_LEN
58 #define NATIVE_DB_TYPE        "hash"
59 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000)
60 #define ALIAS_DB_MAP   DEF_DB_TYPE ":/etc/mail/aliases"     /* sendmail 8.10 */
61 #endif
62 #if (defined(OpenBSD) && OpenBSD >= 200006)
63 #define ALIAS_DB_MAP   DEF_DB_TYPE ":/etc/mail/aliases"     /* OpenBSD 2.7 */
64 #endif
65 #ifndef ALIAS_DB_MAP
66 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
67 #endif
68 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
69 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin"
70 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ > 299000900)
71 #define USE_STATVFS
72 #define STATVFS_IN_SYS_STATVFS_H
73 #else
74 #define USE_STATFS
75 #define STATFS_IN_SYS_MOUNT_H
76 #endif
77 #define HAS_POSIX_REGEXP
78 #define HAS_ST_GEN                      /* struct stat contains inode
79                                                    * generation number */
80 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
81 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
82 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
83 #define NATIVE_COMMAND_DIR "/usr/sbin"
84 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
85 #define HAS_DLOPEN
86 #endif
87 
88 #ifdef FREEBSD2
89 #define getsid(p) getpgrp()
90 #ifndef CMSG_SPACE
91 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
92 #endif
93 #ifndef CMSG_LEN
94 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
95 #endif
96 #ifndef CMSG_ALIGN
97 #define CMSG_ALIGN(n) ALIGN(n)
98 #endif
99 #endif                                            /* FREEBSD2 */
100 
101 #ifdef BSDI4
102 /* #define HAS_IPV6 find out interface lookup method */
103 #endif
104 
105 /* __FreeBSD_version version is major+minor */
106 
107 #if __FreeBSD_version >= 220000
108 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"  /* introduced 2.1.5 */
109 #endif
110 
111 #if __FreeBSD_version >= 300000
112 #define HAS_ISSETUGID
113 #define HAS_FUTIMES
114 #endif
115 
116 #if __FreeBSD_version >= 400000
117 #define SOCKADDR_SIZE         socklen_t
118 #define SOCKOPT_SIZE          socklen_t
119 #endif
120 
121 #if __FreeBSD_version >= 420000
122 #define HAS_DUPLEX_PIPE                           /* 4.1 breaks with kqueue(2) */
123 #endif
124 
125 #if (__FreeBSD_version >= 702104 && __FreeBSD_version <= 800000) \
126     || __FreeBSD_version >= 800100
127 #define HAS_CLOSEFROM
128 #endif
129 
130 /* OpenBSD version is year+month */
131 
132 #if OpenBSD >= 199805                             /* XXX */
133 #define HAS_FUTIMES                     /* XXX maybe earlier */
134 #endif
135 
136 #if (defined(OpenBSD) && OpenBSD >= 199608 && OpenBSD < 201105)
137 #define PREFERRED_RAND_SOURCE "dev:/dev/arandom"  /* XXX earlier */
138 #endif
139 
140 #if OpenBSD >= 200000                             /* XXX */
141 #define HAS_ISSETUGID
142 #endif
143 
144 #if OpenBSD >= 200200                             /* XXX */
145 #define SOCKADDR_SIZE         socklen_t
146 #define SOCKOPT_SIZE          socklen_t
147 #endif
148 
149 #if OpenBSD >= 200405                             /* 3.5 */
150 #define HAS_CLOSEFROM
151 #endif
152 
153 /* __NetBSD_Version__ is major+minor */
154 
155 #if __NetBSD_Version__ >= 103000000     /* XXX maybe earlier */
156 #undef DEF_MAILBOX_LOCK
157 #define DEF_MAILBOX_LOCK "flock, dotlock"
158 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"  /* XXX maybe earlier */
159 #endif
160 
161 #if __NetBSD_Version__ >= 105000000
162 #define HAS_ISSETUGID                             /* XXX maybe earlier */
163 #endif
164 
165 #if __NetBSD_Version__ >= 106000000     /* XXX maybe earlier */
166 #define SOCKADDR_SIZE         socklen_t
167 #define SOCKOPT_SIZE          socklen_t
168 #endif
169 
170 #if __NetBSD_Version__ >= 299000900     /* 2.99.9 */
171 #define HAS_CLOSEFROM
172 #endif
173 
174 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 102000000)
175 #define HAS_FUTIMES
176 #endif
177 
178 #if defined(__DragonFly__)
179 #define HAS_DEV_URANDOM
180 #define HAS_ISSETUGID
181 #define HAS_FUTIMES
182 #define SOCKADDR_SIZE         socklen_t
183 #define SOCKOPT_SIZE          socklen_t
184 #define HAS_DUPLEX_PIPE
185 #endif
186 
187 #if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \
188     || (defined(__FreeBSD__) && __FreeBSD__ >= 4) \
189     || (defined(OpenBSD) && OpenBSD >= 200003) \
190     || defined(__DragonFly__) \
191     || defined(USAGI_LIBINET6)
192 #ifndef NO_IPV6
193 #define HAS_IPV6
194 #endif
195 #if !defined(NO_IPV6) || defined(__NetBSD__)
196 #define HAVE_GETIFADDRS
197 #endif
198 #endif
199 
200 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \
201     || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \
202     || (defined(OpenBSD) && OpenBSD >= 199700)    /* OpenBSD 2.0?? */ \
203     || defined(__DragonFly__)
204 #define USE_SYSV_POLL
205 #endif
206 
207 #ifndef NO_KQUEUE
208 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \
209     || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \
210     || (defined(OpenBSD) && OpenBSD >= 200105)    /* OpenBSD 2.9 */ \
211     || defined(__DragonFly__)
212 #define EVENTS_STYLE          EVENTS_STYLE_KQUEUE
213 #endif
214 #endif
215 
216 #ifndef NO_POSIX_GETPW_R
217 #if (defined(__FreeBSD_version) && __FreeBSD_version >= 510000) \
218     || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 300000000) \
219     || (defined(OpenBSD) && OpenBSD >= 200811)    /* OpenBSD 4.4 */
220 #define HAVE_POSIX_GETPW_R
221 #endif
222 #endif
223 
224  /*
225   * UNIX on MAC.
226   */
227 #if defined(RHAPSODY5) || defined(MACOSX)
228 #define SUPPORTED
229 #define UINT32_TYPE unsigned int
230 #define UINT16_TYPE unsigned short
231 #define USE_PATHS_H
232 #define HAS_FLOCK_LOCK
233 #define HAS_FCNTL_LOCK
234 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
235 #define DEF_MAILBOX_LOCK "flock, dotlock"
236 #define HAS_SUN_LEN
237 #define HAS_FSYNC
238 #define HAS_DB
239 #define HAS_SA_LEN
240 #define NATIVE_DB_TYPE        "hash"
241 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
242 #define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0)
243 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin"
244 #define USE_STATFS
245 #define STATFS_IN_SYS_MOUNT_H
246 #define HAS_POSIX_REGEXP
247 #ifndef NO_NETINFO
248 #define HAS_NETINFO
249 #endif
250 #ifndef NO_IPV6
251 #define HAS_IPV6
252 #define HAVE_GETIFADDRS
253 #endif
254 #define HAS_FUTIMES                     /* XXX Guessing */
255 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
256 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
257 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
258 #define NATIVE_COMMAND_DIR "/usr/sbin"
259 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
260 #define SOCKADDR_SIZE         socklen_t
261 #define SOCKOPT_SIZE          socklen_t
262 #ifndef NO_KQUEUE
263 #define EVENTS_STYLE          EVENTS_STYLE_KQUEUE
264 #define USE_SYSV_POLL_THEN_SELECT
265 #endif
266 #define USE_MAX_FILES_PER_PROC
267 #ifndef NO_POSIX_GETPW_R
268 #define HAVE_POSIX_GETPW_R
269 #endif
270 #define HAS_DLOPEN
271 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"
272 #endif
273 
274  /*
275   * Ultrix 4.x, a sort of 4.[1-2] BSD system with System V.2 compatibility
276   * and POSIX.
277   */
278 #ifdef ULTRIX4
279 #define SUPPORTED
280 #define UINT32_TYPE unsigned int
281 #define UINT16_TYPE unsigned short
282 /* Ultrix by default has only 64 descriptors per process */
283 #ifndef FD_SETSIZE
284 #define FD_SETSIZE  96
285 #endif
286 #define _PATH_MAILDIR         "/var/spool/mail"
287 #define _PATH_BSHELL          "/bin/sh"
288 #define _PATH_DEFPATH         "/bin:/usr/bin:/usr/ucb"
289 #define _PATH_STDPATH         "/bin:/usr/bin:/usr/etc:/usr/ucb"
290 #define HAS_FLOCK_LOCK
291 #define HAS_FCNTL_LOCK
292 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
293 #define DEF_MAILBOX_LOCK "flock, dotlock"
294 #define HAS_FSYNC
295 /* might be set by makedef */
296 #ifdef HAS_DB
297 #define NATIVE_DB_TYPE        "hash"
298 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
299 #else
300 #define HAS_DBM
301 #define   NATIVE_DB_TYPE      "dbm"
302 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
303 #endif
304 extern int optind;
305 extern char *optarg;
306 extern int opterr;
307 extern int h_errno;
308 
309 #define MISSING_STRFTIME_E
310 #ifndef NO_NIS
311 #define HAS_NIS
312 #endif
313 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
314 #define ROOT_PATH   "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
315 #define USE_STATFS
316 #define USE_STRUCT_FS_DATA
317 #define STATFS_IN_SYS_MOUNT_H
318 /* Ultrix misses just S_ISSOCK, the others are there */
319 #define S_ISSOCK(mode)        (((mode) & (S_IFMT)) == (S_IFSOCK))
320 #define DUP2_DUPS_CLOSE_ON_EXEC
321 #define MISSING_USLEEP
322 #define NO_HERRNO
323 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
324 #define NATIVE_COMMAND_DIR "/usr/etc"
325 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
326 #endif
327 
328  /*
329   * OSF, then Digital UNIX, then Compaq. A BSD-flavored hybrid.
330   */
331 #ifdef OSF1
332 #define SUPPORTED
333 #define UINT32_TYPE unsigned int
334 #define UINT16_TYPE unsigned short
335 #define MISSING_SETENV
336 #define USE_PATHS_H
337 #define _PATH_DEFPATH "/usr/bin:/usr/ucb"
338 #define HAS_FLOCK_LOCK
339 #define HAS_FCNTL_LOCK
340 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
341 #define DEF_MAILBOX_LOCK "flock, dotlock"
342 #define HAS_FSYNC
343 #define HAVE_BASENAME
344 #define HAS_DBM
345 #define NATIVE_DB_TYPE        "dbm"
346 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/var/adm/sendmail/aliases"
347 extern int optind;                      /* XXX use <getopt.h> */
348 extern char *optarg;                              /* XXX use <getopt.h> */
349 extern int opterr;                      /* XXX use <getopt.h> */
350 
351 #ifndef NO_NIS
352 #define HAS_NIS
353 #endif
354 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
355 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
356 #define USE_STATFS
357 #define STATFS_IN_SYS_MOUNT_H
358 #define HAS_POSIX_REGEXP
359 #define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
360 #define NO_MSGHDR_MSG_CONTROL
361 #ifndef NO_IPV6
362 #define HAS_IPV6
363 #endif
364 
365 #endif
366 
367  /*
368   * SunOS 4.x, a mostly 4.[2-3] BSD system with System V.2 compatibility and
369   * POSIX support.
370   */
371 #ifdef SUNOS4
372 #define SUPPORTED
373 #include <memory.h>
374 #define UINT32_TYPE unsigned int
375 #define UINT16_TYPE unsigned short
376 #define UNSAFE_CTYPE
377 #define fpos_t      long
378 #define MISSING_SETENV
379 #define MISSING_STRERROR
380 #define MISSING_STRTOUL
381 #define _PATH_MAILDIR         "/var/spool/mail"
382 #define _PATH_BSHELL          "/bin/sh"
383 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
384 #define _PATH_STDPATH         "/usr/bin:/usr/etc:/usr/ucb"
385 #define HAS_FLOCK_LOCK
386 #define HAS_FCNTL_LOCK
387 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
388 #define DEF_MAILBOX_LOCK "flock, dotlock"
389 #define HAS_FSYNC
390 #define HAS_DBM
391 #define NATIVE_DB_TYPE        "dbm"
392 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
393 extern int optind;
394 extern char *optarg;
395 extern int opterr;
396 
397 #ifndef NO_NIS
398 #define HAS_NIS
399 #endif
400 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
401 #define ROOT_PATH   "/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
402 #define USE_STATFS
403 #define STATFS_IN_SYS_VFS_H
404 #define memmove(d,s,l)        bcopy(s,d,l)
405 #define NO_HERRNO
406 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
407 #define NATIVE_MAILQ_PATH "/usr/ucb/mailq"
408 #define NATIVE_NEWALIAS_PATH "/usr/ucb/newaliases"
409 #define NATIVE_COMMAND_DIR "/usr/etc"
410 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
411 #define STRCASECMP_IN_STRINGS_H
412 #define OCTAL_TO_UNSIGNED(res, str) sscanf((str), "%o", &(res))
413 #define size_t      unsigned
414 #define ssize_t     int
415 #define getsid      getpgrp
416 #define NO_SNPRINTF
417 #endif
418 
419  /*
420   * SunOS 5.x, mostly System V Release 4.
421   */
422 #ifdef SUNOS5
423 #define SUPPORTED
424 #define UINT32_TYPE unsigned int
425 #define UINT16_TYPE unsigned short
426 #define _PATH_MAILDIR         "/var/mail"
427 #define _PATH_BSHELL          "/bin/sh"
428 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
429 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
430 #define HAS_FCNTL_LOCK
431 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
432 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
433 #define HAS_FSYNC
434 #define HAS_DBM
435 #define NATIVE_DB_TYPE        "dbm"
436 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/mail/aliases"
437 #ifndef NO_NIS
438 #define HAS_NIS
439 #ifndef NO_NISPLUS
440 #define HAS_NISPLUS
441 #endif                                            /* NO_NISPLUS */
442 #endif
443 #define USE_SYS_SOCKIO_H                /* Solaris 2.5, changed sys/ioctl.h */
444 #define GETTIMEOFDAY(t)       gettimeofday(t)
445 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
446 #define FIONREAD_IN_SYS_FILIO_H
447 #define USE_STATVFS
448 #define STATVFS_IN_SYS_STATVFS_H
449 #define INT_MAX_IN_LIMITS_H
450 #ifdef STREAM_CONNECTIONS               /* avoid UNIX-domain sockets */
451 #define LOCAL_LISTEN          stream_listen
452 #define LOCAL_ACCEPT          stream_accept
453 #define LOCAL_CONNECT         stream_connect
454 #define LOCAL_TRIGGER         stream_trigger
455 #define LOCAL_SEND_FD         stream_send_fd
456 #define LOCAL_RECV_FD         stream_recv_fd
457 #endif
458 #define HAS_VOLATILE_LOCKS
459 #define BROKEN_READ_SELECT_ON_TCP_SOCKET
460 #define CANT_WRITE_BEFORE_SENDING_FD
461 #ifndef NO_POSIX_REGEXP
462 #define HAS_POSIX_REGEXP
463 #endif
464 #ifndef NO_IPV6
465 #define HAS_IPV6
466 #define HAS_SIOCGLIF
467 #endif
468 #ifndef NO_CLOSEFROM
469 #define HAS_CLOSEFROM
470 #endif
471 #ifndef NO_DEV_URANDOM
472 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"
473 #endif
474 #ifndef NO_FUTIMESAT
475 #define HAS_FUTIMESAT
476 #endif
477 #define USE_SYSV_POLL
478 #ifndef NO_DEVPOLL
479 #define EVENTS_STYLE          EVENTS_STYLE_DEVPOLL
480 #endif
481 #ifndef NO_POSIX_GETPW_R
482 #define HAVE_POSIX_GETPW_R
483 #define GETPW_R_NEEDS_POSIX_PTHREAD_SEMANTICS
484 #endif
485 
486 /*
487  * Allow build environment to override paths.
488  */
489 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
490 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
491 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
492 #define NATIVE_COMMAND_DIR "/usr/sbin"
493 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
494 
495 #define HAS_DLOPEN
496 #endif
497 
498  /*
499   * UnixWare, System Release 4.
500   */
501 #ifdef UW7                                        /* UnixWare 7 */
502 #define SUPPORTED
503 #define UINT32_TYPE unsigned int
504 #define UINT16_TYPE unsigned short
505 #define _PATH_MAILDIR         "/var/mail"
506 #define _PATH_BSHELL          "/bin/sh"
507 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
508 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
509 #define MISSING_SETENV
510 #define HAS_FCNTL_LOCK
511 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
512 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
513 #define HAS_FSYNC
514 #define HAS_DBM
515 #define NATIVE_DB_TYPE        "dbm"
516 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/mail/aliases"
517 #ifndef NO_NIS
518 #define HAS_NIS
519 #endif
520 #define USE_SYS_SOCKIO_H
521 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
522 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
523 #define FIONREAD_IN_SYS_FILIO_H
524 #define DBM_NO_TRAILING_NULL
525 #define USE_STATVFS
526 #define STATVFS_IN_SYS_STATVFS_H
527 #define STRCASECMP_IN_STRINGS_H
528 #define USE_SET_H_ERRNO
529 #endif
530 
531 #ifdef UW21                                       /* UnixWare 2.1.x */
532 #define SUPPORTED
533 #define UINT32_TYPE unsigned int
534 #define UINT16_TYPE unsigned short
535 #define _PATH_MAILDIR   "/var/mail"
536 #define _PATH_BSHELL    "/bin/sh"
537 #define _PATH_DEFPATH   "/usr/bin:/usr/ucb"
538 #define _PATH_STDPATH   "/usr/bin:/usr/sbin:/usr/ucb"
539 #define MISSING_SETENV
540 #define HAS_FCNTL_LOCK
541 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
542 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
543 #define HAS_FSYNC
544 #define HAS_DBM
545 #define NATIVE_DB_TYPE     "dbm"
546 #define ALIAS_DB_MAP    DEF_DB_TYPE ":/etc/mail/aliases"
547 #ifndef NO_NIS
548 #define HAS_NIS */
549 #endif
550 #define USE_SYS_SOCKIO_H
551 #define GETTIMEOFDAY(t) gettimeofday(t,NULL)
552 #define ROOT_PATH       "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
553 #define FIONREAD_IN_SYS_FILIO_H
554 #define DBM_NO_TRAILING_NULL
555 #define USE_STATVFS
556 #define STATVFS_IN_SYS_STATVFS_H
557 #endif
558 
559  /*
560   * AIX: a SYSV-flavored hybrid. NB: fcntl() and flock() access the same
561   * underlying locking primitives.
562   */
563 #if defined(AIX5) || defined(AIX6)
564 #define SUPPORTED
565 #define UINT32_TYPE unsigned int
566 #define UINT16_TYPE unsigned short
567 #define MISSING_SETENV
568 #define USE_PATHS_H
569 #ifndef _PATH_BSHELL
570 #define _PATH_BSHELL          "/bin/sh"
571 #endif
572 #ifndef _PATH_MAILDIR
573 #define _PATH_MAILDIR   "/var/spool/mail"         /* paths.h lies */
574 #endif
575 #ifndef _PATH_DEFPATH
576 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
577 #endif
578 #ifndef _PATH_STDPATH
579 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
580 #endif
581 #define HAS_FCNTL_LOCK
582 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
583 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
584 #define USE_SYS_SELECT_H
585 #define HAS_FSYNC
586 #define HAS_DBM
587 #define NATIVE_DB_TYPE        "dbm"
588 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
589 #ifndef NO_NIS
590 #define HAS_NIS
591 #endif
592 #define HAS_SA_LEN
593 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
594 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
595 #define SOCKADDR_SIZE         socklen_t
596 #define SOCKOPT_SIZE          socklen_t
597 #define USE_STATVFS
598 #define STATVFS_IN_SYS_STATVFS_H
599 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
600 #define NATIVE_MAILQ_PATH "/usr/sbin/mailq"
601 #define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases"
602 #define NATIVE_COMMAND_DIR "/usr/sbin"
603 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
604 
605  /*
606   * XXX Need CMSG_SPACE() and CMSG_LEN() but don't want to drag in everything
607   * that comes with _LINUX_SOURCE_COMPAT.
608   */
609 #include <sys/socket.h>
610 #ifndef CMSG_SPACE
611 #define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
612 #endif
613 #ifndef CMSG_LEN
614 #define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
615 #endif
616 #ifndef NO_IPV6
617 #define HAS_IPV6
618 #endif
619 #define BROKEN_AI_PASSIVE_NULL_HOST
620 #define BROKEN_AI_NULL_SERVICE
621 #define USE_SYSV_POLL
622 #define MYMALLOC_FUZZ         1
623 #endif
624 
625 #ifdef AIX4
626 #define SUPPORTED
627 #define UINT32_TYPE unsigned int
628 #define UINT16_TYPE unsigned short
629 #define MISSING_SETENV
630 #define _PATH_BSHELL          "/bin/sh"
631 #define _PATH_MAILDIR   "/var/spool/mail"         /* paths.h lies */
632 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
633 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
634 #define HAS_FCNTL_LOCK
635 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
636 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
637 #define USE_SYS_SELECT_H
638 #define HAS_FSYNC
639 #define HAS_DBM
640 #define NATIVE_DB_TYPE        "dbm"
641 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
642 #ifndef NO_NIS
643 #define HAS_NIS
644 #endif
645 #define HAS_SA_LEN
646 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
647 #define RESOLVE_H_NEEDS_STDIO_H
648 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
649 #define SOCKADDR_SIZE         size_t
650 #define SOCKOPT_SIZE          size_t
651 #define USE_STATVFS
652 #define STATVFS_IN_SYS_STATVFS_H
653 #define STRCASECMP_IN_STRINGS_H
654 #if 0
655 extern time_t time(time_t *);
656 extern int seteuid(uid_t);
657 extern int setegid(gid_t);
658 extern int initgroups(const char *, int);
659 
660 #endif
661 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
662 #define NATIVE_MAILQ_PATH "/usr/sbin/mailq"
663 #define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases"
664 #define NATIVE_COMMAND_DIR "/usr/sbin"
665 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
666 
667 #define CANT_USE_SEND_RECV_MSG
668 #endif
669 
670 #ifdef AIX3
671 #define SUPPORTED
672 #define UINT32_TYPE unsigned int
673 #define UINT16_TYPE unsigned short
674 #define MISSING_SETENV
675 #define _PATH_BSHELL          "/bin/sh"
676 #define _PATH_MAILDIR   "/var/spool/mail"         /* paths.h lies */
677 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
678 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
679 #define HAS_FCNTL_LOCK
680 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
681 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
682 #define USE_SYS_SELECT_H
683 #define HAS_FSYNC
684 #define HAS_DBM
685 #define NATIVE_DB_TYPE        "dbm"
686 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
687 #ifndef NO_NIS
688 #define HAS_NIS
689 #endif
690 #define HAS_SA_LEN
691 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
692 #define RESOLVE_H_NEEDS_STDIO_H
693 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
694 #define SOCKADDR_SIZE         size_t
695 #define SOCKOPT_SIZE          size_t
696 #define USE_STATFS
697 #define STATFS_IN_SYS_STATFS_H
698 #define STRCASECMP_IN_STRINGS_H
699 extern time_t time(time_t *);
700 extern int seteuid(uid_t);
701 extern int setegid(gid_t);
702 extern int initgroups(const char *, int);
703 
704 #define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
705 
706 #define CANT_USE_SEND_RECV_MSG
707 #endif
708 
709  /*
710   * IRIX, a mix of System V Releases.
711   */
712 #if defined(IRIX5) || defined(IRIX6)
713 #define SUPPORTED
714 #define UINT32_TYPE unsigned int
715 #define UINT16_TYPE unsigned short
716 #define MISSING_SETENV
717 #define _PATH_MAILDIR         "/var/mail"
718 #define _PATH_BSHELL          "/bin/sh"
719 #define _PATH_DEFPATH         "/usr/bin:/usr/bsd"
720 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/bsd"
721 #define HAS_FCNTL_LOCK
722 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
723 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
724 #define HAS_FSYNC
725 #define HAS_DBM
726 #define NATIVE_DB_TYPE        "dbm"
727 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
728 #ifndef NO_NIS
729 #define HAS_NIS
730 #endif
731 #define USE_SYS_SOCKIO_H                /* XXX check */
732 #define GETTIMEOFDAY(t)       gettimeofday(t)
733 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/bsd"
734 #define FIONREAD_IN_SYS_FILIO_H                   /* XXX check */
735 #define DBM_NO_TRAILING_NULL            /* XXX check */
736 #define USE_STATVFS
737 #define STATVFS_IN_SYS_STATVFS_H
738 #define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
739 #define CANT_USE_SEND_RECV_MSG
740 #endif
741 
742 #if defined(IRIX5)
743 #define MISSING_USLEEP
744 #endif
745 
746 #if defined(IRIX6)
747 #ifndef NO_IPV6
748 #define HAS_IPV6
749 #endif
750 #define HAS_POSIX_REGEXP
751 #define PIPES_CANT_FIONREAD
752 #endif
753 
754  /*
755   * GLIBC, mainly, but not exclusively Linux
756   */
757 #ifdef __GLIBC_PREREQ
758 #define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) __GLIBC_PREREQ(maj, min)
759 #else
760 #define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) \
761     (defined(__GLIBC__) && \
762           ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)))
763 #endif
764 
765  /*
766   * LINUX.
767   */
768 #if defined(LINUX2) || defined(LINUX3) || defined(LINUX4) || defined(LINUX5) \
769           || defined(LINUX6)
770 #define SUPPORTED
771 #define UINT32_TYPE unsigned int
772 #define UINT16_TYPE unsigned short
773 #include <features.h>
774 #define USE_PATHS_H
775 #define HAS_FLOCK_LOCK
776 #define HAS_FCNTL_LOCK
777 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
778 #define DEF_MAILBOX_LOCK "fcntl, dotlock"         /* RedHat >= 4.x */
779 #define HAS_FSYNC
780 #define HAS_DB
781 #define NATIVE_DB_TYPE        "hash"
782 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
783 #ifndef NO_NIS
784 #define HAS_NIS
785 #endif
786 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
787 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin"
788 #define FIONREAD_IN_TERMIOS_H
789 #define USE_STATFS
790 #define STATFS_IN_SYS_VFS_H
791 #define PREPEND_PLUS_TO_OPTSTRING
792 #define HAS_POSIX_REGEXP
793 #define HAS_DLOPEN
794 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
795 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
796 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
797 #define NATIVE_COMMAND_DIR "/usr/sbin"
798 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
799 #if HAVE_GLIBC_API_VERSION_SUPPORT(2, 1)
800 #define SOCKADDR_SIZE         socklen_t
801 #define SOCKOPT_SIZE          socklen_t
802 #else
803 #define NO_SNPRINTF
804 #endif
805 #ifndef NO_IPV6
806 #define HAS_IPV6
807 #if HAVE_GLIBC_API_VERSION_SUPPORT(2, 4)
808 /* Really 2.3.3 or later, but there's no __GLIBC_MICRO version macro. */
809 #define HAVE_GETIFADDRS
810 #else
811 #define HAS_PROCNET_IFINET6
812 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
813 #endif
814 #endif
815 #include <linux/version.h>
816 #if !defined(KERNEL_VERSION)
817 #define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
818 #endif
819 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \
820           || (defined(__GLIBC__) && __GLIBC__ < 2)
821 #define CANT_USE_SEND_RECV_MSG
822 #define DEF_SMTP_CACHE_DEMAND 0
823 #else
824 #define CANT_WRITE_BEFORE_SENDING_FD
825 #endif
826 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"  /* introduced in 1.1 */
827 #ifndef NO_EPOLL
828 #define EVENTS_STYLE          EVENTS_STYLE_EPOLL  /* introduced in 2.5 */
829 #endif
830 #define USE_SYSV_POLL
831 #ifndef NO_POSIX_GETPW_R
832 #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1) \
833           || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 1) \
834           || (defined(_BSD_SOURCE) && _BSD_SOURCE >= 1) \
835           || (defined(_SVID_SOURCE) && _SVID_SOURCE >= 1) \
836           || (defined(_POSIX_SOURCE) && _POSIX_SOURCE >= 1)
837 #define HAVE_POSIX_GETPW_R
838 #endif
839 #endif
840 #if HAVE_GLIBC_API_VERSION_SUPPORT(2, 34)
841 #define HAS_CLOSEFROM
842 #endif
843 
844 #endif
845 
846 #ifdef LINUX1
847 #define SUPPORTED
848 #define UINT32_TYPE unsigned int
849 #define UINT16_TYPE unsigned short
850 #define USE_PATHS_H
851 #define HAS_FLOCK_LOCK
852 #define HAS_FCNTL_LOCK
853 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
854 #define DEF_MAILBOX_LOCK "dotlock"      /* verified RedHat 3.03 */
855 #define HAS_FSYNC
856 #define HAS_DB
857 #define NATIVE_DB_TYPE        "hash"
858 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
859 #ifndef NO_NIS
860 #define HAS_NIS
861 #endif
862 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
863 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin"
864 #define FIONREAD_IN_TERMIOS_H           /* maybe unnecessary */
865 #define USE_STATFS
866 #define STATFS_IN_SYS_VFS_H
867 #define PREPEND_PLUS_TO_OPTSTRING
868 #define HAS_POSIX_REGEXP
869 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
870 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
871 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
872 #define NATIVE_COMMAND_DIR "/usr/sbin"
873 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
874 #define CANT_USE_SEND_RECV_MSG
875 #define DEF_SMTP_CACHE_DEMAND 0
876 #endif
877 
878  /*
879   * GNU.
880   */
881 #ifdef GNU0
882 #define SUPPORTED
883 #include <features.h>
884 #define USE_PATHS_H
885 #define HAS_FCNTL_LOCK
886 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
887 #define DEF_MAILBOX_LOCK "fcntl, dotlock"         /* RedHat >= 4.x */
888 #define HAS_FSYNC
889 #define HAS_DB
890 #define NATIVE_DB_TYPE        "hash"
891 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
892 #ifndef NO_NIS
893 #define HAS_NIS
894 #endif
895 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
896 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin"
897 #define FIONREAD_IN_TERMIOS_H
898 #define USE_STATFS
899 #define STATFS_IN_SYS_VFS_H
900 #define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
901 #define PREPEND_PLUS_TO_OPTSTRING
902 #define HAS_POSIX_REGEXP
903 #define HAS_DLOPEN
904 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
905 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
906 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
907 #define NATIVE_COMMAND_DIR "/usr/sbin"
908 #ifdef DEBIAN
909 #define NATIVE_DAEMON_DIR     "/usr/lib/postfix"
910 #ifndef DEF_MANPAGE_DIR
911 #define DEF_MANPAGE_DIR                 "/usr/share/man"
912 #endif
913 #ifndef DEF_SAMPLE_DIR
914 #define DEF_SAMPLE_DIR                  "/usr/share/doc/postfix/examples"
915 #endif
916 #ifndef DEF_README_DIR
917 #define DEF_README_DIR                  "/usr/share/doc/postfix"
918 #endif
919 #else
920 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
921 #endif
922 #define SOCKADDR_SIZE         socklen_t
923 #define SOCKOPT_SIZE          socklen_t
924 #ifdef __FreeBSD_kernel__
925 #define HAS_DUPLEX_PIPE
926 #define HAS_ISSETUGID
927 #endif
928 #ifndef NO_IPV6
929 #define HAS_IPV6
930 #ifdef __FreeBSD_kernel__
931 #define HAVE_GETIFADDRS
932 #else
933 #define HAS_PROCNET_IFINET6
934 #define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
935 #endif
936 #endif
937 #define CANT_USE_SEND_RECV_MSG
938 #define DEF_SMTP_CACHE_DEMAND 0
939 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"
940 #endif
941 
942  /*
943   * HPUX11 was copied from HPUX10, but can perhaps be trimmed down a bit.
944   */
945 #ifdef HPUX11
946 #define SUPPORTED
947 #define USE_SIG_RETURN
948 #define UINT32_TYPE unsigned int
949 #define UINT16_TYPE unsigned short
950 #define HAS_DBM
951 #define HAS_FCNTL_LOCK
952 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
953 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
954 #define HAS_FSYNC
955 #define NATIVE_DB_TYPE        "dbm"
956 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/mail/aliases"
957 #define ROOT_PATH   "/usr/bin:/sbin:/usr/sbin"
958 #define MISSING_SETENV
959 #ifndef NO_NIS
960 #define HAS_NIS
961 #endif
962 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
963 #define _PATH_BSHELL          "/bin/sh"
964 #define _PATH_MAILDIR         "/var/mail"
965 #define _PATH_DEFPATH         "/usr/bin"
966 #define _PATH_STDPATH         "/usr/bin:/sbin:/usr/sbin"
967 #define MISSING_SETEUID
968 #define HAVE_SETRESUID
969 #define MISSING_SETEGID
970 #define HAVE_SETRESGID
971 extern int h_errno;                     /* <netdb.h> imports too much stuff */
972 
973 #define USE_STATFS
974 #define STATFS_IN_SYS_VFS_H
975 #define HAS_POSIX_REGEXP
976 #define HAS_DLOPEN
977 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
978 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
979 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
980 #define NATIVE_COMMAND_DIR "/usr/sbin"
981 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
982 #endif
983 
984 #ifdef HPUX10
985 #define SUPPORTED
986 #define USE_SIG_RETURN
987 #define UINT32_TYPE unsigned int
988 #define UINT16_TYPE unsigned short
989 #define HAS_DBM
990 #define HAS_FCNTL_LOCK
991 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
992 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
993 #define HAS_FSYNC
994 #define NATIVE_DB_TYPE        "dbm"
995 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/mail/aliases"
996 #define ROOT_PATH   "/usr/bin:/sbin:/usr/sbin"
997 #define MISSING_SETENV
998 #ifndef NO_NIS
999 #define HAS_NIS
1000 #endif
1001 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
1002 #define _PATH_BSHELL          "/bin/sh"
1003 #define _PATH_MAILDIR         "/var/mail"
1004 #define _PATH_DEFPATH         "/usr/bin"
1005 #define _PATH_STDPATH         "/usr/bin:/sbin:/usr/sbin"
1006 #define MISSING_SETEUID
1007 #define HAVE_SETRESUID
1008 #define MISSING_SETEGID
1009 #define HAVE_SETRESGID
1010 extern int h_errno;                     /* <netdb.h> imports too much stuff */
1011 
1012 #define USE_STATFS
1013 #define STATFS_IN_SYS_VFS_H
1014 #define HAS_POSIX_REGEXP
1015 #define HAS_SHL_LOAD
1016 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
1017 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
1018 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
1019 #define NATIVE_COMMAND_DIR "/usr/sbin"
1020 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
1021 #endif
1022 
1023 #ifdef HPUX9
1024 #define SUPPORTED
1025 #define USE_SIG_RETURN
1026 #define UINT32_TYPE unsigned int
1027 #define UINT16_TYPE unsigned short
1028 #define HAS_DBM
1029 #define HAS_FCNTL_LOCK
1030 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
1031 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
1032 #define HAS_FSYNC
1033 #ifndef NO_NIS
1034 #define HAS_NIS
1035 #endif
1036 #define MISSING_SETENV
1037 #define MISSING_RLIMIT_FSIZE
1038 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
1039 #define NATIVE_DB_TYPE        "dbm"
1040 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/usr/lib/aliases"
1041 #define ROOT_PATH   "/bin:/usr/bin:/etc"
1042 #define _PATH_BSHELL          "/bin/sh"
1043 #define _PATH_MAILDIR         "/usr/mail"
1044 #define _PATH_DEFPATH         "/bin:/usr/bin"
1045 #define _PATH_STDPATH         "/bin:/usr/bin:/etc"
1046 #define MISSING_SETEUID
1047 #define HAVE_SETRESUID
1048 #define MISSING_SETEGID
1049 #define HAVE_SETRESGID
1050 extern int h_errno;
1051 
1052 #define USE_ULIMIT                      /* no setrlimit() */
1053 #define USE_STATFS
1054 #define STATFS_IN_SYS_VFS_H
1055 #define HAS_POSIX_REGEXP
1056 #define HAS_SHL_LOAD
1057 #define NATIVE_SENDMAIL_PATH "/usr/bin/sendmail"
1058 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
1059 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
1060 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
1061 #endif
1062 
1063  /*
1064   * NEXTSTEP3, without -lposix, because its naming service is broken.
1065   */
1066 #ifdef NEXTSTEP3
1067 #define SUPPORTED
1068 #define UINT32_TYPE unsigned int
1069 #define UINT16_TYPE unsigned short
1070 #define HAS_DBM
1071 #define HAS_FLOCK_LOCK
1072 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
1073 #define DEF_MAILBOX_LOCK "flock, dotlock"
1074 #define USE_STATFS
1075 #define HAVE_SYS_DIR_H
1076 #define STATFS_IN_SYS_VFS_H
1077 #define HAS_FSYNC
1078 #ifndef NO_NIS
1079 #define HAS_NIS
1080 #endif
1081 #define HAS_NETINFO
1082 #define MISSING_SETENV_PUTENV
1083 #define MISSING_MKFIFO
1084 #define MISSING_SIGSET_T
1085 #define MISSING_SIGACTION
1086 #define MISSING_STD_FILENOS
1087 #define MISSING_SETSID
1088 #define MISSING_WAITPID
1089 #define MISSING_UTIMBUF
1090 #define HAS_WAIT4
1091 #define WAIT_STATUS_T union wait
1092 #define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
1093 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
1094 #define _PATH_MAILDIR         "/usr/spool/mail"
1095 #define _PATH_BSHELL          "/bin/sh"
1096 #define _PATH_DEFPATH         "/bin:/usr/bin:/usr/ucb"
1097 #define _PATH_STDPATH         "/bin:/usr/bin:/usr/ucb"
1098 #define ROOT_PATH   "/bin:/usr/bin:/usr/etc:/usr/ucb"
1099 #define NATIVE_DB_TYPE        "dbm"
1100 #define ALIAS_DB_MAP          "netinfo:/aliases"
1101 #include <libc.h>
1102 #define MISSING_POSIX_S_IS
1103 #define MISSING_POSIX_S_MODES
1104 /* It's amazing what is all missing...  */
1105 #define isascii(c)  ((unsigned)(c)<=0177)
1106 extern int opterr;
1107 typedef unsigned short mode_t;
1108 
1109 #define MISSING_PID_T
1110 #define MISSING_STRFTIME_E
1111 #define FD_CLOEXEC  1
1112 #define O_NONBLOCK  O_NDELAY
1113 #define WEXITSTATUS(x)        ((x).w_retcode)
1114 #define WTERMSIG(x) ((x).w_termsig)
1115 #endif
1116 
1117  /*
1118   * OPENSTEP does not have posix (some fix...)
1119   */
1120 #ifdef OPENSTEP4
1121 #define SUPPORTED
1122 #define UINT32_TYPE unsigned int
1123 #define UINT16_TYPE unsigned short
1124 #define HAS_DBM
1125 #define HAS_FLOCK_LOCK
1126 #define INTERNAL_LOCK         MYFLOCK_STYLE_FLOCK
1127 #define DEF_MAILBOX_LOCK "flock, dotlock"
1128 #define USE_STATFS
1129 #define HAVE_SYS_DIR_H
1130 #define STATFS_IN_SYS_VFS_H
1131 #define HAS_FSYNC
1132 #ifndef NO_NIS
1133 #define HAS_NIS
1134 #endif
1135 #define HAS_NETINFO
1136 #define MISSING_SETENV_PUTENV
1137 #define MISSING_MKFIFO
1138 #define MISSING_SIGSET_T
1139 #define MISSING_SIGACTION
1140 #define MISSING_STD_FILENOS
1141 #define MISSING_SETSID
1142 #define MISSING_WAITPID
1143 #define MISSING_UTIMBUF
1144 #define HAS_WAIT4
1145 #define WAIT_STATUS_T union wait
1146 #define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
1147 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
1148 #define _PATH_MAILDIR         "/usr/spool/mail"
1149 #define _PATH_BSHELL          "/bin/sh"
1150 #define _PATH_DEFPATH         "/bin:/usr/bin:/usr/ucb"
1151 #define _PATH_STDPATH         "/bin:/usr/bin:/usr/ucb"
1152 #define ROOT_PATH   "/bin:/usr/bin:/usr/etc:/usr/ucb"
1153 #define NATIVE_DB_TYPE        "dbm"
1154 #define ALIAS_DB_MAP          "netinfo:/aliases"
1155 #include <libc.h>
1156 #define MISSING_POSIX_S_IS
1157 #define MISSING_POSIX_S_MODES
1158 /* It's amazing what is all missing...  */
1159 #define isascii(c)  ((unsigned)(c)<=0177)
1160 extern int opterr;
1161 typedef unsigned short mode_t;
1162 
1163 #define MISSING_PID_T
1164 #define MISSING_STRFTIME_E
1165 #define FD_CLOEXEC  1
1166 #define O_NONBLOCK  O_NDELAY
1167 #define WEXITSTATUS(x)        ((x).w_retcode)
1168 #define WTERMSIG(x) ((x).w_termsig)
1169 #endif
1170 
1171 #ifdef ReliantUnix543
1172 #define SUPPORTED
1173 #define UINT32_TYPE unsigned int
1174 #define UINT16_TYPE unsigned short
1175 #define MISSING_SETENV
1176 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
1177 #define _PATH_BSHELL          "/bin/sh"
1178 #define _PATH_MAILDIR         "/var/spool/mail"
1179 #define HAS_FCNTL_LOCK
1180 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
1181 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
1182 #define HAS_FSYNC
1183 #define FIONREAD_IN_SYS_FILIO_H
1184 #define USE_SYS_SOCKIO_H
1185 #define HAS_DBM
1186 #define NATIVE_DB_TYPE        "dbm"
1187 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/var/adm/sendmail/aliases"
1188 extern int optind;                      /* XXX use <getopt.h> */
1189 extern char *optarg;                              /* XXX use <getopt.h> */
1190 extern int opterr;                      /* XXX use <getopt.h> */
1191 
1192 #ifndef NO_NIS
1193 #define HAS_NIS
1194 #endif
1195 #define GETTIMEOFDAY(t) gettimeofday(t)
1196 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
1197 #define USE_STATVFS
1198 #define STATVFS_IN_SYS_STATVFS_H
1199 #define MISSING_USLEEP
1200 #endif
1201 
1202 #ifdef DCOSX1                                     /* Siemens Pyramid */
1203 #define SUPPORTED
1204 #define UINT32_TYPE unsigned int
1205 #define UINT16_TYPE unsigned short
1206 #define _PATH_MAILDIR         "/var/mail"
1207 #define _PATH_BSHELL          "/bin/sh"
1208 #define _PATH_DEFPATH         "/usr/bin:/usr/ucb"
1209 #define _PATH_STDPATH         "/usr/bin:/usr/sbin:/usr/ucb"
1210 #define MISSING_SETENV
1211 #define HAS_FCNTL_LOCK
1212 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
1213 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
1214 #define HAS_FSYNC
1215 #define NATIVE_DB_TYPE        "hash"
1216 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/aliases"
1217 /* Uncomment the following line if you have NIS package installed */
1218 /* #define HAS_NIS */
1219 #define USE_SYS_SOCKIO_H
1220 #define GETTIMEOFDAY(t) gettimeofday(t,NULL)
1221 #define ROOT_PATH   "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
1222 #define FIONREAD_IN_SYS_FILIO_H
1223 #define DBM_NO_TRAILING_NULL
1224 #define USE_STATVFS
1225 #define STATVFS_IN_SYS_STATVFS_H
1226 #ifndef S_ISSOCK
1227 #define S_ISSOCK(mode)        ((mode&0xF000) == 0xC000)
1228 #endif
1229 #endif
1230 
1231 #ifdef SCO5
1232 #define SUPPORTED
1233 #include <sys/socket.h>
1234 extern int h_errno;
1235 
1236 #define UINT32_TYPE unsigned int
1237 #define UINT16_TYPE unsigned short
1238 #define _PATH_MAILDIR         "/usr/spool/mail"
1239 #define _PATH_BSHELL          "/bin/sh"
1240 #define _PATH_DEFPATH         "/bin:/usr/bin"
1241 #define USE_PATHS_H
1242 #define HAS_FCNTL_LOCK
1243 #define INTERNAL_LOCK         MYFLOCK_STYLE_FCNTL
1244 #define DEF_MAILBOX_LOCK "fcntl, dotlock"
1245 #define HAS_FSYNC
1246 #define HAS_DBM
1247 #define NATIVE_DB_TYPE        "dbm"
1248 #define ALIAS_DB_MAP          DEF_DB_TYPE ":/etc/mail/aliases"
1249 #define DBM_NO_TRAILING_NULL
1250 #ifndef NO_NIS
1251 #define HAS_NIS
1252 #endif
1253 #define GETTIMEOFDAY(t)       gettimeofday(t,(struct timezone *) 0)
1254 #define ROOT_PATH   "/bin:/etc:/usr/bin:/tcb/bin"
1255 #define USE_STATVFS
1256 #define STATVFS_IN_SYS_STATVFS_H
1257 #define MISSING_SETENV
1258 #define STRCASECMP_IN_STRINGS_H
1259 /* SCO5 misses just S_ISSOCK, the others are there
1260  * Use C_ISSOCK definition from cpio.h.
1261  */
1262 #include <cpio.h>
1263 #define S_ISSOCK(mode)        (((mode) & (S_IFMT)) == (C_ISSOCK))
1264 #define CANT_USE_SEND_RECV_MSG
1265 #define DEF_SMTP_CACHE_DEMAND 0
1266 #endif
1267 
1268  /*
1269   * We're not going to try to guess like configure does.
1270   */
1271 #ifndef SUPPORTED
1272 #error "unsupported platform"
1273 #endif
1274 
1275  /*
1276   * Allow command line flags to override native settings
1277   */
1278 #ifndef DEF_COMMAND_DIR
1279 #ifdef NATIVE_COMMAND_DIR
1280 #define DEF_COMMAND_DIR NATIVE_COMMAND_DIR
1281 #endif
1282 #endif
1283 
1284 #ifndef DEF_DAEMON_DIR
1285 #ifdef NATIVE_DAEMON_DIR
1286 #define DEF_DAEMON_DIR NATIVE_DAEMON_DIR
1287 #endif
1288 #endif
1289 
1290 #ifndef DEF_SENDMAIL_PATH
1291 #ifdef NATIVE_SENDMAIL_PATH
1292 #define DEF_SENDMAIL_PATH NATIVE_SENDMAIL_PATH
1293 #endif
1294 #endif
1295 
1296 #ifndef DEF_MAILQ_PATH
1297 #ifdef NATIVE_MAILQ_PATH
1298 #define DEF_MAILQ_PATH NATIVE_MAILQ_PATH
1299 #endif
1300 #endif
1301 
1302 #ifndef DEF_NEWALIAS_PATH
1303 #ifdef NATIVE_NEWALIAS_PATH
1304 #define DEF_NEWALIAS_PATH NATIVE_NEWALIAS_PATH
1305 #endif
1306 #endif
1307 
1308 #ifndef DEF_DB_TYPE
1309 #define DEF_DB_TYPE NATIVE_DB_TYPE
1310 #endif
1311 
1312 #define CAST_ANY_PTR_TO_INT(cptr)       ((int) (long) (cptr))
1313 #define CAST_INT_TO_VOID_PTR(ival)      ((void *) (long) (ival))
1314 
1315 #ifdef DUP2_DUPS_CLOSE_ON_EXEC
1316 /* dup2_pass_on_exec() can be found in util/sys_compat.c */
1317 extern int dup2_pass_on_exec(int oldd, int newd);
1318 
1319 #define DUP2 dup2_pass_on_exec
1320 #else
1321 #define DUP2 dup2
1322 #endif
1323 
1324 #ifdef PREPEND_PLUS_TO_OPTSTRING
1325 #define GETOPT(argc, argv, str)         getopt((argc), (argv), "+" str)
1326 #else
1327 #define GETOPT(argc, argv, str) getopt((argc), (argv), (str))
1328 #endif
1329 #define OPTIND  (optind > 0 ? optind : 1)
1330 
1331 #if !defined(__UCLIBC__) && !defined(NO_RES_SEND)
1332 #define HAVE_RES_SEND
1333 #else
1334 #undef HAVE_RES_SEND
1335 #endif
1336 
1337  /*
1338   * The RFC 5322 Date and Time Specification recommends single space between
1339   * date-time tokens. To avoid breaking change, format all numerical days as
1340   * two-digit days (i.e. days 1-9 now have a leading zero instead of space).
1341   */
1342 #define TWO_DIGIT_DAY_IN_DATE_TIME
1343 
1344  /*
1345   * Check for required but missing definitions.
1346   */
1347 #if !defined(HAS_FCNTL_LOCK) && !defined(HAS_FLOCK_LOCK)
1348 #error "define HAS_FCNTL_LOCK and/or HAS_FLOCK_LOCK"
1349 #endif
1350 
1351 #if !defined(DEF_MAILBOX_LOCK)
1352 #error "define DEF_MAILBOX_LOCK"
1353 #endif
1354 
1355 #if !defined(INTERNAL_LOCK)
1356 #error "define INTERNAL_LOCK"
1357 #endif
1358 
1359 #if defined(USE_STATFS) && defined(USE_STATVFS)
1360 #error "define USE_STATFS or USE_STATVFS, not both"
1361 #endif
1362 
1363 #if !defined(USE_STATFS) && !defined(USE_STATVFS)
1364 #error "define USE_STATFS or USE_STATVFS"
1365 #endif
1366 
1367  /*
1368   * Defaults for systems that pre-date IPv6 support.
1369   */
1370 #ifndef __NetBSD__
1371 #ifndef HAS_IPV6
1372 #include <sys/socket.h>
1373 #define EMULATE_IPV4_ADDRINFO
1374 #define MISSING_INET_PTON
1375 #define MISSING_INET_NTOP
1376 extern const char *inet_ntop(int, const void *, char *, SOCKADDR_SIZE);
1377 extern int inet_pton(int, const char *, void *);
1378 
1379 #endif
1380 #endif
1381 
1382  /*
1383   * Workaround: after a watchdog alarm signal, wake up from select/poll/etc.
1384   * by writing to a pipe. Solaris needs this, and HP-UX apparently, too. The
1385   * run-time cost is negligible so we just turn it on for all systems. As a
1386   * side benefit, making this code system-independent will simplify the
1387   * detection of bit-rot problems.
1388   */
1389 #ifndef NO_WATCHDOG_PIPE
1390 #define USE_WATCHDOG_PIPE
1391 #endif
1392 
1393  /*
1394   * If we don't have defined a preferred random device above, but the system
1395   * has /dev/urandom, then we use that.
1396   */
1397 #if !defined(PREFERRED_RAND_SOURCE) && defined(HAS_DEV_URANDOM)
1398 #define PREFERRED_RAND_SOURCE "dev:/dev/urandom"
1399 #endif
1400 
1401  /*
1402   * Defaults for systems without kqueue, /dev/poll or epoll support.
1403   * master/multi-server.c and *qmgr/qmgr_transport.c depend on this.
1404   */
1405 #if !defined(EVENTS_STYLE)
1406 #define EVENTS_STYLE          EVENTS_STYLE_SELECT
1407 #endif
1408 
1409 #define EVENTS_STYLE_SELECT   1         /* Traditional BSD select */
1410 #define EVENTS_STYLE_KQUEUE   2         /* FreeBSD kqueue */
1411 #define EVENTS_STYLE_DEVPOLL  3         /* Solaris /dev/poll */
1412 #define EVENTS_STYLE_EPOLL    4         /* Linux epoll */
1413 
1414  /*
1415   * We use poll() for read/write time limit enforcement on modern systems. We
1416   * use select() on historical systems without poll() support. And on systems
1417   * where poll() is not implemented for some file handle types, we try to use
1418   * select() as a fall-back solution (MacOS X needs this).
1419   */
1420 #if !defined(USE_SYSV_POLL) && !defined(USE_SYSV_POLL_THEN_SELECT)
1421 #define USE_BSD_SELECT
1422 #endif
1423 
1424  /*
1425   * The Postfix 2.9 post-install workaround assumes that the inet_protocols
1426   * default value is "ipv4" when Postfix is compiled without IPv6 support.
1427   */
1428 #ifndef DEF_INET_PROTOCOLS
1429 #ifdef HAS_IPV6
1430 #define DEF_INET_PROTOCOLS    INET_PROTO_NAME_ALL
1431 #else
1432 #define DEF_INET_PROTOCOLS    INET_PROTO_NAME_IPV4
1433 #endif
1434 #endif
1435 
1436  /*
1437   * Defaults for systems that pre-date POSIX socklen_t.
1438   */
1439 #ifndef SOCKADDR_SIZE
1440 #define SOCKADDR_SIZE         int
1441 #endif
1442 
1443 #ifndef SOCKOPT_SIZE
1444 #define SOCKOPT_SIZE          int
1445 #endif
1446 
1447  /*
1448   * Defaults for normal systems.
1449   */
1450 #ifndef LOCAL_LISTEN
1451 #define LOCAL_LISTEN          unix_listen
1452 #define LOCAL_ACCEPT          unix_accept
1453 #define LOCAL_CONNECT         unix_connect
1454 #define LOCAL_TRIGGER         unix_trigger
1455 #define LOCAL_SEND_FD         unix_send_fd
1456 #define LOCAL_RECV_FD         unix_recv_fd
1457 #endif
1458 
1459 #if !defined (HAVE_SYS_NDIR_H) && !defined (HAVE_SYS_DIR_H) \
1460           && !defined (HAVE_NDIR_H)
1461 #define HAVE_DIRENT_H
1462 #endif
1463 
1464 #ifndef WAIT_STATUS_T
1465 typedef int WAIT_STATUS_T;
1466 
1467 #define NORMAL_EXIT_STATUS(status)      ((status) == 0)
1468 #endif
1469 
1470 #ifdef NO_POSIX_GETPW_R
1471 #undef HAVE_POSIX_GETPW_R
1472 #endif
1473 
1474 #ifdef NO_CLOSEFROM
1475 #undef HAS_CLOSEFROM
1476 #endif
1477 
1478 #ifdef NO_DB
1479 #undef HAS_DB
1480 #endif
1481 
1482 #ifndef OCTAL_TO_UNSIGNED
1483 #define OCTAL_TO_UNSIGNED(res, str)     ((res) = strtoul((str), (char **) 0, 8))
1484 #endif
1485 
1486  /*
1487   * Avoid useless type mis-matches when using sizeof in an integer context.
1488   */
1489 #define INT_SIZEOF(foo)       ((int) sizeof(foo))
1490 
1491  /*
1492   * Turn on the compatibility stuff.
1493   */
1494 #ifdef MISSING_UTIMBUF
1495 struct utimbuf {
1496     time_t  actime;
1497     time_t  modtime;
1498 };
1499 
1500 #endif
1501 
1502 #ifdef MISSING_STRERROR
1503 extern const char *strerror(int);
1504 
1505 #endif
1506 
1507 #if defined (MISSING_SETENV) || defined (MISSING_SETENV_PUTENV)
1508 extern int setenv(const char *, const char *, int);
1509 
1510 #endif
1511 
1512 #ifdef MISSING_SETEUID
1513 extern int seteuid(uid_t euid);
1514 
1515 #endif
1516 
1517 #ifdef MISSING_SETEGID
1518 extern int setegid(gid_t egid);
1519 
1520 #endif
1521 
1522 #ifdef MISSING_MKFIFO
1523 extern int mkfifo(char *, int);
1524 
1525 #endif
1526 
1527 #ifdef MISSING_WAITPID
1528 extern int waitpid(int, WAIT_STATUS_T *status, int options);
1529 
1530 #endif
1531 
1532 #ifdef MISSING_SETSID
1533 extern int setsid(void);
1534 
1535 #endif
1536 
1537 #ifndef HAS_CLOSEFROM
1538 extern void closefrom(int);
1539 
1540 #endif
1541 
1542 #ifdef MISSING_STD_FILENOS
1543 #define STDIN_FILENO          0
1544 #define STDOUT_FILENO         1
1545 #define STDERR_FILENO         2
1546 #endif
1547 
1548 #ifdef MISSING_PID_T
1549 typedef int pid_t;
1550 
1551 #endif
1552 
1553 #ifdef MISSING_POSIX_S_IS
1554 #define S_ISBLK(mode)         (((mode) & (_S_IFMT)) == (_S_IFBLK))
1555 #define S_ISCHR(mode)         (((mode) & (_S_IFMT)) == (_S_IFCHR))
1556 #define S_ISDIR(mode)         (((mode) & (_S_IFMT)) == (_S_IFDIR))
1557 #define S_ISSOCK(mode)        (((mode) & (_S_IFMT)) == (_S_IFSOCK))
1558 #define S_ISFIFO(mode)        (((mode) & (_S_IFMT)) == (_S_IFIFO))
1559 #define S_ISREG(mode)         (((mode) & (_S_IFMT)) == (_S_IFREG))
1560 #define S_ISLNK(mode)         (((mode) & (_S_IFMT)) == (_S_IFLNK))
1561 #endif
1562 
1563 #ifdef MISSING_POSIX_S_MODES
1564 #define S_IRUSR     _S_IRUSR
1565 #define S_IRGRP     0000040
1566 #define S_IROTH     0000004
1567 #define S_IWUSR     _S_IWUSR
1568 #define S_IWGRP     0000020
1569 #define S_IWOTH     0000002
1570 #define S_IXUSR     _S_IXUSR
1571 #define S_IXGRP     0000010
1572 #define S_IXOTH     0000001
1573 #define   S_IRWXU   (S_IRUSR | S_IWUSR | S_IXUSR)
1574 #endif
1575 
1576  /*
1577   * Memory alignment of memory allocator results. By default we align for
1578   * doubles.
1579   */
1580 #ifndef ALIGN_TYPE
1581 #if defined(__hpux) && defined(__ia64)
1582 #define ALIGN_TYPE  __float80
1583 #elif defined(__ia64__)
1584 #define ALIGN_TYPE  long double
1585 #else
1586 #define ALIGN_TYPE  double
1587 #endif
1588 #endif
1589 
1590  /*
1591   * Clang-style attribute tests.
1592   *
1593   * XXX Without the unconditional test below, gcc 4.6 will barf on ``elif
1594   * defined(__clang__) && __has_attribute(__whatever__)'' with error message
1595   * ``missing binary operator before token "("''.
1596   */
1597 #ifndef __has_attribute
1598 #define __has_attribute(x) 0
1599 #endif                                            /* __has_attribute */
1600 
1601  /*
1602   * Need to specify what functions never return, so that the compiler can
1603   * warn for missing initializations and other trouble. However, OPENSTEP4
1604   * gcc 2.7.x cannot handle this so we define this only if NORETURN isn't
1605   * already defined above.
1606   *
1607   * Data point: gcc 2.7.2 has __attribute__ (Wietse Venema) but gcc 2.6.3 does
1608   * not (Clive Jones). So we'll set the threshold at 2.7.
1609   */
1610 #ifndef NORETURN
1611 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
1612 #define NORETURN    void __attribute__((__noreturn__))
1613 #elif defined(__clang__) && __has_attribute(__noreturn__)
1614 #define NORETURN    void __attribute__((__noreturn__))
1615 #else
1616 #define NORETURN    void
1617 #endif
1618 #endif                                            /* NORETURN */
1619 
1620  /*
1621   * Turn on format string argument checking. This is more accurate than
1622   * printfck, but it misses #ifdef-ed code. XXX I am just guessing at what
1623   * gcc versions support this. In order to turn this off for some platforms,
1624   * specify #define PRINTFLIKE and #define SCANFLIKE in the system-dependent
1625   * sections above.
1626   */
1627 #ifndef PRINTFLIKE
1628 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
1629 #define PRINTFLIKE(x,y) __attribute__ ((format (printf, (x), (y))))
1630 #elif defined(__clang__) && __has_attribute(__format__)
1631 #define PRINTFLIKE(x,y)       __attribute__ ((__format__ (__printf__, (x), (y))))
1632 #else
1633 #define PRINTFLIKE(x,y)
1634 #endif
1635 #endif                                            /* PRINTFLIKE */
1636 
1637 #ifndef SCANFLIKE
1638 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
1639 #define SCANFLIKE(x,y) __attribute__ ((format (scanf, (x), (y))))
1640 #elif defined(__clang__) && __has_attribute(__format__)
1641 #define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, (x), (y))))
1642 #else
1643 #define SCANFLIKE(x,y)
1644 #endif
1645 #endif                                            /* SCANFLIKE */
1646 
1647  /*
1648   * Some gcc implementations don't grok these attributes with pointer to
1649   * function. Again, wild guess of what is supported. To override, specify
1650   * #define PRINTFPTRLIKE  in the system-dependent sections above.
1651   */
1652 #ifndef PRINTFPTRLIKE
1653 #if (__GNUC__ >= 3)                     /* XXX Rough estimate */
1654 #define PRINTFPTRLIKE(x,y) PRINTFLIKE(x,y)
1655 #elif defined(__clang__) && __has_attribute(__format__)
1656 #define PRINTFPTRLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y))))
1657 #else
1658 #define PRINTFPTRLIKE(x,y)
1659 #endif
1660 #endif
1661 
1662  /*
1663   * Compiler optimization hint. This makes sense only for code in a
1664   * performance-critical loop.
1665   */
1666 #ifndef EXPECTED
1667 #if defined(__GNUC__) && (__GNUC__ > 2)
1668 #define EXPECTED(x) __builtin_expect(!!(x), 1)
1669 #define UNEXPECTED(x)         __builtin_expect(!!(x), 0)
1670 #else
1671 #define EXPECTED(x) (x)
1672 #define UNEXPECTED(x)         (x)
1673 #endif
1674 #endif
1675 
1676  /*
1677   * Warn about ignored function result values that must never be ignored.
1678   * Typically, this is for error results from "read" functions that normally
1679   * write to output parameters (for example, stat- or scanf-like functions)
1680   * or from functions that have other useful side effects (for example,
1681   * fseek- or rename-like functions).
1682   *
1683   * DO NOT use this for functions that write to a stream; it is entirely
1684   * legitimate to detect write errors with fflush() or fclose() only. On the
1685   * other hand most (but not all) functions that read from a stream must
1686   * never ignore result values.
1687   *
1688   * XXX Prepending "(void)" won't shut up GCC. Clang behaves as expected.
1689   */
1690 #if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3)
1691 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
1692 #elif defined(__clang__) && __has_attribute(warn_unused_result)
1693 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
1694 #else
1695 #define WARN_UNUSED_RESULT
1696 #endif
1697 
1698  /*
1699   * ISO C says that the "volatile" qualifier protects against optimizations
1700   * that cause longjmp() to clobber local variables.
1701   */
1702 #ifndef NOCLOBBER
1703 #define NOCLOBBER volatile
1704 #endif
1705 
1706  /*
1707   * Bit banging!! There is no official constant that defines the INT_MAX
1708   * equivalent for off_t, ssize_t, etc. Wietse came up with the following
1709   * macro that works as long as off_t, ssize_t, etc. use one's or two's
1710   * complement logic (that is, the maximum value is binary 01...1). Don't use
1711   * right-shift for signed types: the result is implementation-defined.
1712   */
1713 #include <limits.h>
1714 #define __MAXINT__(T) ((T) ~(((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)))
1715 #ifndef OFF_T_MAX
1716 #define OFF_T_MAX __MAXINT__(off_t)
1717 #endif
1718 
1719 #ifndef SSIZE_T_MAX
1720 #define SSIZE_T_MAX __MAXINT__(ssize_t)
1721 #endif
1722 
1723  /*
1724   * Consistent enforcement of size limits.
1725   */
1726 #define ENFORCING_SIZE_LIMIT(param)     ((param) > 0)
1727 
1728  /*
1729   * Don't mix socket message send/receive calls with socket stream read/write
1730   * calls. The fact that you can get away with it only on some stacks implies
1731   * that there is no long-term guarantee.
1732   */
1733 #ifndef CAN_WRITE_BEFORE_SENDING_FD
1734 #define CANT_WRITE_BEFORE_SENDING_FD
1735 #endif
1736 
1737  /*
1738   * FreeBSD sendmsg(2) says that after sending a file descriptor, the sender
1739   * must not immediately close the descriptor, otherwise it may close the
1740   * descriptor before it is actually sent.
1741   */
1742 #ifndef DONT_WAIT_AFTER_SENDING_FD
1743 #define MUST_READ_AFTER_SENDING_FD
1744 #endif
1745 
1746  /*
1747   * Hope for the best.
1748   */
1749 #ifndef UINT32_TYPE
1750 #define   UINT32_TYPE uint32_t
1751 #define UINT16_TYPE uint16_t
1752 #endif
1753 #define UINT32_SIZE 4
1754 #define UINT16_SIZE 2
1755 
1756  /*
1757   * For the sake of clarity.
1758   */
1759 #ifndef HAVE_CONST_CHAR_STAR
1760 typedef const char *CONST_CHAR_STAR;
1761 
1762 #endif
1763 
1764  /*
1765   * Safety. On some systems, ctype.h misbehaves with non-ASCII or negative
1766   * characters. More importantly, Postfix uses the ISXXX() macros to ensure
1767   * protocol compliance, so we have to rule out non-ASCII characters.
1768   *
1769   * XXX The (unsigned char) casts in isalnum() etc arguments are unnecessary
1770   * because the ISASCII() guard already ensures that the values are
1771   * non-negative; the casts are done anyway to shut up chatty compilers.
1772   */
1773 #define ISASCII(c)  isascii(_UCHAR_(c))
1774 #define _UCHAR_(c)  ((unsigned char)(c))
1775 #define ISALNUM(c)  (ISASCII(c) && isalnum((unsigned char)(c)))
1776 #define ISALPHA(c)  (ISASCII(c) && isalpha((unsigned char)(c)))
1777 #define ISCNTRL(c)  (ISASCII(c) && iscntrl((unsigned char)(c)))
1778 #define ISDIGIT(c)  (ISASCII(c) && isdigit((unsigned char)(c)))
1779 #define ISGRAPH(c)  (ISASCII(c) && isgraph((unsigned char)(c)))
1780 #define ISLOWER(c)  (ISASCII(c) && islower((unsigned char)(c)))
1781 #define ISPRINT(c)  (ISASCII(c) && isprint((unsigned char)(c)))
1782 #define ISPUNCT(c)  (ISASCII(c) && ispunct((unsigned char)(c)))
1783 #define ISSPACE(c)  (ISASCII(c) && isspace((unsigned char)(c)))
1784 #define ISUPPER(c)  (ISASCII(c) && isupper((unsigned char)(c)))
1785 #define TOLOWER(c)  (ISUPPER(c) ? tolower((unsigned char)(c)) : (c))
1786 #define TOUPPER(c)  (ISLOWER(c) ? toupper((unsigned char)(c)) : (c))
1787 
1788  /*
1789   * Character sets for parsing.
1790   */
1791 #define CHARS_COMMA_SP        ", \t\r\n"          /* list separator */
1792 #define CHARS_SPACE " \t\r\n" /* word separator */
1793 #define CHARS_BRACE "{}"                /* grouping */
1794 
1795  /*
1796   * Scaffolding. I don't want to lose messages while the program is under
1797   * development.
1798   */
1799 extern int REMOVE(const char *);
1800 
1801 /* LICENSE
1802 /* .ad
1803 /* .fi
1804 /*        The Secure Mailer license must be distributed with this software.
1805 /* AUTHOR(S)
1806 /*        Wietse Venema
1807 /*        IBM T.J. Watson Research
1808 /*        P.O. Box 704
1809 /*        Yorktown Heights, NY 10598, USA
1810 /*
1811 /*        Wietse Venema
1812 /*        Google, Inc.
1813 /*        111 8th Avenue
1814 /*        New York, NY 10011, USA
1815 /*--*/
1816 
1817 #endif
1818