summaryrefslogtreecommitdiffstats
path: root/src/util/sys_defs.h
blob: 37e460f9ccf363b3c38c276de07481d8785a442e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
#ifndef _SYS_DEFS_H_INCLUDED_
#define _SYS_DEFS_H_INCLUDED_

/*++
/* NAME
/*	sys_defs 3h
/* SUMMARY
/*	portability header
/* SYNOPSIS
/*	#include <sys_defs.h>
/* DESCRIPTION
/* .nf

 /*
  * Specific platforms. Major release numbers differ for a good reason. So be
  * a good girl, plan for the future, and at least include the major release
  * number in the system type (for example, SUNOS5 or FREEBSD2). The system
  * type is determined by the makedefs shell script in the top-level
  * directory. Adding support for a new system type means updating the
  * makedefs script, and adding a section below for the new system.
  */
#ifdef SUNOS5
#define _SVID_GETTOD			/* Solaris 2.5, XSH4.2 versus SVID */
#endif
#include <sys/types.h>

 /*
  * 4.4BSD and close derivatives.
  */
#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
    || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \
    || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \
    || defined(FREEBSD11) || defined(FREEBSD12) || defined(FREEBSD13) \
    || defined(FREEBSD14) \
    || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
    || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
    || defined(OPENBSD5) || defined(OPENBSD6) || defined(OPENBSD7) \
    || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
    || defined(NETBSD4) || defined(NETBSD5) || defined(NETBSD6) \
    || defined(NETBSD7) | defined(NETBSD8) || defined(NETBSD9) \
    || defined(NETBSD10) \
    || defined(EKKOBSD1) || defined(DRAGONFLY)
#define SUPPORTED
#include <sys/param.h>
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define USE_PATHS_H
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_SUN_LEN
#define HAS_FSYNC
#define HAS_DB
#define HAS_SA_LEN
#define NATIVE_DB_TYPE	"hash"
#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000)
#define ALIAS_DB_MAP   DEF_DB_TYPE ":/etc/mail/aliases"	/* sendmail 8.10 */
#endif
#if (defined(OpenBSD) && OpenBSD >= 200006)
#define ALIAS_DB_MAP   DEF_DB_TYPE ":/etc/mail/aliases"	/* OpenBSD 2.7 */
#endif
#ifndef ALIAS_DB_MAP
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
#if (defined(__NetBSD_Version__) && __NetBSD_Version__ > 299000900)
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#else
#define USE_STATFS
#define STATFS_IN_SYS_MOUNT_H
#endif
#define HAS_POSIX_REGEXP
#define HAS_ST_GEN			/* struct stat contains inode
					 * generation number */
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#define HAS_DLOPEN
#endif

#ifdef FREEBSD2
#define getsid(p) getpgrp()
#ifndef CMSG_SPACE
#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
#endif
#ifndef CMSG_LEN
#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif
#ifndef CMSG_ALIGN
#define CMSG_ALIGN(n) ALIGN(n)
#endif
#endif					/* FREEBSD2 */

#ifdef BSDI4
/* #define HAS_IPV6 find out interface lookup method */
#endif

/* __FreeBSD_version version is major+minor */

#if __FreeBSD_version >= 220000
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"	/* introduced 2.1.5 */
#endif

#if __FreeBSD_version >= 300000
#define HAS_ISSETUGID
#define HAS_FUTIMES
#endif

#if __FreeBSD_version >= 400000
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#endif

#if __FreeBSD_version >= 420000
#define HAS_DUPLEX_PIPE			/* 4.1 breaks with kqueue(2) */
#endif

#if (__FreeBSD_version >= 702104 && __FreeBSD_version <= 800000) \
    || __FreeBSD_version >= 800100
#define HAS_CLOSEFROM
#endif

/* OpenBSD version is year+month */

#if OpenBSD >= 199805			/* XXX */
#define HAS_FUTIMES			/* XXX maybe earlier */
#endif

#if (defined(OpenBSD) && OpenBSD >= 199608 && OpenBSD < 201105)
#define PREFERRED_RAND_SOURCE	"dev:/dev/arandom"	/* XXX earlier */
#endif

#if OpenBSD >= 200000			/* XXX */
#define HAS_ISSETUGID
#endif

#if OpenBSD >= 200200			/* XXX */
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#endif

#if OpenBSD >= 200405			/* 3.5 */
#define HAS_CLOSEFROM
#endif

/* __NetBSD_Version__ is major+minor */

#if __NetBSD_Version__ >= 103000000	/* XXX maybe earlier */
#undef DEF_MAILBOX_LOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"	/* XXX maybe earlier */
#endif

#if __NetBSD_Version__ >= 105000000
#define HAS_ISSETUGID			/* XXX maybe earlier */
#endif

#if __NetBSD_Version__ >= 106000000	/* XXX maybe earlier */
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#endif

#if __NetBSD_Version__ >= 299000900	/* 2.99.9 */
#define HAS_CLOSEFROM
#endif

#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 102000000)
#define HAS_FUTIMES
#endif

#if defined(__DragonFly__)
#define HAS_DEV_URANDOM
#define HAS_ISSETUGID
#define HAS_FUTIMES
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#define HAS_DUPLEX_PIPE
#endif

#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \
    || (defined(__FreeBSD__) && __FreeBSD__ >= 4) \
    || (defined(OpenBSD) && OpenBSD >= 200003) \
    || defined(__DragonFly__) \
    || defined(USAGI_LIBINET6)
#ifndef NO_IPV6
#define HAS_IPV6
#define HAVE_GETIFADDRS
#endif

#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \
    || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \
    || (defined(OpenBSD) && OpenBSD >= 199700)	/* OpenBSD 2.0?? */ \
    || defined(__DragonFly__)
#define USE_SYSV_POLL
#endif

#ifndef NO_KQUEUE
#if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \
    || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \
    || (defined(OpenBSD) && OpenBSD >= 200105)	/* OpenBSD 2.9 */ \
    || defined(__DragonFly__)
#define EVENTS_STYLE	EVENTS_STYLE_KQUEUE
#endif
#endif

