summaryrefslogtreecommitdiffstats
path: root/contrib/amd/include/am_defs.h
blob: f3767f5b905e9ca34dcbc04bd36cbdae2147b9e4 (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
/*
 * Copyright (c) 1997-2006 Erez Zadok
 * Copyright (c) 1990 Jan-Simon Pendry
 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Jan-Simon Pendry at Imperial College, London.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgment:
 *      This product includes software developed by the University of
 *      California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *
 * File: am-utils/include/am_defs.h
 * $Id: am_defs.h,v 1.15.2.16 2004/05/12 15:54:31 ezk Exp $
 * $FreeBSD$
 *
 */

/*
 * Definitions that are not specific to the am-utils package, but
 * are rather generic, and can be used elsewhere.
 */

#ifndef _AM_DEFS_H
#define _AM_DEFS_H

/*
 * Actions to take if ANSI C.
 */
#if STDC_HEADERS
# include <string.h>
/* for function prototypes */
# define P(x) x
# define P_void void
#else /* not STDC_HEADERS */
/* empty function prototypes */
# define P(x) ()
# define P_void
# ifndef HAVE_STRCHR
#  define strchr index
#  define strrchr rindex
# endif /* not HAVE_STRCHR */
char *strchr(), *strrchr(), *strdup();
#endif /* not STDC_HEADERS */

/*
 * Handle gcc __attribute__ if available.
 */
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later.  */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
#  define __attribute__(Spec) /* empty */
# endif /* __GNUC__ < 2 ... */
/*
 * The __-protected variants of `format' and `printf' attributes
 * are accepted by gcc versions 2.6.4 (effectively 2.7) and later.
 */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
#  define __format__ format
#  define __printf__ printf
# endif /* __GNUC__ < 2 ... */
#endif /* not __attribute__ */

/*
 * How to handle signals of any type
 */
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif /* not WEXITSTATUS */
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif /* not WIFEXITED */

/*
 * Actions to take regarding <time.h> and <sys/time.h>.
 */
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# ifdef _ALL_SOURCE
/*
 * AIX 5.2 needs struct sigevent from signal.h to be defined, but I
 * don't want to move the inclusion of signal.h this early into this
 * file.  Luckily, amd doesn't need the size of this structure in any
 * other structure that it uses.  So we sidestep it for now.
 */
struct sigevent;
# endif /* _ALL_SOURCE */
# include <time.h>
#else /* not TIME_WITH_SYS_TIME */
# if HAVE_SYS_TIME_H
#  include <sys/time.h>
# else /* not HAVE_SYS_TIME_H */
#  include <time.h>
# endif /* not HAVE_SYS_TIME_H */
#endif /* not TIME_WITH_SYS_TIME */

/*
 * Actions to take if <machine/endian.h> exists.
 */
#ifdef HAVE_MACHINE_ENDIAN_H
# include <machine/endian.h>
#endif /* HAVE_MACHINE_ENDIAN_H */

/*
 * Big-endian or little-endian?
 */
#ifdef WORDS_BIGENDIAN
# define ARCH_ENDIAN "big"
#else /* not WORDS_BIGENDIAN */
# define ARCH_ENDIAN "little"
#endif /* not WORDS_BIGENDIAN */

/*
 * Actions to take if HAVE_SYS_TYPES_H is defined.
 */
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */

/*
 * Actions to take if HAVE_LIMITS_H is defined.
 */
#if HAVE_LIMITS_H_H
# include <limits.h>
#endif /* HAVE_LIMITS_H */

/*
 * Actions to take if HAVE_UNISTD_H is defined.
 */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */

/* after <unistd.h>, check if this is a POSIX.1 system */
#ifdef _POSIX_VERSION
/* Code for POSIX.1 systems. */
#endif /* _POSIX_VERSION */

/*
 * Variable length argument lists.
 * Must use only one of the two!
 */
#ifdef HAVE_STDARG_H
# include <stdarg.h>
/*
 * On Solaris 2.6, <sys/varargs.h> is included in <sys/fs/autofs.h>
 * So this ensures that only one is included.
 */
# ifndef _SYS_VARARGS_H
#  define _SYS_VARARGS_H
# endif /* not _SYS_VARARGS_H */
#else /* not HAVE_STDARG_H */
# ifdef HAVE_VARARGS_H
#  include <varargs.h>
# endif /* HAVE_VARARGS_H */
#endif /* not HAVE_STDARG_H */

/*
 * Pick the right header file and macros for directory processing functions.
 */
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else /* not HAVE_DIRENT_H */
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
#  include <sys/ndir.h>
# endif /* HAVE_SYS_NDIR_H */
# if HAVE_SYS_DIR_H
#  include <sys/dir.h>
# endif /* HAVE_SYS_DIR_H */
# if HAVE_NDIR_H
#  include <ndir.h>
# endif /* HAVE_NDIR_H */
#endif /* not HAVE_DIRENT_H */

/*
 * Actions to take if HAVE_FCNTL_H is defined.
 */
#if HAVE_FCNTL_H
# ifdef HAVE_LINUX_LOOP_H
/* so I can mount large files as loop devices */
/* XXX: need to move these two LARGEFILE defines to a better place */
#  define _LARGEFILE64_SOURCE
#  define __USE_LARGEFILE64
# endif /* HAVE_LINUX_LOOP_H */
# include <fcntl.h>
#endif /* HAVE_FCNTL_H */

/*
 * Actions to take if HAVE_MEMORY_H is defined.
 */
#if HAVE_MEMORY_H
# include <memory.h>
#endif /* HAVE_MEMORY_H */

/*
 * Actions to take if HAVE_SYS_FILE_H is defined.
 */
#if HAVE_SYS_FILE_H
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */

/*
 * Actions to take if HAVE_SYS_IOCTL_H is defined.
 */
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif /* HAVE_SYS_IOCTL_H */

/*
 * Actions to take if HAVE_SYSLOG_H or HAVE_SYS_SYSLOG_H is defined.
 */
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#else /* not HAVE_SYSLOG_H */
# if HAVE_SYS_SYSLOG_H
#  include <sys/syslog.h>
# endif /* HAVE_SYS_SYSLOG_H */
#endif /* HAVE_SYSLOG_H */

/*
 * Actions to take if <sys/param.h> exists.
 */
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */

/*
 * Actions to take if <sys/socket.h> exists.
 */
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */

/*
 * Actions to take if <rpc/rpc.h> exists.
 */
#ifdef HAVE_RPC_RPC_H
/*
 * Turn on PORTMAP, so that additional header files would get included
 * and the important definition for UDPMSGSIZE is included too.
 */
# ifndef PORTMAP
#  define PORTMAP
# endif /* not PORTMAP */
# include <rpc/rpc.h>
# ifndef XDRPROC_T_TYPE
typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
# endif /* not XDRPROC_T_TYPE */
#endif /* HAVE_RPC_RPC_H */

/*
 * Actions to take if <rpc/types.h> exists.
 */
#ifdef HAVE_RPC_TYPES_H
# include <rpc/types.h>
#endif /* HAVE_RPC_TYPES_H */

/*
 * Actions to take if <rpc/xdr.h> exists.
 */
/* Prevent multiple inclusion on Ultrix 4 */
#if defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__)
# include <rpc/xdr.h>
#endif /* defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__) */

/*
 * Actions to take if <malloc.h> exists.
 * Don't include malloc.h if stdlib.h exists, because modern
 * systems complain if you use malloc.h instead of stdlib.h.
 * XXX: let's hope there are no systems out there that need both.
 */
#if defined(HAVE_MALLOC_H) && !defined(HAVE_STDLIB_H)
# include <malloc.h>
#endif /* defined(HAVE_MALLOC_H) && !defined(HAVE_STDLIB_H) */

/*
 * Actions to take if <mntent.h> exists.
 */
#ifdef HAVE_MNTENT_H
/* some systems need <stdio.h> before <mntent.h> is included */
# ifdef HAVE_STDIO_H
#  include <stdio.h>
# endif /* HAVE_STDIO_H */
# include <mntent.h>
#endif /* HAVE_MNTENT_H */

/*
 * Actions to take if <sys/errno.h> exists.
 */
#ifdef HAVE_SYS_ERRNO_H
# include <sys/errno.h>
extern int errno;
#endif /* HAVE_SYS_ERRNO_H */

/*
 * Actions to take if <sys/fsid.h> exists.
 */
#ifdef HAVE_SYS_FSID_H
# include <sys/fsid.h>
#endif /* HAVE_SYS_FSID_H */

/*
 * Actions to take if <sys/utsname.h> exists.
 */
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif /* HAVE_SYS_UTSNAME_H */

/*
 * Actions to take if <sys/mntent.h> exists.
 */
#ifdef HAVE_SYS_MNTENT_H
# include <sys/mntent.h>
#endif /* HAVE_SYS_MNTENT_H */

/*
 * Actions to take if <ndbm.h> or <db1/ndbm.h> exist.
 * Should be included before <rpcsvc/yp_prot.h> because on some systems
 * like Linux, it also defines "struct datum".
 */
#ifdef HAVE_MAP_NDBM
# include NEW_DBM_H
# ifndef DATUM
/* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
#  define DATUM
# endif /* not DATUM */
#endif /* HAVE_MAP_NDBM */

/*
 * Actions to take if <net/errno.h> exists.
 */
#ifdef HAVE_NET_ERRNO_H
# include <net/errno.h>
#endif /* HAVE_NET_ERRNO_H */

/*
 * Actions to take if <net/if.h> exists.
 */
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif /* HAVE_NET_IF_H */

/*
 * Actions to take if <net/route.h> exists.
 */
#ifdef HAVE_NET_ROUTE_H
# include <net/route.h>
#endif /* HAVE_NET_ROUTE_H */

/*
 * Actions to take if <sys/mbuf.h> exists.
 */
#ifdef HAVE_SYS_MBUF_H
# include <sys/mbuf.h>
/*
 * OSF4 (DU-4.0) defines m_next and m_data also in <sys/mount.h> so I must
 # undefine them here to avoid conflicts.
 */
# ifdef m_next
#  undef m_next
# endif /* m_next */
# ifdef m_data
#  undef m_data
# endif /* m_data */
/*
 * AIX 3 defines MFREE and m_flags also in <sys/mount.h>.
 */
# ifdef m_flags
#  undef m_flags
# endif /* m_flags */
# ifdef MFREE
#  undef MFREE
# endif /* MFREE */
#endif /* HAVE_SYS_MBUF_H */

/*
 * Actions to take if <sys/mman.h> exists.
 */
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif /* HAVE_SYS_MMAN_H */

/*
 * Actions to take if <netdb.h> exists.
 */
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif /* HAVE_NETDB_H */

/*
 * Actions to take if <netdir.h> exists.
 */
#ifdef HAVE_NETDIR_H
# include <netdir.h>
#endif /* HAVE_NETDIR_H */

/*
 * Actions to take if <net/if_var.h> exists.
 */
#ifdef HAVE_NET_IF_VAR_H
# include <net/if_var.h>
#endif /* HAVE_NET_IF_VAR_H */

/*
 * Actions to take if <netinet/if_ether.h> exists.
 */
#ifdef HAVE_NETINET_IF_ETHER_H
# include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */

/*
 * Actions to take if <netinet/in.h> exists.
 */
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */

/*
 * Actions to take if <rpcsvc/yp_prot.h> exists.
 */
#ifdef HAVE_RPCSVC_YP_PROT_H
# ifdef HAVE_BAD_HEADERS
/* avoid circular dependency in aix 4.3 with <rpcsvc/ypclnt.h> */
struct ypall_callback;
# endif /* HAVE_BAD_HEADERS */
# include <rpcsvc/yp_prot.h>
#endif /* HAVE_RPCSVC_YP_PROT_H */

/*
 * Actions to take if <rpcsvc/ypclnt.h> exists.
 */
#ifdef HAVE_RPCSVC_YPCLNT_H
# include <rpcsvc/ypclnt.h>
#endif /* HAVE_RPCSVC_YPCLNT_H */

/*
 * Actions to take if <sys/ucred.h> exists.
 */
#ifdef HAVE_SYS_UCRED_H
# include <sys/ucred.h>
#endif /* HAVE_SYS_UCRED_H */


/*
 * Actions to take if <sys/mount.h> exists.
 */
#ifdef HAVE_SYS_MOUNT_H
/*
 * Some operating systems must define these variables to get
 * NFS and other definitions included.
 */
# ifndef NFSCLIENT
#  define NFSCLIENT 1
# endif /* not NFSCLIENT */
# ifndef NFS
#  define NFS 1
# endif /* not NFS */
# ifndef PCFS
#  define PCFS 1
# endif /* not PCFS */
# ifndef LOFS
#  define LOFS 1
# endif /* not LOFS */
# ifndef RFS
#  define RFS 1
# endif /* not RFS */
# ifndef MSDOSFS
#  define MSDOSFS 1
# endif /* not MSDOSFS */
# ifndef MFS
#  define MFS 1
# endif /* not MFS */
# ifndef CD9660
#  define CD9660 1
# endif /* not CD9660 */
# include <sys/mount.h>
#endif /* HAVE_SYS_MOUNT_H */

#ifdef HAVE_SYS_VMOUNT_H
# include <sys/vmount.h>
#endif /* HAVE_SYS_VMOUNT_H */

/*
 * Actions to take if <linux/fs.h> exists.
 * There is no point in including this on a glibc2 system,
 * we're only asking for trouble
 */
#if defined HAVE_LINUX_FS_H && (!defined __GLIBC__ || __GLIBC__ < 2)
/*
 * There are various conflicts in definitions between RedHat Linux, newer
 * 2.2 kernels, and <netinet/in.h> and <linux/fs.h>.
 */
# ifdef HAVE_SOCKETBITS_H
/* conflicts with <socketbits.h> */
#  define _LINUX_SOCKET_H
#  undef BLKFLSBUF
#  undef BLKGETSIZE
#  undef BLKRAGET
#  undef BLKRASET
#  undef BLKROGET
#  undef BLKROSET
#  undef BLKRRPART
#  undef MS_MGC_VAL
#  undef MS_RMT_MASK
#  if defined(__GLIBC__) && __GLIBC__ >= 2
/* conflicts with <waitflags.h> */
#   undef WNOHANG
#   undef WUNTRACED
#  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
/* conflicts with <statfsbuf.h> */
#  define _SYS_STATFS_H
# endif /* HAVE_SOCKETBITS_H */

# ifdef _SYS_WAIT_H
#  if defined(__GLIBC__) && __GLIBC__ >= 2
/* conflicts with <bits/waitflags.h> (RedHat/Linux 6.0 and kernels 2.2 */
#   undef WNOHANG
#   undef WUNTRACED
#  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
# endif /* _SYS_WAIT_H */

# ifdef HAVE_LINUX_POSIX_TYPES_H
#  include <linux/posix_types.h>
# endif /* HAVE_LINUX_POSIX_TYPES_H */
# ifndef _LINUX_BYTEORDER_GENERIC_H
#  define _LINUX_BYTEORDER_GENERIC_H
# endif /* _LINUX_BYTEORDER_GENERIC_H */
/* conflicts with <sys/mount.h> in 2.[12] kernels */
# ifdef _SYS_MOUNT_H
#  undef BLKFLSBUF
#  undef BLKGETSIZE
#  undef BLKRAGET
#  undef BLKRASET
#  undef BLKROGET
#  undef BLKROSET
#  undef BLKRRPART
#  undef BLOCK_SIZE
#  undef MS_MANDLOCK
#  undef MS_MGC_VAL
#  undef MS_NOATIME
#  undef MS_NODEV
#  undef MS_NODIRATIME
#  undef MS_NOEXEC
#  undef MS_NOSUID
#  undef MS_RDONLY
#  undef MS_REMOUNT
#  undef MS_RMT_MASK
#  undef MS_SYNCHRONOUS
#  undef S_APPEND
#  undef S_IMMUTABLE
/* conflicts with <statfsbuf.h> */
#  define _SYS_STATFS_H
# endif /* _SYS_MOUNT_H */
# ifndef _LINUX_STRING_H_
#  define _LINUX_STRING_H_
# endif /* not _LINUX_STRING_H_ */
# ifdef HAVE_LINUX_KDEV_T_H
#  define __KERNEL__
#  include <linux/kdev_t.h>
#  undef __KERNEL__
# endif /* HAVE_LINUX_KDEV_T_H */
# ifdef HAVE_LINUX_LIST_H
#  define __KERNEL__
#  include <linux/list.h>
#  undef __KERNEL__
# endif /* HAVE_LINUX_LIST_H */
# include <linux/fs.h>
#endif /* HAVE_LINUX_FS_H && (!__GLIBC__ || __GLIBC__ < 2) */

#ifdef HAVE_CDFS_CDFS_MOUNT_H
# include <cdfs/cdfs_mount.h>
#endif /* HAVE_CDFS_CDFS_MOUNT_H */

#ifdef HAVE_CDFS_CDFSMOUNT_H
# include <cdfs/cdfsmount.h>
#endif /* HAVE_CDFS_CDFSMOUNT_H */

/*
 * Actions to take if <linux/loop.h> exists.
 */
#ifdef HAVE_LINUX_LOOP_H
# ifdef HAVE_LINUX_POSIX_TYPES_H
#  include <linux/posix_types.h>
# endif /* HAVE_LINUX_POSIX_TYPES_H */
/* next dev_t lines needed due to changes in kernel code */
# undef dev_t
# define dev_t unsigned short	/* compatible with Red Hat and SuSE */
# include <linux/loop.h>
#endif /* HAVE_LINUX_LOOP_H */

/*
 * AUTOFS PROTOCOL HEADER FILES:
 */

/*
 * Actions to take if <linux/auto_fs[4].h> exists.
 * We really don't want <linux/fs.h> pulled in here
 */
#ifndef _LINUX_FS_H
#define _LINUX_FS_H
#endif /* _LINUX_FS_H */
#ifdef HAVE_LINUX_AUTO_FS4_H
# include <linux/auto_fs4.h>
#else  /* not HAVE_LINUX_AUTO_FS4_H */
# ifdef HAVE_LINUX_AUTO_FS_H
#  include <linux/auto_fs.h>
# endif /* HAVE_LINUX_AUTO_FS_H */
#endif /* not HAVE_LINUX_AUTO_FS4_H */

/*
 * Actions to take if <sys/fs/autofs.h> exists.
 */
#ifdef HAVE_SYS_FS_AUTOFS_H
# include <sys/fs/autofs.h>
#endif /* HAVE_SYS_FS_AUTOFS_H */

/*
 * Actions to take if <rpcsvc/autofs_prot.h> or <sys/fs/autofs_prot.h> exist.
 */
#ifdef HAVE_RPCSVC_AUTOFS_PROT_H
# include <rpcsvc/autofs_prot.h>
#else  /* not HAVE_RPCSVC_AUTOFS_PROT_H */
# ifdef HAVE_SYS_FS_AUTOFS_PROT_H
#  include <sys/fs/autofs_prot.h>
# endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
#endif /* not HAVE_RPCSVC_AUTOFS_PROT_H */

/*
 * Actions to take if <lber.h> exists.
 * This header file is required before <ldap.h> can be included.
 */
#ifdef HAVE_LBER_H
# include <lber.h>
#endif /* HAVE_LBER_H */

/*
 * Actions to take if <ldap.h> exists.
 */
#ifdef HAVE_LDAP_H
# include <ldap.h>
#endif /* HAVE_LDAP_H */

/****************************************************************************
 ** IMPORTANT!!!							   **
 ** We always include am-utils' amu_autofs_prot.h.			   **
 ** That is actually defined in "conf/autofs/autofs_${autofs_style}.h"     **
 ****************************************************************************/
#include <amu_autofs_prot.h>


/*
 * NFS PROTOCOL HEADER FILES:
 */

/*
 * Actions to take if <nfs/export.h> exists.
 */
#ifdef HAVE_NFS_EXPORT_H
# include <nfs/export.h>
#endif /* HAVE_NFS_EXPORT_H */

/****************************************************************************
 ** IMPORTANT!!!							   **
 ** We always include am-utils' amu_nfs_prot.h.				   **
 ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" **
 ****************************************************************************/
#include <amu_nfs_prot.h>

/*
 * DO NOT INCLUDE THESE FILES:
 * They conflicts with other NFS headers and are generally not needed.
 */
#ifdef DO_NOT_INCLUDE
# ifdef HAVE_NFS_NFS_CLNT_H
#  include <nfs/nfs_clnt.h>
# endif /* HAVE_NFS_NFS_CLNT_H */
# ifdef HAVE_LINUX_NFS_H
#  include <linux/nfs.h>
# endif /* HAVE_LINUX_NFS_H */
#endif /* DO NOT INCLUDE */

/*
 * Actions to take if one of the nfs headers exists.
 */
#ifdef HAVE_NFS_NFS_GFS_H
# include <nfs/nfs_gfs.h>
#endif /* HAVE_NFS_NFS_GFS_H */
#ifdef HAVE_NFS_MOUNT_H
# include <nfs/mount.h>
#endif /* HAVE_NFS_MOUNT_H */
#ifdef HAVE_NFS_NFS_MOUNT_H_off
/* broken on nextstep3 (includes non-existing headers) */
# include <nfs/nfs_mount.h>
#endif /* HAVE_NFS_NFS_MOUNT_H */
#ifdef HAVE_NFS_PATHCONF_H
# include <nfs/pathconf.h>
#endif /* HAVE_NFS_PATHCONF_H */
#ifdef HAVE_SYS_FS_NFS_MOUNT_H
# include <sys/fs/nfs/mount.h>
#endif /* HAVE_SYS_FS_NFS_MOUNT_H */
#ifdef HAVE_SYS_FS_NFS_NFS_CLNT_H
# include <sys/fs/nfs/nfs_clnt.h>
#endif /* HAVE_SYS_FS_NFS_NFS_CLNT_H */
#ifdef HAVE_SYS_FS_NFS_CLNT_H
# include <sys/fs/nfs_clnt.h>
#endif /* HAVE_SYS_FS_NFS_CLNT_H */

/* complex rules for linux/nfs_mount.h: broken on so many systems */
#ifdef HAVE_LINUX_NFS_MOUNT_H
# ifndef _LINUX_NFS_H
#  define _LINUX_NFS_H
# endif /* not _LINUX_NFS_H */
# ifndef _LINUX_NFS2_H
#  define _LINUX_NFS2_H
# endif /* not _LINUX_NFS2_H */
# ifndef _LINUX_NFS3_H
#  define _LINUX_NFS3_H
# endif /* not _LINUX_NFS3_H */
# ifndef _LINUX_NFS_FS_H
#  define _LINUX_NFS_FS_H
# endif /* not _LINUX_NFS_FS_H */
# ifndef _LINUX_IN_H
#  define _LINUX_IN_H
# endif /* not _LINUX_IN_H */
# ifndef __KERNEL__
#  define __KERNEL__
# endif /* __KERNEL__ */
# include <linux/nfs_mount.h>
# undef __KERNEL__
#endif /* HAVE_LINUX_NFS_MOUNT_H */

/*
 * Actions to take if <pwd.h> exists.
 */
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif /* HAVE_PWD_H */

/*
 * Actions to take if <hesiod.h> exists.
 */
#ifdef HAVE_HESIOD_H
# include <hesiod.h>
#endif /* HAVE_HESIOD_H */

/*
 * Actions to take if <arpa/nameser.h> exists.
 * Should be included before <resolv.h>.
 */
#ifdef HAVE_ARPA_NAMESER_H
# ifdef NOERROR
#  undef NOERROR
# endif /* NOERROR */
/*
 * Conflicts with <sys/tpicommon.h> which is included from <sys/tiuser.h>
 * on Solaris 2.6 systems.  So undefine it first.
 */
# ifdef T_UNSPEC
#  undef T_UNSPEC
# endif /* T_UNSPEC */
# include <arpa/nameser.h>
#endif /* HAVE_ARPA_NAMESER_H */

/*
 * Actions to take if <arpa/inet.h> exists.
 */
#ifdef HAVE_ARPA_INET_H
# ifdef HAVE_BAD_HEADERS
/* aix 4.3: avoid including <net/if_dl.h> */
struct sockaddr_dl;
# endif /* HAVE_BAD_HEADERS */
# include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */

/*
 * Actions to take if <resolv.h> exists.
 */
#ifdef HAVE_RESOLV_H
/*
 * On AIX 5.2, both <resolv.h> and <arpa/nameser_compat.h> define MAXDNAME,
 * if compiling with gcc -D_USE_IRS (so that we get extern definitions for
 * hstrerror() and others).
 */
# if defined(_AIX) && defined(MAXDNAME) && defined(_USE_IRS)
#  undef MAXDNAME
# endif /* defined(_AIX) && defined(MAXDNAME) && defined(_USE_IRS) */
# include <resolv.h>
#endif /* HAVE_RESOLV_H */

/*
 * Actions to take if <sys/uio.h> exists.
 */
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif /* HAVE_SYS_UIO_H */

/*
 * Actions to take if <sys/fs/cachefs_fs.h> exists.
 */
#ifdef HAVE_SYS_FS_CACHEFS_FS_H
# include <sys/fs/cachefs_fs.h>
#endif /* HAVE_SYS_FS_CACHEFS_FS_H */

/*
 * Actions to take if <sys/fs/pc_fs.h> exists.
 */
#ifdef HAVE_SYS_FS_PC_FS_H
# include <sys/fs/pc_fs.h>
#endif /* HAVE_SYS_FS_PC_FS_H */

/*
 * Actions to take if <msdosfs/msdosfsmount.h> exists.
 */
#ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
# include <msdosfs/msdosfsmount.h>
#endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H
# include <fs/msdosfs/msdosfsmount.h>
#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */

/*
 * Actions to take if <fs/msdosfs/msdosfsmount.h> exists.
 */
#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H
# include <fs/msdosfs/msdosfsmount.h>
#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */

/*
 * Actions to take if <sys/fs/tmp.h> exists.
 */
#ifdef HAVE_SYS_FS_TMP_H
# include <sys/fs/tmp.h>
#endif /* HAVE_SYS_FS_TMP_H */

/*
 * Actions to take if <sys/fs/ufs_mount.h> exists.
 */
#ifdef HAVE_SYS_FS_UFS_MOUNT_H
# include <sys/fs/ufs_mount.h>
#endif /* HAVE_SYS_FS_UFS_MOUNT_H */
/* 
 * HAVE_UFS_UFS_UFSMOUNT_H should NOT be defined on netbsd/openbsd because it
 * causes errors with other header files.  Instead, add it to the specific
 * conf/nfs_prot_*.h file.
 */
#ifdef	HAVE_UFS_UFS_UFSMOUNT_H
# include <ufs/ufs/ufsmount.h>
#endif	/* HAVE_UFS_UFS_UFSMOUNT_H */

/*
 * Actions to take if <sys/fs/efs_clnt.h> exists.
 */
#ifdef HAVE_SYS_FS_EFS_CLNT_H
# include <sys/fs/efs_clnt.h>
#endif /* HAVE_SYS_FS_EFS_CLNT_H */

/*
 * Actions to take if <sys/fs/xfs_clnt.h> exists.
 */
#ifdef HAVE_SYS_FS_XFS_CLNT_H
# include <sys/fs/xfs_clnt.h>
#endif /* HAVE_SYS_FS_XFS_CLNT_H */

/*
 * Actions to take if <assert.h> exists.
 */
#ifdef HAVE_ASSERT_H
# include <assert.h>
#endif /* HAVE_ASSERT_H */

/*
 * Actions to take if <cfs.h> exists.
 */
#ifdef HAVE_CFS_H
# include <cfs.h>
#endif /* HAVE_CFS_H */

/*
 * Actions to take if <cluster.h> exists.
 */
#ifdef HAVE_CLUSTER_H
# include <cluster.h>
#endif /* HAVE_CLUSTER_H */

/*
 * Actions to take if <ctype.h> exists.
 */
#ifdef HAVE_CTYPE_H
# include <ctype.h>
#endif /* HAVE_CTYPE_H */

/*
 * Actions to take if <errno.h> exists.
 */
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif /* HAVE_ERRNO_H */

/*
 * Actions to take if <grp.h> exists.
 */
#ifdef HAVE_GRP_H
# include <grp.h>
#endif /* HAVE_GRP_H */

/*
 * Actions to take if <hsfs/hsfs.h> exists.
 */
#ifdef HAVE_HSFS_HSFS_H
# include <hsfs/hsfs.h>
#endif /* HAVE_HSFS_HSFS_H */

/*
 * Actions to take if <cdfs/cdfsmount.h> exists.
 */
#ifdef HAVE_CDFS_CDFSMOUNT_H
# include <cdfs/cdfsmount.h>
#endif /* HAVE_CDFS_CDFSMOUNT_H */

/*
 * Actions to take if <isofs/cd9660/cd9660_mount.h> exists.
 */
#ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
# include <isofs/cd9660/cd9660_mount.h>
#endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */

/*
 * Actions to take if <mount.h> exists.
 */
#ifdef HAVE_MOUNT_H
# include <mount.h>
#endif /* HAVE_MOUNT_H */

/*
 * Actions to take if <nsswitch.h> exists.
 */
#ifdef HAVE_NSSWITCH_H
# include <nsswitch.h>
#endif /* HAVE_NSSWITCH_H */

/*
 * Actions to take if <rpc/auth_des.h> exists.
 */
#ifdef HAVE_RPC_AUTH_DES_H
# include <rpc/auth_des.h>
#endif /* HAVE_RPC_AUTH_DES_H */

/*
 * Actions to take if <rpc/pmap_clnt.h> exists.
 */
#ifdef HAVE_RPC_PMAP_CLNT_H
# include <rpc/pmap_clnt.h>
#endif /* HAVE_RPC_PMAP_CLNT_H */

/*
 * Actions to take if <rpc/pmap_prot.h> exists.
 */
#ifdef HAVE_RPC_PMAP_PROT_H
# include <rpc/pmap_prot.h>
#endif /* HAVE_RPC_PMAP_PROT_H */


/*
 * Actions to take if <rpcsvc/mount.h> exists.
 * AIX does not protect against this file doubly included,
 * so I have to do my own protection here.
 */
#ifdef HAVE_RPCSVC_MOUNT_H
# ifndef _RPCSVC_MOUNT_H
#  include <rpcsvc/mount.h>
# endif /* not _RPCSVC_MOUNT_H */
#endif /* HAVE_RPCSVC_MOUNT_H */

/*
 * Actions to take if <rpcsvc/nis.h> exists.
 */
#ifdef HAVE_RPCSVC_NIS_H
/*
 * Solaris 10 (build 72) defines GROUP_OBJ in <sys/acl.h>, which is included
 * in many other header files.  <rpcsvc/nis.h> uses GROUP_OBJ inside enum
 * zotypes.  So if you're unlucky enough to include both headers, you get a
 * compile error because the two symbols conflict.
 * A similar conflict arises with Sun cc and the definition of "GROUP".
 *
 * Temp hack: undefine acl.h's GROUP_OBJ and GROUP because they're not needed
 * for am-utils.
 */
# ifdef GROUP_OBJ
#  undef GROUP_OBJ
# endif /* GROUP_OBJ */
# ifdef GROUP
#  undef GROUP
# endif /* GROUP */
# include <rpcsvc/nis.h>
#endif /* HAVE_RPCSVC_NIS_H */

/*
 * Actions to take if <setjmp.h> exists.
 */
#ifdef HAVE_SETJMP_H
# include <setjmp.h>
#endif /* HAVE_SETJMP_H */

/*
 * Actions to take if <signal.h> exists.
 */
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif /* HAVE_SIGNAL_H */

/*
 * Actions to take if <string.h> exists.
 */
#ifdef HAVE_STRING_H
# include <string.h>
#endif /* HAVE_STRING_H */

/*
 * Actions to take if <strings.h> exists.
 */
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif /* HAVE_STRINGS_H */

/*
 * Actions to take if <sys/config.h> exists.
 */
#ifdef HAVE_SYS_CONFIG_H
# include <sys/config.h>
#endif /* HAVE_SYS_CONFIG_H */

/*
 * Actions to take if <sys/dg_mount.h> exists.
 */
#ifdef HAVE_SYS_DG_MOUNT_H
# include <sys/dg_mount.h>
#endif /* HAVE_SYS_DG_MOUNT_H */

/*
 * Actions to take if <sys/fs_types.h> exists.
 */
#ifdef HAVE_SYS_FS_TYPES_H
/*
 * Define KERNEL here to avoid multiple definitions of gt_names[] on
 * Ultrix 4.3.
 */
# define KERNEL
# include <sys/fs_types.h>
# undef KERNEL
#endif /* HAVE_SYS_FS_TYPES_H */

/*
 * Actions to take if <sys/fstyp.h> exists.
 */
#ifdef HAVE_SYS_FSTYP_H
# include <sys/fstyp.h>
#endif /* HAVE_SYS_FSTYP_H */

/*
 * Actions to take if <sys/lock.h> exists.
 */
#ifdef HAVE_SYS_LOCK_H
# include <sys/lock.h>
#endif /* HAVE_SYS_LOCK_H */

/*
 * Actions to take if <sys/machine.h> exists.
 */
#ifdef HAVE_SYS_MACHINE_H
# include <sys/machine.h>
#endif /* HAVE_SYS_MACHINE_H */

/*
 * Actions to take if <sys/mntctl.h> exists.
 */
#ifdef HAVE_SYS_MNTCTL_H
# include <sys/mntctl.h>
#endif /* HAVE_SYS_MNTCTL_H */

/*
 * Actions to take if <sys/mnttab.h> exists.
 */
#ifdef HAVE_SYS_MNTTAB_H
# include <sys/mnttab.h>
#endif /* HAVE_SYS_MNTTAB_H */

/*
 * Actions to take if <mnttab.h> exists.
 * Do not include it if MNTTAB is already defined because it probably
 * came from <sys/mnttab.h> and we do not want conflicting definitions.
 */
#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
# include <mnttab.h>
#endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */

/*
 * Actions to take if <netconfig.h> exists.
 */
#ifdef HAVE_NETCONFIG_H
# include <netconfig.h>
/* Some systems (Solaris 2.5.1) don't declare this external */
extern char *nc_sperror(void);
#endif /* HAVE_NETCONFIG_H */

/*
 * Actions to take if <sys/netconfig.h> exists.
 */
#ifdef HAVE_SYS_NETCONFIG_H
# include <sys/netconfig.h>
#endif /* HAVE_SYS_NETCONFIG_H */

/*
 * Actions to take if <sys/pathconf.h> exists.
 */
#ifdef HAVE_SYS_PATHCONF_H
# include <sys/pathconf.h>
#endif /* HAVE_SYS_PATHCONF_H */

/*
 * Actions to take if <sys/resource.h> exists.
 */
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H */

/*
 * Actions to take if <sys/sema.h> exists.
 */
#ifdef HAVE_SYS_SEMA_H
# include <sys/sema.h>
#endif /* HAVE_SYS_SEMA_H */

/*
 * Actions to take if <sys/signal.h> exists.
 */
#ifdef HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif /* HAVE_SYS_SIGNAL_H */

/*
 * Actions to take if <sys/sockio.h> exists.
 */
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif /* HAVE_SYS_SOCKIO_H */

/*
 * Actions to take if <sys/syscall.h> exists.
 */
#ifdef HAVE_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif /* HAVE_SYS_SYSCALL_H */

/*
 * Actions to take if <sys/syslimits.h> exists.
 */
#ifdef HAVE_SYS_SYSLIMITS_H
# include <sys/syslimits.h>
#endif /* HAVE_SYS_SYSLIMITS_H */

/*
 * Actions to take if <tiuser.h> exists.
 */
#ifdef HAVE_TIUSER_H
/*
 * Some systems like AIX have multiple definitions for T_NULL and others
 * that are defined first in <arpa/nameser.h>.
 */
# ifdef HAVE_ARPA_NAMESER_H
#  ifdef T_NULL
#   undef T_NULL
#  endif /* T_NULL */
#  ifdef T_UNSPEC
#   undef T_UNSPEC
#  endif /* T_UNSPEC */
#  ifdef T_IDLE
#   undef T_IDLE
#  endif /* T_IDLE */
# endif /* HAVE_ARPA_NAMESER_H */
# include <tiuser.h>
#endif /* HAVE_TIUSER_H */

/*
 * Actions to take if <sys/tiuser.h> exists.
 */
#ifdef HAVE_SYS_TIUSER_H
# include <sys/tiuser.h>
#endif /* HAVE_SYS_TIUSER_H */

/*
 * Actions to take if <sys/statfs.h> exists.
 */
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif /* HAVE_SYS_STATFS_H */

/*
 * Actions to take if <sys/statvfs.h> exists.
 */
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif /* HAVE_SYS_STATVFS_H */

/*
 * Actions to take if <sys/vfs.h> exists.
 */
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif /* HAVE_SYS_VFS_H */

/*
 * Actions to take if <sys/vmount.h> exists.
 */
#ifdef HAVE_SYS_VMOUNT_H
# include <sys/vmount.h>
#endif /* HAVE_SYS_VMOUNT_H */

/*
 * Actions to take if <ufs/ufs_mount.h> exists.
 */
#ifdef HAVE_UFS_UFS_MOUNT_H
# include <ufs/ufs_mount.h>
#endif /* HAVE_UFS_UFS_MOUNT_H */

/*
 * Are S_ISDIR, S_ISREG, et al broken?  If not, include <sys/stat.h>.
 * Turned off the not using sys/stat.h based on if the macros are
 * "broken", because they incorrectly get reported as broken on
 * ncr2.
 */
#ifndef STAT_MACROS_BROKEN_notused
/*
 * RedHat Linux 4.2 (alpha) has a problem in the headers that causes
 * duplicate definitions, and also some other nasty bugs.  Upgrade to Redhat
 * 5.0!
 */
# ifdef HAVE_SYS_STAT_H
/* avoid duplicates or conflicts with <linux/stat.h> (RedHat alpha linux) */
#  if defined(S_IFREG) && defined(HAVE_STATBUF_H)
#   include <statbuf.h>
#   undef S_IFBLK
#   undef S_IFCHR
#   undef S_IFDIR
#   undef S_IFIFO
#   undef S_IFLNK
#   undef S_IFMT
#   undef S_IFREG
#   undef S_IFSOCK
#   undef S_IRGRP
#   undef S_IROTH
#   undef S_IRUSR
#   undef S_IRWXG
#   undef S_IRWXO
#   undef S_IRWXU
#   undef S_ISBLK
#   undef S_ISCHR
#   undef S_ISDIR
#   undef S_ISFIFO
#   undef S_ISGID
#   undef S_ISLNK
#   undef S_ISREG
#   undef S_ISSOCK
#   undef S_ISUID
#   undef S_ISVTX
#   undef S_IWGRP
#   undef S_IWOTH
#   undef S_IWUSR
#   undef S_IXGRP
#   undef S_IXOTH
#   undef S_IXUSR
#  endif /* defined(S_IFREG) && defined(HAVE_STATBUF_H) */
#  include <sys/stat.h>
# endif /* HAVE_SYS_STAT_H */
#endif /* not STAT_MACROS_BROKEN_notused */

/*
 * Actions to take if <stdio.h> exists.
 */
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif /* HAVE_STDIO_H */

/*
 * Actions to take if <stdlib.h> exists.
 */
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif /* HAVE_STDLIB_H */

/*
 * Actions to take if <regex.h> exists.
 */
#ifdef HAVE_REGEX_H
# include <regex.h>
#endif /* HAVE_REGEX_H */

/*
 * Actions to take if <tcpd.h> exists.
 */
#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
# include <tcpd.h>
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */


/****************************************************************************/
/*
 * Specific macros we're looking for.
 */
#ifndef HAVE_MEMSET
# ifdef HAVE_BZERO
#  define	memset(ptr, val, len)	bzero((ptr), (len))
# else /* not HAVE_BZERO */
#  error Cannot find either memset or bzero!
# endif /* not HAVE_BZERO */
#endif /* not HAVE_MEMSET */

#ifndef HAVE_MEMMOVE
# ifdef HAVE_BCOPY
#  define	memmove(to, from, len)	bcopy((from), (to), (len))
# else /* not HAVE_BCOPY */
#  error Cannot find either memmove or bcopy!
# endif /* not HAVE_BCOPY */
#endif /* not HAVE_MEMMOVE */

/*
 * memcmp() is more problematic:
 * Systems that don't have it, but have bcmp(), will use bcmp() instead.
 * Those that have it, but it is bad (SunOS 4 doesn't handle
 * 8 bit comparisons correctly), will get to use am_memcmp().
 * Otherwise if you have memcmp() and it is good, use it.
 */
#ifdef HAVE_MEMCMP
# ifdef HAVE_BAD_MEMCMP
#  define	memcmp		am_memcmp
extern int am_memcmp(const voidp s1, const voidp s2, size_t len);
# endif /* HAVE_BAD_MEMCMP */
#else /* not HAVE_MEMCMP */
# ifdef HAVE_BCMP
#  define	memcmp(a, b, len)	bcmp((a), (b), (len))
# endif /* HAVE_BCMP */
#endif /* not HAVE_MEMCMP */

#ifndef HAVE_SETEUID
# ifdef HAVE_SETRESUID
#  define	seteuid(x)		setresuid(-1,(x),-1)
# else /* not HAVE_SETRESUID */
#  error Cannot find either seteuid or setresuid!
# endif /* not HAVE_SETRESUID */
#endif /* not HAVE_SETEUID */

/*
 * Define type of mntent_t.
 * Defaults to struct mntent, else struct mnttab.  If neither is found, and
 * the operating system does keep not mount tables in the kernel, then flag
 * it as an error.  If neither is found and the OS keeps mount tables in the
 * kernel, then define our own version of mntent; it will be needed for amd
 * to keep its own internal version of the mount tables.
 */
#ifdef HAVE_STRUCT_MNTENT
typedef struct mntent mntent_t;
#else /* not HAVE_STRUCT_MNTENT */
# ifdef HAVE_STRUCT_MNTTAB
typedef struct mnttab mntent_t;
/* map struct mnttab field names to struct mntent field names */
#  define mnt_fsname	mnt_special
#  define mnt_dir	mnt_mountp
#  define mnt_opts	mnt_mntopts
#  define mnt_type	mnt_fstype
# else /* not HAVE_STRUCT_MNTTAB */
#  ifdef MOUNT_TABLE_ON_FILE
#   error Could not find definition for struct mntent or struct mnttab!
#  else /* not MOUNT_TABLE_ON_FILE */
typedef struct _am_mntent {
  char	*mnt_fsname;		/* name of mounted file system */
  char	*mnt_dir;		/* file system path prefix */
  char	*mnt_type;		/* MNTTAB_TYPE_* */
  char	*mnt_opts;		/* MNTTAB_OPT_* */
  int	mnt_freq;		/* dump frequency, in days */
  int	mnt_passno;		/* pass number on parallel fsck */
} mntent_t;
#  endif /* not MOUNT_TABLE_ON_FILE */
# endif /* not HAVE_STRUCT_MNTTAB */
#endif /* not HAVE_STRUCT_MNTENT */

/*
 * Provide FD_* macros for systems that lack them.
 */
#ifndef FD_SET
# define FD_SET(fd, set) (*(set) |= (1 << (fd)))
# define FD_ISSET(fd, set) (*(set) & (1 << (fd)))
# define FD_CLR(fd, set) (*(set) &= ~(1 << (fd)))
# define FD_ZERO(set) (*(set) = 0)
#endif /* not FD_SET */


/*
 * Complete external definitions missing from some systems.
 */

#ifndef HAVE_EXTERN_SYS_ERRLIST
extern const char *const sys_errlist[];
#endif /* not HAVE_EXTERN_SYS_ERRLIST */

#ifndef HAVE_EXTERN_OPTARG
extern char *optarg;
extern int optind;
#endif /* not HAVE_EXTERN_OPTARG */

#if defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR)
extern char *clnt_spcreateerror(const char *s);
#endif /* defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR) */

#if defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO)
extern char *clnt_sperrno(const enum clnt_stat num);
#endif /* defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO) */

#ifndef HAVE_EXTERN_FREE
extern void free(voidp);
#endif /* not HAVE_EXTERN_FREE */

#if defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS)
extern void get_myaddress(struct sockaddr_in *addr);
#endif /* defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS) */

#if defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME)
# if defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS)
extern int getdomainname(char *name, int namelen);
# endif /* defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS) */
#endif /* defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME) */

#if defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE)
extern int getdtablesize(void);
#endif /* defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE) */

#if defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME)
extern int gethostname(char *name, int namelen);
#endif /* defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME) */

#ifndef HAVE_EXTERN_GETLOGIN
extern char *getlogin(void);
#endif /* not HAVE_EXTERN_GETLOGIN */

#if defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE)
extern int getpagesize(void);
#endif /* defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE) */

#ifndef HAVE_EXTERN_GETWD
extern char *getwd(char *s);
#endif /* not HAVE_EXTERN_GETWD */

#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) && !defined(HAVE_EXTERN_HOSTS_CTL)
extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, char *client_user);
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) && !defined(HAVE_EXTERN_HOSTS_CTL) */