#ifndef NO_POSIX_GETPW_R
#if (defined(__FreeBSD_version) && __FreeBSD_version >= 510000) \
    || (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 300000000) \
    || (defined(OpenBSD) && OpenBSD >= 200811)	/* OpenBSD 4.4 */
#define HAVE_POSIX_GETPW_R
#endif
#endif

#endif

 /*
  * UNIX on MAC.
  */
#if defined(RHAPSODY5) || defined(MACOSX)
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define USE_PATHS_H
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_SUN_LEN
#define HAS_FSYNC
#define HAS_DB
#define HAS_SA_LEN
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#define GETTIMEOFDAY(t) gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
#define USE_STATFS
#define STATFS_IN_SYS_MOUNT_H
#define HAS_POSIX_REGEXP
#ifndef NO_NETINFO
#define HAS_NETINFO
#endif
#ifndef NO_IPV6
#define HAS_IPV6
#define HAVE_GETIFADDRS
#endif
#define HAS_FUTIMES			/* XXX Guessing */
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#ifndef NO_KQUEUE
#define EVENTS_STYLE	EVENTS_STYLE_KQUEUE
#define USE_SYSV_POLL_THEN_SELECT
#endif
#define USE_MAX_FILES_PER_PROC
#ifndef NO_POSIX_GETPW_R
#define HAVE_POSIX_GETPW_R
#endif
#define HAS_DLOPEN
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"
#endif

 /*
  * Ultrix 4.x, a sort of 4.[1-2] BSD system with System V.2 compatibility
  * and POSIX.
  */
#ifdef ULTRIX4
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
/* Ultrix by default has only 64 descriptors per process */
#ifndef FD_SETSIZE
#define FD_SETSIZE	96
#endif
#define _PATH_MAILDIR	"/var/spool/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/bin:/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/bin:/usr/bin:/usr/etc:/usr/ucb"
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_FSYNC
/* might be set by makedef */
#ifdef HAS_DB
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#else
#define HAS_DBM
#define	NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#endif
extern int optind;
extern char *optarg;
extern int opterr;
extern int h_errno;

#define MISSING_STRFTIME_E
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
#define USE_STATFS
#define USE_STRUCT_FS_DATA
#define STATFS_IN_SYS_MOUNT_H
/* Ultrix misses just S_ISSOCK, the others are there */
#define S_ISSOCK(mode)	(((mode) & (S_IFMT)) == (S_IFSOCK))
#define DUP2_DUPS_CLOSE_ON_EXEC
#define MISSING_USLEEP
#define NO_HERRNO
#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
#define NATIVE_COMMAND_DIR "/usr/etc"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#endif

 /*
  * OSF, then Digital UNIX, then Compaq. A BSD-flavored hybrid.
  */
#ifdef OSF1
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define USE_PATHS_H
#define _PATH_DEFPATH "/usr/bin:/usr/ucb"
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_FSYNC
#define HAVE_BASENAME
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/var/adm/sendmail/aliases"
extern int optind;			/* XXX use <getopt.h> */
extern char *optarg;			/* XXX use <getopt.h> */
extern int opterr;			/* XXX use <getopt.h> */

#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define USE_STATFS
#define STATFS_IN_SYS_MOUNT_H
#define HAS_POSIX_REGEXP
#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
#define NO_MSGHDR_MSG_CONTROL
#ifndef NO_IPV6
#define HAS_IPV6
#endif

#endif

 /*
  * SunOS 4.x, a mostly 4.[2-3] BSD system with System V.2 compatibility and
  * POSIX support.
  */
#ifdef SUNOS4
#define SUPPORTED
#include <memory.h>
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define UNSAFE_CTYPE
#define fpos_t	long
#define MISSING_SETENV
#define MISSING_STRERROR
#define MISSING_STRTOUL
#define _PATH_MAILDIR	"/var/spool/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/etc:/usr/ucb"
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
extern int optind;
extern char *optarg;
extern int opterr;

#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/etc:/usr/etc:/usr/ucb"
#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define memmove(d,s,l)	bcopy(s,d,l)
#define NO_HERRNO
#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
#define NATIVE_MAILQ_PATH "/usr/ucb/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/ucb/newaliases"
#define NATIVE_COMMAND_DIR "/usr/etc"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#define STRCASECMP_IN_STRINGS_H
#define OCTAL_TO_UNSIGNED(res, str) sscanf((str), "%o", &(res))
#define size_t	unsigned
#define ssize_t	int
#define getsid	getpgrp
#define NO_SNPRINTF
#endif

 /*
  * SunOS 5.x, mostly System V Release 4.
  */
#ifdef SUNOS5
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/mail/aliases"
#ifndef NO_NIS
#define HAS_NIS
#ifndef NO_NISPLUS
#define HAS_NISPLUS
#endif					/* NO_NISPLUS */
#endif
#define USE_SYS_SOCKIO_H		/* Solaris 2.5, changed sys/ioctl.h */
#define GETTIMEOFDAY(t)	gettimeofday(t)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define FIONREAD_IN_SYS_FILIO_H
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define INT_MAX_IN_LIMITS_H
#ifdef STREAM_CONNECTIONS		/* avoid UNIX-domain sockets */
#define LOCAL_LISTEN	stream_listen
#define LOCAL_ACCEPT	stream_accept
#define LOCAL_CONNECT	stream_connect
#define LOCAL_TRIGGER	stream_trigger
#define LOCAL_SEND_FD	stream_send_fd
#define LOCAL_RECV_FD	stream_recv_fd
#endif
#define HAS_VOLATILE_LOCKS
#define BROKEN_READ_SELECT_ON_TCP_SOCKET
#define CANT_WRITE_BEFORE_SENDING_FD
#ifndef NO_POSIX_REGEXP
#define HAS_POSIX_REGEXP
#endif
#ifndef NO_IPV6
#define HAS_IPV6
#define HAS_SIOCGLIF
#endif
#ifndef NO_CLOSEFROM
#define HAS_CLOSEFROM
#endif
#ifndef NO_DEV_URANDOM
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"
#endif
#ifndef NO_FUTIMESAT
#define HAS_FUTIMESAT
#endif
#define USE_SYSV_POLL
#ifndef NO_DEVPOLL
#define EVENTS_STYLE	EVENTS_STYLE_DEVPOLL
#endif
#ifndef NO_POSIX_GETPW_R
#define HAVE_POSIX_GETPW_R
#define GETPW_R_NEEDS_POSIX_PTHREAD_SEMANTICS
#endif

/*
 * Allow build environment to override paths.
 */
#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"

#define HAS_DLOPEN
#endif

 /*
  * UnixWare, System Release 4.
  */
#ifdef UW7				/* UnixWare 7 */
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#define MISSING_SETENV
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/mail/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define USE_SYS_SOCKIO_H
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define FIONREAD_IN_SYS_FILIO_H
#define DBM_NO_TRAILING_NULL
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define STRCASECMP_IN_STRINGS_H
#define USE_SET_H_ERRNO
#endif

#ifdef UW21				/* UnixWare 2.1.x */
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define _PATH_MAILDIR   "/var/mail"
#define _PATH_BSHELL    "/bin/sh"
#define _PATH_DEFPATH   "/usr/bin:/usr/ucb"
#define _PATH_STDPATH   "/usr/bin:/usr/sbin:/usr/ucb"
#define MISSING_SETENV
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE     "dbm"
#define ALIAS_DB_MAP    DEF_DB_TYPE ":/etc/mail/aliases"
#ifndef NO_NIS
#define HAS_NIS */
#endif
#define USE_SYS_SOCKIO_H
#define GETTIMEOFDAY(t) gettimeofday(t,NULL)
#define ROOT_PATH       "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define FIONREAD_IN_SYS_FILIO_H
#define DBM_NO_TRAILING_NULL
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#endif

 /*
  * AIX: a SYSV-flavored hybrid. NB: fcntl() and flock() access the same
  * underlying locking primitives.
  */
#if defined(AIX5) || defined(AIX6)
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define USE_PATHS_H
#ifndef _PATH_BSHELL
#define _PATH_BSHELL	"/bin/sh"
#endif
#ifndef _PATH_MAILDIR
#define _PATH_MAILDIR   "/var/spool/mail"	/* paths.h lies */
#endif
#ifndef _PATH_DEFPATH
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#endif
#ifndef _PATH_STDPATH
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#endif
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define USE_SYS_SELECT_H
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define HAS_SA_LEN
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/sbin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"

 /*
  * XXX Need CMSG_SPACE() and CMSG_LEN() but don't want to drag in everything
  * that comes with _LINUX_SOURCE_COMPAT.
  */
#include <sys/socket.h>
#ifndef CMSG_SPACE
#define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
#endif
#ifndef CMSG_LEN
#define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif
#ifndef NO_IPV6
#define HAS_IPV6
#endif
#define BROKEN_AI_PASSIVE_NULL_HOST
#define BROKEN_AI_NULL_SERVICE
#define USE_SYSV_POLL
#define MYMALLOC_FUZZ	1
#endif

#ifdef AIX4
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR   "/var/spool/mail"	/* paths.h lies */
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define USE_SYS_SELECT_H
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define HAS_SA_LEN
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define RESOLVE_H_NEEDS_STDIO_H
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define SOCKADDR_SIZE	size_t
#define SOCKOPT_SIZE	size_t
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define STRCASECMP_IN_STRINGS_H
#if 0
extern time_t time(time_t *);
extern int seteuid(uid_t);
extern int setegid(gid_t);
extern int initgroups(const char *, int);

#endif
#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"
#define NATIVE_MAILQ_PATH "/usr/sbin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/sbin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"

#define CANT_USE_SEND_RECV_MSG
#endif

#ifdef AIX3
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR   "/var/spool/mail"	/* paths.h lies */
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define USE_SYS_SELECT_H
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define HAS_SA_LEN
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define RESOLVE_H_NEEDS_STDIO_H
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define SOCKADDR_SIZE	size_t
#define SOCKOPT_SIZE	size_t
#define USE_STATFS
#define STATFS_IN_SYS_STATFS_H
#define STRCASECMP_IN_STRINGS_H
extern time_t time(time_t *);
extern int seteuid(uid_t);
extern int setegid(gid_t);
extern int initgroups(const char *, int);

#define NATIVE_SENDMAIL_PATH "/usr/lib/sendmail"

#define CANT_USE_SEND_RECV_MSG
#endif

 /*
  * IRIX, a mix of System V Releases.
  */
#if defined(IRIX5) || defined(IRIX6)
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/usr/bin:/usr/bsd"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/bsd"
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define USE_SYS_SOCKIO_H		/* XXX check */
#define GETTIMEOFDAY(t)	gettimeofday(t)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/bsd"
#define FIONREAD_IN_SYS_FILIO_H		/* XXX check */
#define DBM_NO_TRAILING_NULL		/* XXX check */
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE
#define CANT_USE_SEND_RECV_MSG
#endif

#if defined(IRIX5)
#define MISSING_USLEEP
#endif

#if defined(IRIX6)
#ifndef NO_IPV6
#define HAS_IPV6
#endif
#define HAS_POSIX_REGEXP
#define PIPES_CANT_FIONREAD
#endif

 /*
  * LINUX.
  */
#if defined(LINUX2) || defined(LINUX3) || defined(LINUX4) || defined(LINUX5) \
	|| defined(LINUX6)
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#include <features.h>
#define USE_PATHS_H
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "fcntl, dotlock"	/* RedHat >= 4.x */
#define HAS_FSYNC
#define HAS_DB
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
#define FIONREAD_IN_TERMIOS_H
#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define PREPEND_PLUS_TO_OPTSTRING
#define HAS_POSIX_REGEXP
#define HAS_DLOPEN
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#ifdef __GLIBC_PREREQ
#define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) __GLIBC_PREREQ(maj, min)
#else
#define HAVE_GLIBC_API_VERSION_SUPPORT(maj, min) \
    (defined(__GLIBC__) && \
	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)))