#ifndef HAVE_EXTERN_INNETGR
extern int innetgr(char *, char *, char *, char *);
#endif /* not HAVE_EXTERN_INNETGR */

#if defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP)
extern int mkstemp(char *);
#endif /* defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP) */

#ifndef HAVE_EXTERN_SBRK
extern caddr_t sbrk(int incr);
#endif /* not HAVE_EXTERN_SBRK */

#if defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID)
extern int seteuid(uid_t euid);
#endif /* not defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID) */

#if defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER)
extern int setitimer(int, struct itimerval *, struct itimerval *);
#endif /* defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER) */

#ifndef HAVE_EXTERN_SLEEP
extern unsigned int sleep(unsigned int seconds);
#endif /* not HAVE_EXTERN_SETITIMER */

#ifndef HAVE_EXTERN_STRCASECMP
/*
 * define this extern even if function does not exist, for it will
 * be filled in by libamu/strcasecmp.c
 */
extern int strcasecmp(const char *s1, const char *s2);
#endif /* not HAVE_EXTERN_STRCASECMP */

#ifndef HAVE_EXTERN_STRDUP
/*
 * define this extern even if function does not exist, for it will
 * be filled in by libamu/strdup.c
 */
extern char *strdup(const char *s);
#endif /* not HAVE_EXTERN_STRDUP */