#endif
#if HAVE_GLIBC_API_VERSION_SUPPORT(2, 1)
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#else
#define NO_SNPRINTF
#endif
#ifndef NO_IPV6
#define HAS_IPV6
#if HAVE_GLIBC_API_VERSION_SUPPORT(2, 4)
/* Really 2.3.3 or later, but there's no __GLIBC_MICRO version macro. */
#define HAVE_GETIFADDRS
#else
#define HAS_PROCNET_IFINET6
#define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
#endif
#endif
#include <linux/version.h>
#if !defined(KERNEL_VERSION)
#define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \
	|| (defined(__GLIBC__) && __GLIBC__ < 2)
#define CANT_USE_SEND_RECV_MSG
#define DEF_SMTP_CACHE_DEMAND	0
#else
#define CANT_WRITE_BEFORE_SENDING_FD
#endif
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"	/* introduced in 1.1 */
#ifndef NO_EPOLL
#define EVENTS_STYLE	EVENTS_STYLE_EPOLL	/* introduced in 2.5 */
#endif
#define USE_SYSV_POLL
#ifndef NO_POSIX_GETPW_R
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1) \
	|| (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 1) \
	|| (defined(_BSD_SOURCE) && _BSD_SOURCE >= 1) \
	|| (defined(_SVID_SOURCE) && _SVID_SOURCE >= 1) \
	|| (defined(_POSIX_SOURCE) && _POSIX_SOURCE >= 1)
#define HAVE_POSIX_GETPW_R
#endif
#endif
#if HAVE_GLIBC_API_VERSION_SUPPORT(2, 34)
#define HAS_CLOSEFROM
#endif

#endif

#ifdef LINUX1
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define USE_PATHS_H
#define HAS_FLOCK_LOCK
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "dotlock"	/* verified RedHat 3.03 */
#define HAS_FSYNC
#define HAS_DB
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
#define FIONREAD_IN_TERMIOS_H		/* maybe unnecessary */
#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define PREPEND_PLUS_TO_OPTSTRING
#define HAS_POSIX_REGEXP
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#define CANT_USE_SEND_RECV_MSG
#define DEF_SMTP_CACHE_DEMAND	0
#endif

 /*
  * GNU.
  */
#ifdef GNU0
#define SUPPORTED
#include <features.h>
#define USE_PATHS_H
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"	/* RedHat >= 4.x */
#define HAS_FSYNC
#define HAS_DB
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin"
#define FIONREAD_IN_TERMIOS_H
#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define UNIX_DOMAIN_CONNECT_BLOCKS_FOR_ACCEPT
#define PREPEND_PLUS_TO_OPTSTRING
#define HAS_POSIX_REGEXP
#define HAS_DLOPEN
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#ifdef DEBIAN
#define NATIVE_DAEMON_DIR	"/usr/lib/postfix"
#ifndef DEF_MANPAGE_DIR
#define DEF_MANPAGE_DIR		"/usr/share/man"
#endif
#ifndef DEF_SAMPLE_DIR
#define DEF_SAMPLE_DIR		"/usr/share/doc/postfix/examples"
#endif
#ifndef DEF_README_DIR
#define DEF_README_DIR		"/usr/share/doc/postfix"
#endif
#else
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#endif
#define SOCKADDR_SIZE	socklen_t
#define SOCKOPT_SIZE	socklen_t
#ifdef __FreeBSD_kernel__
#define HAS_DUPLEX_PIPE
#define HAS_ISSETUGID
#endif
#ifndef NO_IPV6
#define HAS_IPV6
#ifdef __FreeBSD_kernel__
#define HAVE_GETIFADDRS
#else
#define HAS_PROCNET_IFINET6
#define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
#endif
#endif
#define CANT_USE_SEND_RECV_MSG
#define DEF_SMTP_CACHE_DEMAND	0
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"
#endif

 /*
  * HPUX11 was copied from HPUX10, but can perhaps be trimmed down a bit.
  */
#ifdef HPUX11
#define SUPPORTED
#define USE_SIG_RETURN
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define HAS_DBM
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/mail/aliases"
#define ROOT_PATH	"/usr/bin:/sbin:/usr/sbin"
#define MISSING_SETENV
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_DEFPATH	"/usr/bin"
#define _PATH_STDPATH	"/usr/bin:/sbin:/usr/sbin"
#define MISSING_SETEUID
#define HAVE_SETRESUID
#define MISSING_SETEGID
#define HAVE_SETRESGID
extern int h_errno;			/* <netdb.h> imports too much stuff */

#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define HAS_POSIX_REGEXP
#define HAS_DLOPEN
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#endif

#ifdef HPUX10
#define SUPPORTED
#define USE_SIG_RETURN
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define HAS_DBM
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/mail/aliases"
#define ROOT_PATH	"/usr/bin:/sbin:/usr/sbin"
#define MISSING_SETENV
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_DEFPATH	"/usr/bin"
#define _PATH_STDPATH	"/usr/bin:/sbin:/usr/sbin"
#define MISSING_SETEUID
#define HAVE_SETRESUID
#define MISSING_SETEGID
#define HAVE_SETRESGID
extern int h_errno;			/* <netdb.h> imports too much stuff */

#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define HAS_POSIX_REGEXP
#define HAS_SHL_LOAD
#define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_COMMAND_DIR "/usr/sbin"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#endif

#ifdef HPUX9
#define SUPPORTED
#define USE_SIG_RETURN
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define HAS_DBM
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#ifndef NO_NIS
#define HAS_NIS
#endif
#define MISSING_SETENV
#define MISSING_RLIMIT_FSIZE
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/usr/lib/aliases"
#define ROOT_PATH	"/bin:/usr/bin:/etc"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR	"/usr/mail"
#define _PATH_DEFPATH	"/bin:/usr/bin"
#define _PATH_STDPATH	"/bin:/usr/bin:/etc"
#define MISSING_SETEUID
#define HAVE_SETRESUID
#define MISSING_SETEGID
#define HAVE_SETRESGID
extern int h_errno;

#define USE_ULIMIT			/* no setrlimit() */
#define USE_STATFS
#define STATFS_IN_SYS_VFS_H
#define HAS_POSIX_REGEXP
#define HAS_SHL_LOAD
#define NATIVE_SENDMAIL_PATH "/usr/bin/sendmail"
#define NATIVE_MAILQ_PATH "/usr/bin/mailq"
#define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
#define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
#endif

 /*
  * NEXTSTEP3, without -lposix, because its naming service is broken.
  */
#ifdef NEXTSTEP3
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define HAS_DBM
#define HAS_FLOCK_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define USE_STATFS
#define HAVE_SYS_DIR_H
#define STATFS_IN_SYS_VFS_H
#define HAS_FSYNC
#ifndef NO_NIS
#define HAS_NIS
#endif
#define HAS_NETINFO
#define MISSING_SETENV_PUTENV
#define MISSING_MKFIFO
#define MISSING_SIGSET_T
#define MISSING_SIGACTION
#define MISSING_STD_FILENOS
#define MISSING_SETSID
#define MISSING_WAITPID
#define MISSING_UTIMBUF
#define HAS_WAIT4
#define WAIT_STATUS_T union wait
#define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define _PATH_MAILDIR	"/usr/spool/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/bin:/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/bin:/usr/bin:/usr/ucb"
#define ROOT_PATH	"/bin:/usr/bin:/usr/etc:/usr/ucb"
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	"netinfo:/aliases"
#include <libc.h>
#define MISSING_POSIX_S_IS
#define MISSING_POSIX_S_MODES
/* It's amazing what is all missing...	*/
#define isascii(c)	((unsigned)(c)<=0177)
extern int opterr;
typedef unsigned short mode_t;

#define MISSING_PID_T
#define MISSING_STRFTIME_E
#define FD_CLOEXEC	1
#define O_NONBLOCK	O_NDELAY
#define WEXITSTATUS(x)	((x).w_retcode)
#define WTERMSIG(x)	((x).w_termsig)
#endif

 /*
  * OPENSTEP does not have posix (some fix...)
  */
#ifdef OPENSTEP4
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define HAS_DBM
#define HAS_FLOCK_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define USE_STATFS
#define HAVE_SYS_DIR_H
#define STATFS_IN_SYS_VFS_H
#define HAS_FSYNC
#ifndef NO_NIS
#define HAS_NIS
#endif
#define HAS_NETINFO
#define MISSING_SETENV_PUTENV
#define MISSING_MKFIFO
#define MISSING_SIGSET_T
#define MISSING_SIGACTION
#define MISSING_STD_FILENOS
#define MISSING_SETSID
#define MISSING_WAITPID
#define MISSING_UTIMBUF
#define HAS_WAIT4
#define WAIT_STATUS_T union wait
#define NORMAL_EXIT_STATUS(x) (WIFEXITED(x) && !WEXITSTATUS (x))
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define _PATH_MAILDIR	"/usr/spool/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/bin:/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/bin:/usr/bin:/usr/ucb"
#define ROOT_PATH	"/bin:/usr/bin:/usr/etc:/usr/ucb"
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	"netinfo:/aliases"
#include <libc.h>
#define MISSING_POSIX_S_IS
#define MISSING_POSIX_S_MODES
/* It's amazing what is all missing...	*/
#define isascii(c)	((unsigned)(c)<=0177)
extern int opterr;
typedef unsigned short mode_t;

#define MISSING_PID_T
#define MISSING_STRFTIME_E
#define FD_CLOEXEC	1
#define O_NONBLOCK	O_NDELAY
#define WEXITSTATUS(x)	((x).w_retcode)
#define WTERMSIG(x)	((x).w_termsig)
#endif

#ifdef ReliantUnix543
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define MISSING_SETENV
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_MAILDIR	"/var/spool/mail"
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define FIONREAD_IN_SYS_FILIO_H
#define USE_SYS_SOCKIO_H
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/var/adm/sendmail/aliases"
extern int optind;			/* XXX use <getopt.h> */
extern char *optarg;			/* XXX use <getopt.h> */
extern int opterr;			/* XXX use <getopt.h> */

#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t) gettimeofday(t)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define MISSING_USLEEP
#endif

#ifdef DCOSX1				/* Siemens Pyramid */
#define SUPPORTED
#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define _PATH_MAILDIR	"/var/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/usr/bin:/usr/ucb"
#define _PATH_STDPATH	"/usr/bin:/usr/sbin:/usr/ucb"
#define MISSING_SETENV
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define NATIVE_DB_TYPE	"hash"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/aliases"
/* Uncomment the following line if you have NIS package installed */
/* #define HAS_NIS */
#define USE_SYS_SOCKIO_H
#define GETTIMEOFDAY(t) gettimeofday(t,NULL)
#define ROOT_PATH	"/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
#define FIONREAD_IN_SYS_FILIO_H
#define DBM_NO_TRAILING_NULL
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#ifndef S_ISSOCK
#define S_ISSOCK(mode)	((mode&0xF000) == 0xC000)
#endif
#endif

#ifdef SCO5
#define SUPPORTED
#include <sys/socket.h>
extern int h_errno;

#define UINT32_TYPE	unsigned int
#define UINT16_TYPE	unsigned short
#define _PATH_MAILDIR	"/usr/spool/mail"
#define _PATH_BSHELL	"/bin/sh"
#define _PATH_DEFPATH	"/bin:/usr/bin"
#define USE_PATHS_H
#define HAS_FCNTL_LOCK
#define INTERNAL_LOCK	MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock"
#define HAS_FSYNC
#define HAS_DBM
#define NATIVE_DB_TYPE	"dbm"
#define ALIAS_DB_MAP	DEF_DB_TYPE ":/etc/mail/aliases"
#define DBM_NO_TRAILING_NULL
#ifndef NO_NIS
#define HAS_NIS
#endif
#define GETTIMEOFDAY(t)	gettimeofday(t,(struct timezone *) 0)
#define ROOT_PATH	"/bin:/etc:/usr/bin:/tcb/bin"
#define USE_STATVFS
#define STATVFS_IN_SYS_STATVFS_H
#define MISSING_SETENV
#define STRCASECMP_IN_STRINGS_H
/* SCO5 misses just S_ISSOCK, the others are there
 * Use C_ISSOCK definition from cpio.h.
 */
#include <cpio.h>
#define S_ISSOCK(mode)	(((mode) & (S_IFMT)) == (C_ISSOCK))
#define CANT_USE_SEND_RECV_MSG
#define DEF_SMTP_CACHE_DEMAND	0
#endif

 /*
  * We're not going to try to guess like configure does.
  */