#ifndef HAVE_EXTERN_STRLCAT
/*
 * define this extern even if function does not exist, for it will
 * be filled in by libamu/strlcat.c
 */
extern size_t strlcat(char *dst, const char *src, size_t siz);
#endif /* not HAVE_EXTERN_STRLCAT */

#ifndef HAVE_EXTERN_STRLCPY
/*
 * define this extern even if function does not exist, for it will
 * be filled in by libamu/strlcpy.c
 */
extern size_t strlcpy(char *dst, const char *src, size_t siz);
#endif /* not HAVE_EXTERN_STRLCPY */

#if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR)
extern char *strstr(const char *s1, const char *s2);
#endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */

#if defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP)
extern int usleep(u_int useconds);
#endif /* defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP) */

#ifndef HAVE_EXTERN_UALARM
extern u_int ualarm(u_int usecs, u_int interval);
#endif /* not HAVE_EXTERN_UALARM */

#if defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3)
extern int wait3(int *statusp, int options, struct rusage *rusage);
#endif /* defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3) */

#if defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF)
extern int vsnprintf(char *, int, const char *, ...);
#endif /* defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF) */

#ifndef HAVE_EXTERN_XDR_CALLMSG
extern bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *msg);
#endif /* not HAVE_EXTERN_XDR_CALLMSG */

#ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH
extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
#endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */

/****************************************************************************/
/*
 * amd-specific header files.
 */
#ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE
# include <amu_nfs_prot.h>
#endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */
#include <am_compat.h>
#include <am_xdr_func.h>
#include <am_utils.h>
#include <amq_defs.h>
#include <aux_conf.h>


/****************************************************************************/
/*
 * External definitions that depend on other macros available (or not)
 * and those are probably declared in any of the above headers.
 */

#ifdef HAVE_HASMNTOPT
# ifdef HAVE_BAD_HASMNTOPT
extern char *amu_hasmntopt(mntent_t *mnt, char *opt);
# else /* not HAVE_BAD_HASMNTOPT */
#  define amu_hasmntopt hasmntopt
# endif /* not HAVE_BAD_HASMNTOPT */
#else /* not HAVE_HASMNTOPT */
extern char *amu_hasmntopt(mntent_t *mnt, char *opt);
#endif /* not HAVE_HASMNTOPT */

#endif /* not _AM_DEFS_H */
OpenPOWER on IntegriCloud