#ifndef SUPPORTED
#error "unsupported platform"
#endif

 /*
  * Allow command line flags to override native settings
  */
#ifndef DEF_COMMAND_DIR
#ifdef NATIVE_COMMAND_DIR
#define DEF_COMMAND_DIR NATIVE_COMMAND_DIR
#endif
#endif

#ifndef DEF_DAEMON_DIR
#ifdef NATIVE_DAEMON_DIR
#define DEF_DAEMON_DIR NATIVE_DAEMON_DIR
#endif
#endif

#ifndef DEF_SENDMAIL_PATH
#ifdef NATIVE_SENDMAIL_PATH
#define DEF_SENDMAIL_PATH NATIVE_SENDMAIL_PATH
#endif
#endif

#ifndef DEF_MAILQ_PATH
#ifdef NATIVE_MAILQ_PATH
#define DEF_MAILQ_PATH NATIVE_MAILQ_PATH
#endif
#endif

#ifndef DEF_NEWALIAS_PATH
#ifdef NATIVE_NEWALIAS_PATH
#define DEF_NEWALIAS_PATH NATIVE_NEWALIAS_PATH
#endif
#endif

#ifndef DEF_DB_TYPE
#define DEF_DB_TYPE	NATIVE_DB_TYPE
#endif

#define CAST_ANY_PTR_TO_INT(cptr)	((int) (long) (cptr))
#define CAST_INT_TO_VOID_PTR(ival)	((void *) (long) (ival))

#ifdef DUP2_DUPS_CLOSE_ON_EXEC
/* dup2_pass_on_exec() can be found in util/sys_compat.c */
extern int dup2_pass_on_exec(int oldd, int newd);

#define DUP2 dup2_pass_on_exec
#else
#define DUP2 dup2
#endif

#ifdef PREPEND_PLUS_TO_OPTSTRING
#define GETOPT(argc, argv, str)	getopt((argc), (argv), "+" str)
#else
#define GETOPT(argc, argv, str) getopt((argc), (argv), (str))
#endif
#define OPTIND  (optind > 0 ? optind : 1)

#if !defined(__UCLIBC__) && !defined(NO_RES_SEND)
#define HAVE_RES_SEND
#else
#undef HAVE_RES_SEND
#endif

 /*
  * Check for required but missing definitions.
  */
#if !defined(HAS_FCNTL_LOCK) && !defined(HAS_FLOCK_LOCK)
#error "define HAS_FCNTL_LOCK and/or HAS_FLOCK_LOCK"
#endif

#if !defined(DEF_MAILBOX_LOCK)
#error "define DEF_MAILBOX_LOCK"
#endif

#if !defined(INTERNAL_LOCK)
#error "define INTERNAL_LOCK"
#endif

#if defined(USE_STATFS) && defined(USE_STATVFS)
#error "define USE_STATFS or USE_STATVFS, not both"
#endif

#if !defined(USE_STATFS) && !defined(USE_STATVFS)
#error "define USE_STATFS or USE_STATVFS"
#endif

 /*
  * Defaults for systems that pre-date IPv6 support.
  */
#ifndef HAS_IPV6
#include <sys/socket.h>
#define EMULATE_IPV4_ADDRINFO
#define MISSING_INET_PTON
#define MISSING_INET_NTOP
extern const char *inet_ntop(int, const void *, char *, SOCKADDR_SIZE);
extern int inet_pton(int, const char *, void *);

#endif

 /*
  * Workaround: after a watchdog alarm signal, wake up from select/poll/etc.
  * by writing to a pipe. Solaris needs this, and HP-UX apparently, too. The
  * run-time cost is negligible so we just turn it on for all systems. As a
  * side benefit, making this code system-independent will simplify the
  * detection of bit-rot problems.
  */
#ifndef NO_WATCHDOG_PIPE
#define USE_WATCHDOG_PIPE
#endif

 /*
  * If we don't have defined a preferred random device above, but the system
  * has /dev/urandom, then we use that.
  */
#if !defined(PREFERRED_RAND_SOURCE) && defined(HAS_DEV_URANDOM)
#define PREFERRED_RAND_SOURCE	"dev:/dev/urandom"
#endif

 /*
  * Defaults for systems without kqueue, /dev/poll or epoll support.
  * master/multi-server.c and *qmgr/qmgr_transport.c depend on this.
  */
#if !defined(EVENTS_STYLE)
#define EVENTS_STYLE	EVENTS_STYLE_SELECT
#endif

#define EVENTS_STYLE_SELECT	1	/* Traditional BSD select */
#define EVENTS_STYLE_KQUEUE	2	/* FreeBSD kqueue */
#define EVENTS_STYLE_DEVPOLL	3	/* Solaris /dev/poll */
#define EVENTS_STYLE_EPOLL	4	/* Linux epoll */

 /*
  * We use poll() for read/write time limit enforcement on modern systems. We
  * use select() on historical systems without poll() support. And on systems
  * where poll() is not implemented for some file handle types, we try to use
  * select() as a fall-back solution (MacOS X needs this).
  */
#if !defined(USE_SYSV_POLL) && !defined(USE_SYSV_POLL_THEN_SELECT)
#define USE_BSD_SELECT
#endif

 /*
  * The Postfix 2.9 post-install workaround assumes that the inet_protocols
  * default value is "ipv4" when Postfix is compiled without IPv6 support.
  */
#ifndef DEF_INET_PROTOCOLS
#ifdef HAS_IPV6
#define DEF_INET_PROTOCOLS	INET_PROTO_NAME_ALL
#else
#define DEF_INET_PROTOCOLS	INET_PROTO_NAME_IPV4
#endif
#endif

 /*
  * Defaults for systems that pre-date POSIX socklen_t.
  */
#ifndef SOCKADDR_SIZE
#define SOCKADDR_SIZE	int
#endif

#ifndef SOCKOPT_SIZE
#define SOCKOPT_SIZE	int
#endif

 /*
  * Defaults for normal systems.
  */
#ifndef LOCAL_LISTEN
#define LOCAL_LISTEN	unix_listen
#define LOCAL_ACCEPT	unix_accept
#define LOCAL_CONNECT	unix_connect
#define LOCAL_TRIGGER	unix_trigger
#define LOCAL_SEND_FD	unix_send_fd
#define LOCAL_RECV_FD	unix_recv_fd
#endif

#if !defined (HAVE_SYS_NDIR_H) && !defined (HAVE_SYS_DIR_H) \
	&& !defined (HAVE_NDIR_H)
#define HAVE_DIRENT_H
#endif

#ifndef WAIT_STATUS_T
typedef int WAIT_STATUS_T;

#define NORMAL_EXIT_STATUS(status)	((status) == 0)
#endif

#ifdef NO_POSIX_GETPW_R
#undef HAVE_POSIX_GETPW_R
#endif

#ifdef NO_DB
#undef HAS_DB
#endif

#ifndef OCTAL_TO_UNSIGNED
#define OCTAL_TO_UNSIGNED(res, str)	((res) = strtoul((str), (char **) 0, 8))
#endif

 /*
  * Avoid useless type mis-matches when using sizeof in an integer context.
  */
#define INT_SIZEOF(foo)	((int) sizeof(foo))

 /*
  * Turn on the compatibility stuff.
  */
#ifdef MISSING_UTIMBUF
struct utimbuf {
    time_t  actime;
    time_t  modtime;
};

#endif

#ifdef MISSING_STRERROR
extern const char *strerror(int);

#endif

#if defined (MISSING_SETENV) || defined (MISSING_SETENV_PUTENV)
extern int setenv(const char *, const char *, int);

#endif

#ifdef MISSING_SETEUID
extern int seteuid(uid_t euid);

#endif

#ifdef MISSING_SETEGID
extern int setegid(gid_t egid);

#endif

#ifdef MISSING_MKFIFO
extern int mkfifo(char *, int);

#endif

#ifdef MISSING_WAITPID
extern int waitpid(int, WAIT_STATUS_T *status, int options);

#endif

#ifdef MISSING_SETSID
extern int setsid(void);

#endif

#ifndef HAS_CLOSEFROM
extern int closefrom(int);

#endif

#ifdef MISSING_STD_FILENOS
#define STDIN_FILENO	0
#define STDOUT_FILENO	1
#define STDERR_FILENO	2
#endif

#ifdef MISSING_PID_T
typedef int pid_t;

#endif

#ifdef MISSING_POSIX_S_IS
#define S_ISBLK(mode)	(((mode) & (_S_IFMT)) == (_S_IFBLK))
#define S_ISCHR(mode)	(((mode) & (_S_IFMT)) == (_S_IFCHR))
#define S_ISDIR(mode)	(((mode) & (_S_IFMT)) == (_S_IFDIR))
#define S_ISSOCK(mode)	(((mode) & (_S_IFMT)) == (_S_IFSOCK))
#define S_ISFIFO(mode)	(((mode) & (_S_IFMT)) == (_S_IFIFO))
#define S_ISREG(mode)	(((mode) & (_S_IFMT)) == (_S_IFREG))
#define S_ISLNK(mode)	(((mode) & (_S_IFMT)) == (_S_IFLNK))
#endif

#ifdef MISSING_POSIX_S_MODES
#define S_IRUSR	_S_IRUSR
#define S_IRGRP	0000040
#define S_IROTH	0000004
#define S_IWUSR	_S_IWUSR
#define S_IWGRP	0000020
#define S_IWOTH	0000002
#define S_IXUSR	_S_IXUSR
#define S_IXGRP	0000010
#define S_IXOTH	0000001
#define	S_IRWXU	(S_IRUSR | S_IWUSR | S_IXUSR)
#endif

 /*
  * Memory alignment of memory allocator results. By default we align for
  * doubles.
  */
#ifndef ALIGN_TYPE
#if defined(__hpux) && defined(__ia64)
#define ALIGN_TYPE	__float80
#elif defined(__ia64__)
#define ALIGN_TYPE	long double
#else
#define ALIGN_TYPE	double
#endif
#endif

 /*
  * Clang-style attribute tests.
  * 
  * XXX Without the unconditional test below, gcc 4.6 will barf on ``elif
  * defined(__clang__) && __has_attribute(__whatever__)'' with error message
  * ``missing binary operator before token "("''.
  */
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif					/* __has_attribute */

 /*
  * Need to specify what functions never return, so that the compiler can
  * warn for missing initializations and other trouble. However, OPENSTEP4
  * gcc 2.7.x cannot handle this so we define this only if NORETURN isn't
  * already defined above.
  * 
  * Data point: gcc 2.7.2 has __attribute__ (Wietse Venema) but gcc 2.6.3 does
  * not (Clive Jones). So we'll set the threshold at 2.7.
  */
#ifndef NORETURN
#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
#define NORETURN	void __attribute__((__noreturn__))
#elif defined(__clang__) && __has_attribute(__noreturn__)
#define NORETURN	void __attribute__((__noreturn__))
#else
#define NORETURN	void
#endif
#endif					/* NORETURN */

 /*
  * Turn on format string argument checking. This is more accurate than
  * printfck, but it misses #ifdef-ed code. XXX I am just guessing at what
  * gcc versions support this. In order to turn this off for some platforms,
  * specify #define PRINTFLIKE and #define SCANFLIKE in the system-dependent
  * sections above.
  */
#ifndef PRINTFLIKE
#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
#define PRINTFLIKE(x,y) __attribute__ ((format (printf, (x), (y))))
#elif defined(__clang__) && __has_attribute(__format__)
#define PRINTFLIKE(x,y)	__attribute__ ((__format__ (__printf__, (x), (y))))
#else
#define PRINTFLIKE(x,y)
#endif
#endif					/* PRINTFLIKE */

#ifndef SCANFLIKE
#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
#define SCANFLIKE(x,y) __attribute__ ((format (scanf, (x), (y))))
#elif defined(__clang__) && __has_attribute(__format__)
#define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, (x), (y))))
#else
#define SCANFLIKE(x,y)
#endif
#endif					/* SCANFLIKE */

 /*
  * Some gcc implementations don't grok these attributes with pointer to
  * function. Again, wild guess of what is supported. To override, specify
  * #define PRINTFPTRLIKE  in the system-dependent sections above.
  */
#ifndef PRINTFPTRLIKE
#if (__GNUC__ >= 3)			/* XXX Rough estimate */
#define PRINTFPTRLIKE(x,y) PRINTFLIKE(x,y)
#elif defined(__clang__) && __has_attribute(__format__)
#define PRINTFPTRLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y))))
#else
#define PRINTFPTRLIKE(x,y)
#endif
#endif

 /*
  * Compiler optimization hint. This makes sense only for code in a
  * performance-critical loop.
  */
#ifndef EXPECTED
#if defined(__GNUC__) && (__GNUC__ > 2)
#define EXPECTED(x)	__builtin_expect(!!(x), 1)
#define UNEXPECTED(x)	__builtin_expect(!!(x), 0)
#else
#define EXPECTED(x)	(x)
#define UNEXPECTED(x)	(x)
#endif
#endif

 /*
  * Warn about ignored function result values that must never be ignored.
  * Typically, this is for error results from "read" functions that normally
  * write to output parameters (for example, stat- or scanf-like functions)
  * or from functions that have other useful side effects (for example,
  * fseek- or rename-like functions).
  * 
  * DO NOT use this for functions that write to a stream; it is entirely
  * legitimate to detect write errors with fflush() or fclose() only. On the
  * other hand most (but not all) functions that read from a stream must
  * never ignore result values.
  * 
  * XXX Prepending "(void)" won't shut up GCC. Clang behaves as expected.
  */
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ > 3)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#elif defined(__clang__) && __has_attribute(warn_unused_result)
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define WARN_UNUSED_RESULT
#endif

 /*
  * ISO C says that the "volatile" qualifier protects against optimizations
  * that cause longjmp() to clobber local variables.
  */
#ifndef NOCLOBBER
#define NOCLOBBER volatile
#endif

 /*
  * Bit banging!! There is no official constant that defines the INT_MAX
  * equivalent for off_t, ssize_t, etc. Wietse came up with the following
  * macro that works as long as off_t, ssize_t, etc. use one's or two's
  * complement logic (that is, the maximum value is binary 01...1). Don't use
  * right-shift for signed types: the result is implementation-defined.
  */
#include <limits.h>
#define __MAXINT__(T) ((T) ~(((T) 1) << ((sizeof(T) * CHAR_BIT) - 1)))
#ifndef OFF_T_MAX
#define OFF_T_MAX __MAXINT__(off_t)
#endif

#ifndef SSIZE_T_MAX
#define SSIZE_T_MAX __MAXINT__(ssize_t)
#endif

 /*
  * Consistent enforcement of size limits.
  */
#define ENFORCING_SIZE_LIMIT(param)	((param) > 0)

 /*
  * Don't mix socket message send/receive calls with socket stream read/write
  * calls. The fact that you can get away with it only on some stacks implies
  * that there is no long-term guarantee.
  */
#ifndef CAN_WRITE_BEFORE_SENDING_FD
#define CANT_WRITE_BEFORE_SENDING_FD
#endif

 /*
  * FreeBSD sendmsg(2) says that after sending a file descriptor, the sender
  * must not immediately close the descriptor, otherwise it may close the
  * descriptor before it is actually sent.
  */
#ifndef DONT_WAIT_AFTER_SENDING_FD
#define MUST_READ_AFTER_SENDING_FD
#endif

 /*
  * Hope for the best.
  */
#ifndef UINT32_TYPE
#define	UINT32_TYPE uint32_t
#define UINT16_TYPE uint16_t
#endif
#define UINT32_SIZE	4
#define UINT16_SIZE	2

 /*
  * For the sake of clarity.
  */
#ifndef HAVE_CONST_CHAR_STAR
typedef const char *CONST_CHAR_STAR;

#endif

 /*
  * Safety. On some systems, ctype.h misbehaves with non-ASCII or negative
  * characters. More importantly, Postfix uses the ISXXX() macros to ensure
  * protocol compliance, so we have to rule out non-ASCII characters.
  * 
  * XXX The (unsigned char) casts in isalnum() etc arguments are unnecessary
  * because the ISASCII() guard already ensures that the values are
  * non-negative; the casts are done anyway to shut up chatty compilers.
  */
#define ISASCII(c)	isascii(_UCHAR_(c))
#define _UCHAR_(c)	((unsigned char)(c))
#define ISALNUM(c)	(ISASCII(c) && isalnum((unsigned char)(c)))
#define ISALPHA(c)	(ISASCII(c) && isalpha((unsigned char)(c)))
#define ISCNTRL(c)	(ISASCII(c) && iscntrl((unsigned char)(c)))
#define ISDIGIT(c)	(ISASCII(c) && isdigit((unsigned char)(c)))
#define ISGRAPH(c)	(ISASCII(c) && isgraph((unsigned char)(c)))
#define ISLOWER(c)	(ISASCII(c) && islower((unsigned char)(c)))
#define ISPRINT(c)	(ISASCII(c) && isprint((unsigned char)(c)))
#define ISPUNCT(c)	(ISASCII(c) && ispunct((unsigned char)(c)))
#define ISSPACE(c)	(ISASCII(c) && isspace((unsigned char)(c)))
#define ISUPPER(c)	(ISASCII(c) && isupper((unsigned char)(c)))
#define TOLOWER(c)	(ISUPPER(c) ? tolower((unsigned char)(c)) : (c))
#define TOUPPER(c)	(ISLOWER(c) ? toupper((unsigned char)(c)) : (c))

 /*
  * Character sets for parsing.
  */
#define CHARS_COMMA_SP	", \t\r\n"	/* list separator */
#define CHARS_SPACE	" \t\r\n"	/* word separator */
#define CHARS_BRACE	"{}"		/* grouping */

 /*
  * Scaffolding. I don't want to lose messages while the program is under
  * development.
  */
extern int REMOVE(const char *);

/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*
/*	Wietse Venema
/*	Google, Inc.
/*	111 8th Avenue
/*	New York, NY 10011, USA
/*--*/

#endif