Kernel tree reorganization stage 2: Major cvs repository work.
[dragonfly.git] / contrib / amd / include / am_defs.h
1 /*
2  * Copyright (c) 1997-1999 Erez Zadok
3  * Copyright (c) 1990 Jan-Simon Pendry
4  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
5  * Copyright (c) 1990 The Regents of the University of California.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Jan-Simon Pendry at Imperial College, London.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgment:
21  *      This product includes software developed by the University of
22  *      California, Berkeley and its contributors.
23  * 4. Neither the name of the University nor the names of its contributors
24  *    may be used to endorse or promote products derived from this software
25  *    without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  *
39  *      %W% (Berkeley) %G%
40  *
41  * $Id: am_defs.h,v 1.11 1999/09/18 08:38:05 ezk Exp $
42  * $FreeBSD: src/contrib/amd/include/am_defs.h,v 1.8 1999/11/05 11:58:03 obrien Exp $
43  * $DragonFly: src/contrib/amd/include/am_defs.h,v 1.3 2003/08/08 04:18:29 dillon Exp $
44  *
45  */
46
47 /*
48  * Definitions that are not specific to the am-utils package, but
49  * are rather generic, and can be used elsewhere.
50  */
51
52 #ifndef _AM_DEFS_H
53 #define _AM_DEFS_H
54
55 /*
56  * Actions to take if ANSI C.
57  */
58 #if STDC_HEADERS
59 # include <string.h>
60 /* for function prototypes */
61 # define P(x) x
62 # define P_void void
63 #else /* not STDC_HEADERS */
64 /* empty function prototypes */
65 # define P(x) ()
66 # define P_void
67 # ifndef HAVE_STRCHR
68 #  define strchr index
69 #  define strrchr rindex
70 # endif /* not HAVE_STRCHR */
71 char *strchr(), *strrchr(), *strdup();
72 #endif /* not STDC_HEADERS */
73
74 /*
75  * Handle gcc __attribute__ if available.
76  */
77 #ifndef __attribute__
78 /* This feature is available in gcc versions 2.5 and later.  */
79 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
80 #  define __attribute__(Spec) /* empty */
81 # endif /* __GNUC__ < 2 ... */
82 /*
83  * The __-protected variants of `format' and `printf' attributes
84  * are accepted by gcc versions 2.6.4 (effectively 2.7) and later.
85  */
86 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
87 #  define __format__ format
88 #  define __printf__ printf
89 # endif /* __GNUC__ < 2 ... */
90 #endif /* not __attribute__ */
91
92 /*
93  * How to handle signals of any type
94  */
95 #ifdef HAVE_SYS_WAIT_H
96 # include <sys/wait.h>
97 #endif /* HAVE_SYS_WAIT_H */
98 #ifndef WEXITSTATUS
99 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
100 #endif /* not WEXITSTATUS */
101 #ifndef WIFEXITED
102 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
103 #endif /* not WIFEXITED */
104
105 /*
106  * Actions to take regarding <time.h> and <sys/time.h>.
107  */
108 #if TIME_WITH_SYS_TIME
109 # include <sys/time.h>
110 # include <time.h>
111 #else /* not TIME_WITH_SYS_TIME */
112 # if HAVE_SYS_TIME_H
113 #  include <sys/time.h>
114 # else /* not HAVE_SYS_TIME_H */
115 #  include <time.h>
116 # endif /* not HAVE_SYS_TIME_H */
117 #endif /* not TIME_WITH_SYS_TIME */
118
119 /*
120  * Actions to take if <machine/endian.h> exists.
121  */
122 #ifdef HAVE_MACHINE_ENDIAN_H
123 # include <machine/endian.h>
124 #endif /* HAVE_MACHINE_ENDIAN_H */
125
126 /*
127  * Big-endian or little-endian?
128  */
129 #ifdef WORDS_BIGENDIAN
130 # define ARCH_ENDIAN "big"
131 #else /* not WORDS_BIGENDIAN */
132 # define ARCH_ENDIAN "little"
133 #endif /* not WORDS_BIGENDIAN */
134
135 /*
136  * Actions to take if HAVE_SYS_TYPES_H is defined.
137  */
138 #if HAVE_SYS_TYPES_H
139 # include <sys/types.h>
140 #endif /* HAVE_SYS_TYPES_H */
141
142 /*
143  * Actions to take if HAVE_UNISTD_H is defined.
144  */
145 #if HAVE_UNISTD_H
146 # include <unistd.h>
147 #endif /* HAVE_UNISTD_H */
148
149 /* after <unistd.h>, check if this is a POSIX.1 system */
150 #ifdef _POSIX_VERSION
151 /* Code for POSIX.1 systems. */
152 #endif /* _POSIX_VERSION */
153
154 /*
155  * Variable length argument lists.
156  * Must use only one of the two!
157  */
158 #ifdef HAVE_STDARG_H
159 # include <stdarg.h>
160 /*
161  * On Solaris 2.6, <sys/varargs.h> is included in <sys/fs/autofs.h>
162  * So this ensures that only one is included.
163  */
164 # ifndef _SYS_VARARGS_H
165 #  define _SYS_VARARGS_H
166 # endif /* not _SYS_VARARGS_H */
167 #else /* not HAVE_STDARG_H */
168 # ifdef HAVE_VARARGS_H
169 #  include <varargs.h>
170 # endif /* HAVE_VARARGS_H */
171 #endif /* not HAVE_STDARG_H */
172
173 /*
174  * Pick the right header file and macros for directory processing functions.
175  */
176 #if HAVE_DIRENT_H
177 # include <dirent.h>
178 # define NAMLEN(dirent) strlen((dirent)->d_name)
179 #else /* not HAVE_DIRENT_H */
180 # define dirent direct
181 # define NAMLEN(dirent) (dirent)->d_namlen
182 # if HAVE_SYS_NDIR_H
183 #  include <sys/ndir.h>
184 # endif /* HAVE_SYS_NDIR_H */
185 # if HAVE_SYS_DIR_H
186 #  include <sys/dir.h>
187 # endif /* HAVE_SYS_DIR_H */
188 # if HAVE_NDIR_H
189 #  include <ndir.h>
190 # endif /* HAVE_NDIR_H */
191 #endif /* not HAVE_DIRENT_H */
192
193 /*
194  * Actions to take if HAVE_FCNTL_H is defined.
195  */
196 #if HAVE_FCNTL_H
197 # include <fcntl.h>
198 #endif /* HAVE_FCNTL_H */
199
200 /*
201  * Actions to take if HAVE_MEMORY_H is defined.
202  */
203 #if HAVE_MEMORY_H
204 # include <memory.h>
205 #endif /* HAVE_MEMORY_H */
206
207 /*
208  * Actions to take if HAVE_SYS_FILE_H is defined.
209  */
210 #if HAVE_SYS_FILE_H
211 # include <sys/file.h>
212 #endif /* HAVE_SYS_FILE_H */
213
214 /*
215  * Actions to take if HAVE_SYS_IOCTL_H is defined.
216  */
217 #if HAVE_SYS_IOCTL_H
218 # include <sys/ioctl.h>
219 #endif /* HAVE_SYS_IOCTL_H */
220
221 /*
222  * Actions to take if HAVE_SYSLOG_H or HAVE_SYS_SYSLOG_H is defined.
223  */
224 #ifdef HAVE_SYSLOG_H
225 # include <syslog.h>
226 #else /* not HAVE_SYSLOG_H */
227 # if HAVE_SYS_SYSLOG_H
228 #  include <sys/syslog.h>
229 # endif /* HAVE_SYS_SYSLOG_H */
230 #endif /* HAVE_SYSLOG_H */
231
232 /*
233  * Actions to take if <sys/param.h> exists.
234  */
235 #ifdef HAVE_SYS_PARAM_H
236 # include <sys/param.h>
237 #endif /* HAVE_SYS_PARAM_H */
238
239 /*
240  * Actions to take if <sys/socket.h> exists.
241  */
242 #ifdef HAVE_SYS_SOCKET_H
243 # include <sys/socket.h>
244 #endif /* HAVE_SYS_SOCKET_H */
245
246 /*
247  * Actions to take if <rpc/rpc.h> exists.
248  */
249 #ifdef HAVE_RPC_RPC_H
250 /*
251  * Turn on PORTMAP, so that additional header files would get included
252  * and the important definition for UDPMSGSIZE is included too.
253  */
254 # ifndef PORTMAP
255 #  define PORTMAP
256 # endif /* not PORTMAP */
257 # include <rpc/rpc.h>
258 # ifndef XDRPROC_T_TYPE
259 typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
260 # endif /* not XDRPROC_T_TYPE */
261 #endif /* HAVE_RPC_RPC_H */
262
263 /*
264  * Actions to take if <rpc/types.h> exists.
265  */
266 #ifdef HAVE_RPC_TYPES_H
267 # include <rpc/types.h>
268 #endif /* HAVE_RPC_TYPES_H */
269
270 /*
271  * Actions to take if <rpc/xdr.h> exists.
272  */
273 /* Prevent multiple inclusion on Ultrix 4 */
274 #if defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__)
275 # include <rpc/xdr.h>
276 #endif /* defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__) */
277
278 /*
279  * Actions to take if <malloc.h> exists.
280  */
281 #ifdef HAVE_MALLOC_H
282 # include <malloc.h>
283 #endif /* HAVE_MALLOC_H */
284
285 /*
286  * Actions to take if <mntent.h> exists.
287  */
288 #ifdef HAVE_MNTENT_H
289 /* some systems need <stdio.h> before <mntent.h> is included */
290 # ifdef HAVE_STDIO_H
291 #  include <stdio.h>
292 # endif /* HAVE_STDIO_H */
293 # include <mntent.h>
294 #endif /* HAVE_MNTENT_H */
295
296 /*
297  * Actions to take if <sys/errno.h> exists.
298  */
299 #ifdef HAVE_SYS_ERRNO_H
300 # include <sys/errno.h>
301 extern int errno;
302 #endif /* HAVE_SYS_ERRNO_H */
303
304 /*
305  * Actions to take if <sys/fsid.h> exists.
306  */
307 #ifdef HAVE_SYS_FSID_H
308 # include <sys/fsid.h>
309 #endif /* HAVE_SYS_FSID_H */
310
311 /*
312  * Actions to take if <sys/utsname.h> exists.
313  */
314 #ifdef HAVE_SYS_UTSNAME_H
315 # include <sys/utsname.h>
316 #endif /* HAVE_SYS_UTSNAME_H */
317
318 /*
319  * Actions to take if <sys/mntent.h> exists.
320  */
321 #ifdef HAVE_SYS_MNTENT_H
322 # include <sys/mntent.h>
323 #endif /* HAVE_SYS_MNTENT_H */
324
325 /*
326  * Actions to take if <ndbm.h> or <db1/ndbm.h> exist.
327  * Should be included before <rpcsvc/yp_prot.h> because on some systems
328  * like Linux, it also defines "struct datum".
329  */
330 #ifdef HAVE_NDBM_H
331 # include <ndbm.h>
332 # ifndef DATUM
333 /* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
334 #  define DATUM
335 # endif /* not DATUM */
336 #endif /* HAVE_NDBM_H */
337 #ifdef HAVE_DB1_NDBM_H
338 # include <db1/ndbm.h>
339 # ifndef DATUM
340 /* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
341 #  define DATUM
342 # endif /* not DATUM */
343 #endif /* HAVE_DB1_NDBM_H */
344
345 /*
346  * Actions to take if <net/errno.h> exists.
347  */
348 #ifdef HAVE_NET_ERRNO_H
349 # include <net/errno.h>
350 #endif /* HAVE_NET_ERRNO_H */
351
352 /*
353  * Actions to take if <net/route.h> exists.
354  */
355 #ifdef HAVE_NET_ROUTE_H
356 # include <net/route.h>
357 #endif /* HAVE_NET_ROUTE_H */
358
359 /*
360  * Actions to take if <sys/mbuf.h> exists.
361  */
362 #ifdef HAVE_SYS_MBUF_H
363 # include <sys/mbuf.h>
364 /*
365  * OSF4 (DU-4.0) defines m_next and m_data also in <sys/mount.h> so I must
366  # undefine them here to avoid conflicts.
367  */
368 # ifdef m_next
369 #  undef m_next
370 # endif /* m_next */
371 # ifdef m_data
372 #  undef m_data
373 # endif /* m_data */
374 /*
375  * AIX 3 defines MFREE and m_flags also in <sys/mount.h>.
376  */
377 # ifdef m_flags
378 #  undef m_flags
379 # endif /* m_flags */
380 # ifdef MFREE
381 #  undef MFREE
382 # endif /* MFREE */
383 #endif /* HAVE_SYS_MBUF_H */
384
385 /*
386  * Actions to take if <net/if.h> exists.
387  */
388 #ifdef HAVE_NET_IF_H
389 # include <net/if.h>
390 #endif /* HAVE_NET_IF_H */
391
392 /*
393  * Actions to take if <netdb.h> exists.
394  */
395 #ifdef HAVE_NETDB_H
396 # include <netdb.h>
397 #endif /* HAVE_NETDB_H */
398
399 /*
400  * Actions to take if <netdir.h> exists.
401  */
402 #ifdef HAVE_NETDIR_H
403 # include <netdir.h>
404 #endif /* HAVE_NETDIR_H */
405
406 /*
407  * Actions to take if <net/if_var.h> exists.
408  */
409 #ifdef HAVE_NET_IF_VAR_H
410 # include <net/if_var.h>
411 #endif /* HAVE_NET_IF_VAR_H */
412
413 /*
414  * Actions to take if <netinet/if_ether.h> exists.
415  */
416 #ifdef HAVE_NETINET_IF_ETHER_H
417 # include <netinet/if_ether.h>
418 #endif /* HAVE_NETINET_IF_ETHER_H */
419
420 /*
421  * Actions to take if <netinet/in.h> exists.
422  */
423 #ifdef HAVE_NETINET_IN_H
424 # include <netinet/in.h>
425 #endif /* HAVE_NETINET_IN_H */
426
427 /*
428  * Actions to take if <rpcsvc/yp_prot.h> exists.
429  */
430 #ifdef HAVE_RPCSVC_YP_PROT_H
431 # ifdef HAVE_BAD_HEADERS
432 /* avoid circular dependency in aix 4.3 with <rpcsvc/ypclnt.h> */
433 struct ypall_callback;
434 # endif /* HAVE_BAD_HEADERS */
435 # include <rpcsvc/yp_prot.h>
436 #endif /* HAVE_RPCSVC_YP_PROT_H */
437
438 /*
439  * Actions to take if <rpcsvc/ypclnt.h> exists.
440  */
441 #ifdef HAVE_RPCSVC_YPCLNT_H
442 # include <rpcsvc/ypclnt.h>
443 #endif /* HAVE_RPCSVC_YPCLNT_H */
444
445 /*
446  * Actions to take if <sys/ucred.h> exists.
447  */
448 #ifdef HAVE_SYS_UCRED_H
449 # include <sys/ucred.h>
450 #endif /* HAVE_SYS_UCRED_H */
451
452
453 /*
454  * Actions to take if <sys/mount.h> exists.
455  */
456 #ifdef HAVE_SYS_MOUNT_H
457 /*
458  * Some operating systems must define these variables to get
459  * NFS and other definitions included.
460  */
461 # ifndef NFSCLIENT
462 #  define NFSCLIENT
463 # endif /* not NFSCLIENT */
464 # ifndef NFS
465 #  define NFS
466 # endif /* not NFS */
467 # ifndef PCFS
468 #  define PCFS
469 # endif /* not PCFS */
470 # ifndef LOFS
471 #  define LOFS
472 # endif /* not LOFS */
473 # ifndef RFS
474 #  define RFS
475 # endif /* not RFS */
476 # ifndef MSDOSFS
477 #  define MSDOSFS
478 # endif /* not MSDOSFS */
479 # ifndef MFS
480 #  define MFS
481 # endif /* not MFS */
482 # ifndef CD9660
483 #  define CD9660
484 # endif /* not CD9660 */
485 # ifndef NFS
486 #  define NFS
487 # endif /* not NFS */
488 # include <sys/mount.h>
489 #endif /* HAVE_SYS_MOUNT_H */
490
491 #ifdef HAVE_SYS_VMOUNT_H
492 # include <sys/vmount.h>
493 #endif /* HAVE_SYS_VMOUNT_H */
494
495 /*
496  * Actions to take if <linux/fs.h> exists.
497  */
498 #ifdef HAVE_LINUX_FS_H
499 /*
500  * There are various conflicts in definitions between RedHat Linux, newer
501  * 2.2 kernels, and <netinet/in.h> and <linux/fs.h>.
502  */
503 # ifdef HAVE_SOCKETBITS_H
504 /* conflicts with <socketbits.h> */
505 #  define _LINUX_SOCKET_H
506 #  undef BLKFLSBUF
507 #  undef BLKGETSIZE
508 #  undef BLKRAGET
509 #  undef BLKRASET
510 #  undef BLKROGET
511 #  undef BLKROSET
512 #  undef BLKRRPART
513 #  undef MS_MGC_VAL
514 #  undef MS_RMT_MASK
515 #  if defined(__GLIBC__) && __GLIBC__ >= 2
516 /* conflicts with <waitflags.h> */
517 #   undef WNOHANG
518 #   undef WUNTRACED
519 #  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
520 /* conflicts with <statfsbuf.h> */
521 #  define _SYS_STATFS_H
522 # endif /* HAVE_SOCKETBITS_H */
523
524 # ifdef _SYS_WAIT_H
525 #  if defined(__GLIBC__) && __GLIBC__ >= 2
526 /* conflicts with <bits/waitflags.h> (RedHat/Linux 6.0 and kernels 2.2 */
527 #   undef WNOHANG
528 #   undef WUNTRACED
529 #  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
530 # endif /* _SYS_WAIT_H */
531
532 # ifdef HAVE_LINUX_POSIX_TYPES_H
533 #  include <linux/posix_types.h>
534 # endif /* HAVE_LINUX_POSIX_TYPES_H */
535 # ifndef _LINUX_BYTEORDER_GENERIC_H
536 #  define _LINUX_BYTEORDER_GENERIC_H
537 # endif /* _LINUX_BYTEORDER_GENERIC_H */
538 /* conflicts with <sys/mount.h> in 2.[12] kernels */
539 # ifdef _SYS_MOUNT_H
540 #  undef BLKFLSBUF
541 #  undef BLKGETSIZE
542 #  undef BLKRAGET
543 #  undef BLKRASET
544 #  undef BLKROGET
545 #  undef BLKROSET
546 #  undef BLKRRPART
547 #  undef BLOCK_SIZE
548 #  undef MS_MANDLOCK
549 #  undef MS_MGC_VAL
550 #  undef MS_NOATIME
551 #  undef MS_NODEV
552 #  undef MS_NODIRATIME
553 #  undef MS_NOEXEC
554 #  undef MS_NOSUID
555 #  undef MS_RDONLY
556 #  undef MS_REMOUNT
557 #  undef MS_RMT_MASK
558 #  undef MS_SYNCHRONOUS
559 #  undef S_APPEND
560 #  undef S_IMMUTABLE
561 /* conflicts with <statfsbuf.h> */
562 #  define _SYS_STATFS_H
563 # endif /* _SYS_MOUNT_H */
564 # include <linux/fs.h>
565 #endif /* HAVE_LINUX_FS_H */
566
567 #ifdef HAVE_CDFS_CDFS_MOUNT_H
568 # include <cdfs/cdfs_mount.h>
569 #endif /* HAVE_CDFS_CDFS_MOUNT_H */
570
571 #ifdef HAVE_CDFS_CDFSMOUNT_H
572 # include <cdfs/cdfsmount.h>
573 #endif /* HAVE_CDFS_CDFSMOUNT_H */
574
575 /*
576  * Actions to take if <linux/auto_fs.h> exists.
577  */
578 #ifdef HAVE_LINUX_AUTO_FS_H
579 # include <linux/auto_fs.h>
580 #endif /* HAVE_LINUX_AUTO_FS_H */
581
582 /*
583  * Actions to take if <sys/fs/autofs.h> exists.
584  */
585 #ifdef HAVE_SYS_FS_AUTOFS_H
586 # include <sys/fs/autofs.h>
587 #endif /* HAVE_SYS_FS_AUTOFS_H */
588
589 /*
590  * Actions to take if <sys/fs/autofs_prot.h> exists.
591  */
592 #ifdef HAVE_SYS_FS_AUTOFS_PROT_H
593 # include <sys/fs/autofs_prot.h>
594 #endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
595
596 /*
597  * NFS PROTOCOL HEADER FILES:
598  */
599
600 /*
601  * Actions to take if <nfs/export.h> exists.
602  */
603 #ifdef HAVE_NFS_EXPORT_H
604 # include <nfs/export.h>
605 #endif /* HAVE_NFS_EXPORT_H */
606
607 /****************************************************************************
608  ** IMPORTANT!!!                                                           **
609  ** We always include am-util's amu_nfs_prot.h.                            **
610  ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" **
611  ****************************************************************************/
612 #include <amu_nfs_prot.h>
613
614 /*
615  * DO NOT INCLUDE THESE FILES:
616  * They conflicts with other NFS headers and are generally not needed.
617  */
618 #ifdef DO_NOT_INCLUDE
619 # ifdef HAVE_NFS_NFS_CLNT_H
620 #  include <nfs/nfs_clnt.h>
621 # endif /* HAVE_NFS_NFS_CLNT_H */
622 # ifdef HAVE_LINUX_NFS_H
623 #  include <linux/nfs.h>
624 # endif /* HAVE_LINUX_NFS_H */
625 #endif /* DO NOT INCLUDE */
626
627 /*
628  * Actions to take if one of the nfs headers exists.
629  */
630 #ifdef HAVE_NFS_NFS_GFS_H
631 # include <nfs/nfs_gfs.h>
632 #endif /* HAVE_NFS_NFS_GFS_H */
633 #ifdef HAVE_NFS_MOUNT_H
634 # include <nfs/mount.h>
635 #endif /* HAVE_NFS_MOUNT_H */
636 #ifdef HAVE_NFS_NFS_MOUNT_H_off
637 /* broken on nexttep3 (includes non-existing headers) */
638 # include <nfs/nfs_mount.h>
639 #endif /* HAVE_NFS_NFS_MOUNT_H */
640 #ifdef HAVE_NFS_PATHCONF_H
641 # include <nfs/pathconf.h>
642 #endif /* HAVE_NFS_PATHCONF_H */
643 #ifdef HAVE_SYS_FS_NFS_MOUNT_H
644 # include <sys/fs/nfs/mount.h>
645 #endif /* HAVE_SYS_FS_NFS_MOUNT_H */
646 #ifdef HAVE_SYS_FS_NFS_NFS_CLNT_H
647 # include <sys/fs/nfs/nfs_clnt.h>
648 #endif /* HAVE_SYS_FS_NFS_NFS_CLNT_H */
649 #ifdef HAVE_SYS_FS_NFS_CLNT_H
650 # include <sys/fs/nfs_clnt.h>
651 #endif /* HAVE_SYS_FS_NFS_CLNT_H */
652 #ifdef HAVE_LINUX_NFS_MOUNT_H
653 # include <linux/nfs_mount.h>
654 #endif /* HAVE_LINUX_NFS_MOUNT_H */
655
656 /*
657  * Actions to take if <pwd.h> exists.
658  */
659 #ifdef HAVE_PWD_H
660 # include <pwd.h>
661 #endif /* HAVE_PWD_H */
662
663 /*
664  * Actions to take if <hesiod.h> exists.
665  */
666 #ifdef HAVE_HESIOD_H
667 # include <hesiod.h>
668 #endif /* HAVE_HESIOD_H */
669
670 /*
671  * Actions to take if <lber.h> exists.
672  * This header file is required before <ldap.h> can be included.
673  */
674 #ifdef HAVE_LBER_H
675 # include <lber.h>
676 #endif /* HAVE_LBER_H */
677
678 /*
679  * Actions to take if <ldap.h> exists.
680  */
681 #ifdef HAVE_LDAP_H
682 # include <ldap.h>
683 #endif /* HAVE_LDAP_H */
684
685 /*
686  * Actions to take if <arpa/nameser.h> exists.
687  * Should be included before <resolv.h>.
688  */
689 #ifdef HAVE_ARPA_NAMESER_H
690 # ifdef NOERROR
691 #  undef NOERROR
692 # endif /* NOERROR */
693 /*
694  * Conflicts with <sys/tpicommon.h> which is included from <sys/tiuser.h>
695  * on Solaris 2.6 systems.  So undefine it first.
696  */
697 # ifdef T_UNSPEC
698 #  undef T_UNSPEC
699 # endif /* T_UNSPEC */
700 # include <arpa/nameser.h>
701 #endif /* HAVE_ARPA_NAMESER_H */
702
703 /*
704  * Actions to take if <arpa/inet.h> exists.
705  */
706 #ifdef HAVE_ARPA_INET_H
707 # ifdef HAVE_BAD_HEADERS
708 /* aix 4.3: avoid including <net/if_dl.h> */
709 struct sockaddr_dl;
710 # endif /* HAVE_BAD_HEADERS */
711 # include <arpa/inet.h>
712 #endif /* HAVE_ARPA_INET_H */
713
714 /*
715  * Actions to take if <resolv.h> exists.
716  */
717 #ifdef HAVE_RESOLV_H
718 # include <resolv.h>
719 #endif /* HAVE_RESOLV_H */
720
721 /*
722  * Actions to take if <sys/uio.h> exists.
723  */
724 #ifdef HAVE_SYS_UIO_H
725 # include <sys/uio.h>
726 #endif /* HAVE_SYS_UIO_H */
727
728 /*
729  * Actions to take if <sys/fs/cachefs_fs.h> exists.
730  */
731 #ifdef HAVE_SYS_FS_CACHEFS_FS_H
732 # include <sys/fs/cachefs_fs.h>
733 #endif /* HAVE_SYS_FS_CACHEFS_FS_H */
734
735 /*
736  * Actions to take if <sys/fs/pc_fs.h> exists.
737  */
738 #ifdef HAVE_SYS_FS_PC_FS_H
739 # include <sys/fs/pc_fs.h>
740 #endif /* HAVE_SYS_FS_PC_FS_H */
741
742 /*
743  * Actions to take if <msdosfs/msdosfsmount.h> exists.
744  */
745 #ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
746 # include <msdosfs/msdosfsmount.h>
747 #endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
748
749 /*
750  * Actions to take if <sys/fs/tmp.h> exists.
751  */
752 #ifdef HAVE_SYS_FS_TMP_H
753 # include <sys/fs/tmp.h>
754 #endif /* HAVE_SYS_FS_TMP_H */
755
756 /*
757  * Actions to take if <sys/fs/ufs_mount.h> exists.
758  */
759 #ifdef HAVE_SYS_FS_UFS_MOUNT_H
760 # include <sys/fs/ufs_mount.h>
761 #endif /* HAVE_SYS_FS_UFS_MOUNT_H */
762 #ifdef  HAVE_UFS_UFS_UFSMOUNT_H_off
763 # error do not include this file here because on netbsd/openbsd it
764 # error causes errors with other header files.  Instead, add it to the
765 # error specific conf/nfs_prot_*.h file.
766 # include <vfs/ufs/ufsmount.h>
767 #endif  /* HAVE_UFS_UFS_UFSMOUNT_H */
768
769 /*
770  * Actions to take if <sys/fs/efs_clnt.h> exists.
771  */
772 #ifdef HAVE_SYS_FS_EFS_CLNT_H
773 # include <sys/fs/efs_clnt.h>
774 #endif /* HAVE_SYS_FS_EFS_CLNT_H */
775
776 /*
777  * Actions to take if <sys/fs/xfs_clnt.h> exists.
778  */
779 #ifdef HAVE_SYS_FS_XFS_CLNT_H
780 # include <sys/fs/xfs_clnt.h>
781 #endif /* HAVE_SYS_FS_XFS_CLNT_H */
782
783 /*
784  * Actions to take if <assert.h> exists.
785  */
786 #ifdef HAVE_ASSERT_H
787 # include <assert.h>
788 #endif /* HAVE_ASSERT_H */
789
790 /*
791  * Actions to take if <cfs.h> exists.
792  */
793 #ifdef HAVE_CFS_H
794 # include <cfs.h>
795 #endif /* HAVE_CFS_H */
796
797 /*
798  * Actions to take if <cluster.h> exists.
799  */
800 #ifdef HAVE_CLUSTER_H
801 # include <cluster.h>
802 #endif /* HAVE_CLUSTER_H */
803
804 /*
805  * Actions to take if <ctype.h> exists.
806  */
807 #ifdef HAVE_CTYPE_H
808 # include <ctype.h>
809 #endif /* HAVE_CTYPE_H */
810
811 /*
812  * Actions to take if <errno.h> exists.
813  */
814 #ifdef HAVE_ERRNO_H
815 # include <errno.h>
816 #endif /* HAVE_ERRNO_H */
817
818 /*
819  * Actions to take if <grp.h> exists.
820  */
821 #ifdef HAVE_GRP_H
822 # include <grp.h>
823 #endif /* HAVE_GRP_H */
824
825 /*
826  * Actions to take if <hsfs/hsfs.h> exists.
827  */
828 #ifdef HAVE_HSFS_HSFS_H
829 # include <hsfs/hsfs.h>
830 #endif /* HAVE_HSFS_HSFS_H */
831
832 /*
833  * Actions to take if <cdfs/cdfsmount.h> exists.
834  */
835 #ifdef HAVE_CDFS_CDFSMOUNT_H
836 # include <cdfs/cdfsmount.h>
837 #endif /* HAVE_CDFS_CDFSMOUNT_H */
838
839 /*
840  * Actions to take if <isofs/cd9660/cd9660_mount.h> exists.
841  */
842 #ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
843 # include <isofs/cd9660/cd9660_mount.h>
844 #endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
845
846 /*
847  * Actions to take if <mount.h> exists.
848  */
849 #ifdef HAVE_MOUNT_H
850 # include <mount.h>
851 #endif /* HAVE_MOUNT_H */
852
853 /*
854  * Actions to take if <nsswitch.h> exists.
855  */
856 #ifdef HAVE_NSSWITCH_H
857 # include <nsswitch.h>
858 #endif /* HAVE_NSSWITCH_H */
859
860 /*
861  * Actions to take if <rpc/auth_des.h> exists.
862  */
863 #ifdef HAVE_RPC_AUTH_DES_H
864 # include <rpc/auth_des.h>
865 #endif /* HAVE_RPC_AUTH_DES_H */
866
867 /*
868  * Actions to take if <rpc/pmap_clnt.h> exists.
869  */
870 #ifdef HAVE_RPC_PMAP_CLNT_H
871 # include <rpc/pmap_clnt.h>
872 #endif /* HAVE_RPC_PMAP_CLNT_H */
873
874 /*
875  * Actions to take if <rpc/pmap_prot.h> exists.
876  */
877 #ifdef HAVE_RPC_PMAP_PROT_H
878 # include <rpc/pmap_prot.h>
879 #endif /* HAVE_RPC_PMAP_PROT_H */
880
881
882 /*
883  * Actions to take if <rpcsvc/mount.h> exists.
884  * AIX does not protect against this file doubly included,
885  * so I have to do my own protection here.
886  */
887 #ifdef COMMENT_OUT
888 #ifdef HAVE_RPCSVC_MOUNT_H
889 # ifndef _RPCSVC_MOUNT_H
890 #  include <rpcsvc/mount.h>
891 # endif /* not _RPCSVC_MOUNT_H */
892 #endif /* HAVE_RPCSVC_MOUNT_H */
893 #endif
894 #  include "mount.h"
895
896 /*
897  * Actions to take if <rpcsvc/nis.h> exists.
898  */
899 #ifdef HAVE_RPCSVC_NIS_H
900 # include <rpcsvc/nis.h>
901 #endif /* HAVE_RPCSVC_NIS_H */
902
903 /*
904  * Actions to take if <setjmp.h> exists.
905  */
906 #ifdef HAVE_SETJMP_H
907 # include <setjmp.h>
908 #endif /* HAVE_SETJMP_H */
909
910 /*
911  * Actions to take if <signal.h> exists.
912  */
913 #ifdef HAVE_SIGNAL_H
914 # include <signal.h>
915 #endif /* HAVE_SIGNAL_H */
916
917 /*
918  * Actions to take if <string.h> exists.
919  */
920 #ifdef HAVE_STRING_H
921 # include <string.h>
922 #endif /* HAVE_STRING_H */
923
924 /*
925  * Actions to take if <strings.h> exists.
926  */
927 #ifdef HAVE_STRINGS_H
928 # include <strings.h>
929 #endif /* HAVE_STRINGS_H */
930
931 /*
932  * Actions to take if <sys/config.h> exists.
933  */
934 #ifdef HAVE_SYS_CONFIG_H
935 # include <sys/config.h>
936 #endif /* HAVE_SYS_CONFIG_H */
937
938 /*
939  * Actions to take if <sys/dg_mount.h> exists.
940  */
941 #ifdef HAVE_SYS_DG_MOUNT_H
942 # include <sys/dg_mount.h>
943 #endif /* HAVE_SYS_DG_MOUNT_H */
944
945 /*
946  * Actions to take if <sys/fs_types.h> exists.
947  */
948 #ifdef HAVE_SYS_FS_TYPES_H
949 /*
950  * Define KERNEL here to avoid multiple definitions of gt_names[] on
951  * Ultrix 4.3.
952  */
953 # define KERNEL
954 # include <sys/fs_types.h>
955 # undef KERNEL
956 #endif /* HAVE_SYS_FS_TYPES_H */
957
958 /*
959  * Actions to take if <sys/fstyp.h> exists.
960  */
961 #ifdef HAVE_SYS_FSTYP_H
962 # include <sys/fstyp.h>
963 #endif /* HAVE_SYS_FSTYP_H */
964
965 /*
966  * Actions to take if <sys/lock.h> exists.
967  */
968 #ifdef HAVE_SYS_LOCK_H
969 # include <sys/lock.h>
970 #endif /* HAVE_SYS_LOCK_H */
971
972 /*
973  * Actions to take if <sys/machine.h> exists.
974  */
975 #ifdef HAVE_SYS_MACHINE_H
976 # include <sys/machine.h>
977 #endif /* HAVE_SYS_MACHINE_H */
978
979 /*
980  * Actions to take if <sys/mntctl.h> exists.
981  */
982 #ifdef HAVE_SYS_MNTCTL_H
983 # include <sys/mntctl.h>
984 #endif /* HAVE_SYS_MNTCTL_H */
985
986 /*
987  * Actions to take if <sys/mnttab.h> exists.
988  */
989 #ifdef HAVE_SYS_MNTTAB_H
990 # include <sys/mnttab.h>
991 #endif /* HAVE_SYS_MNTTAB_H */
992
993 /*
994  * Actions to take if <mnttab.h> exists.
995  * Do not include it if MNTTAB is already defined because it probably
996  * came from <sys/mnttab.h> and we do not want conflicting definitions.
997  */
998 #if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
999 # include <mnttab.h>
1000 #endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
1001
1002 /*
1003  * Actions to take if <netconfig.h> exists.
1004  */
1005 #ifdef HAVE_NETCONFIG_H
1006 # include <netconfig.h>
1007 /* Some systems (Solaris 2.5.1) don't declare this external */
1008 extern char *nc_sperror(void);
1009 #endif /* HAVE_NETCONFIG_H */
1010
1011 /*
1012  * Actions to take if <sys/netconfig.h> exists.
1013  */
1014 #ifdef HAVE_SYS_NETCONFIG_H
1015 # include <sys/netconfig.h>
1016 #endif /* HAVE_SYS_NETCONFIG_H */
1017
1018 /*
1019  * Actions to take if <sys/pathconf.h> exists.
1020  */
1021 #ifdef HAVE_SYS_PATHCONF_H
1022 # include <sys/pathconf.h>
1023 #endif /* HAVE_SYS_PATHCONF_H */
1024
1025 /*
1026  * Actions to take if <sys/resource.h> exists.
1027  */
1028 #ifdef HAVE_SYS_RESOURCE_H
1029 # include <sys/resource.h>
1030 #endif /* HAVE_SYS_RESOURCE_H */
1031
1032 /*
1033  * Actions to take if <sys/sema.h> exists.
1034  */
1035 #ifdef HAVE_SYS_SEMA_H
1036 # include <sys/sema.h>
1037 #endif /* HAVE_SYS_SEMA_H */
1038
1039 /*
1040  * Actions to take if <sys/signal.h> exists.
1041  */
1042 #ifdef HAVE_SYS_SIGNAL_H
1043 # include <sys/signal.h>
1044 #endif /* HAVE_SYS_SIGNAL_H */
1045
1046 /*
1047  * Actions to take if <sys/sockio.h> exists.
1048  */
1049 #ifdef HAVE_SYS_SOCKIO_H
1050 # include <sys/sockio.h>
1051 #endif /* HAVE_SYS_SOCKIO_H */
1052
1053 /*
1054  * Actions to take if <sys/syscall.h> exists.
1055  */
1056 #ifdef HAVE_SYS_SYSCALL_H
1057 # include <sys/syscall.h>
1058 #endif /* HAVE_SYS_SYSCALL_H */
1059
1060 /*
1061  * Actions to take if <sys/syslimits.h> exists.
1062  */
1063 #ifdef HAVE_SYS_SYSLIMITS_H
1064 # include <sys/syslimits.h>
1065 #endif /* HAVE_SYS_SYSLIMITS_H */
1066
1067 /*
1068  * Actions to take if <tiuser.h> exists.
1069  */
1070 #ifdef HAVE_TIUSER_H
1071 /*
1072  * Some systems like AIX have multiple definitions for T_NULL and others
1073  * that are defined first in <arpa/nameser.h>.
1074  */
1075 # ifdef HAVE_ARPA_NAMESER_H
1076 #  ifdef T_NULL
1077 #   undef T_NULL
1078 #  endif /* T_NULL */
1079 #  ifdef T_UNSPEC
1080 #   undef T_UNSPEC
1081 #  endif /* T_UNSPEC */
1082 #  ifdef T_IDLE
1083 #   undef T_IDLE
1084 #  endif /* T_IDLE */
1085 # endif /* HAVE_ARPA_NAMESER_H */
1086 # include <tiuser.h>
1087 #endif /* HAVE_TIUSER_H */
1088
1089 /*
1090  * Actions to take if <sys/tiuser.h> exists.
1091  */
1092 #ifdef HAVE_SYS_TIUSER_H
1093 # include <sys/tiuser.h>
1094 #endif /* HAVE_SYS_TIUSER_H */
1095
1096 /*
1097  * Actions to take if <sys/statfs.h> exists.
1098  */
1099 #ifdef HAVE_SYS_STATFS_H
1100 # include <sys/statfs.h>
1101 #endif /* HAVE_SYS_STATFS_H */
1102
1103 /*
1104  * Actions to take if <sys/vfs.h> exists.
1105  */
1106 #ifdef HAVE_SYS_VFS_H
1107 # include <sys/vfs.h>
1108 #endif /* HAVE_SYS_VFS_H */
1109
1110 /*
1111  * Actions to take if <sys/vmount.h> exists.
1112  */
1113 #ifdef HAVE_SYS_VMOUNT_H
1114 # include <sys/vmount.h>
1115 #endif /* HAVE_SYS_VMOUNT_H */
1116
1117 /*
1118  * Actions to take if <ufs/ufs_mount.h> exists.
1119  */
1120 #ifdef HAVE_UFS_UFS_MOUNT_H
1121 # include <vfs/ufs/ufsmount.h>
1122 #endif /* HAVE_UFS_UFS_MOUNT_H */
1123
1124 /*
1125  * Are S_ISDIR, S_ISREG, et al broken?  If not, include <sys/stat.h>.
1126  * Turned off the not using sys/stat.h based on if the macros are
1127  * "broken", because they incorrectly get reported as broken on
1128  * ncr2.
1129  */
1130 #ifndef STAT_MACROS_BROKEN_notused
1131 /*
1132  * RedHat Linux 4.2 (alpha) has a problem in the headers that causes
1133  * duplicate definitions, and also some other nasty bugs.  Upgrade to Redhat
1134  * 5.0!
1135  */
1136 # ifdef HAVE_SYS_STAT_H
1137 /* avoid duplicates or conflicts with <linux/stat.h> (RedHat alpha linux) */
1138 #  if defined(S_IFREG) && defined(HAVE_STATBUF_H)
1139 #   include <statbuf.h>
1140 #   undef S_IFBLK
1141 #   undef S_IFCHR
1142 #   undef S_IFDIR
1143 #   undef S_IFIFO
1144 #   undef S_IFLNK
1145 #   undef S_IFMT
1146 #   undef S_IFREG
1147 #   undef S_IFSOCK
1148 #   undef S_IRGRP
1149 #   undef S_IROTH
1150 #   undef S_IRUSR
1151 #   undef S_IRWXG
1152 #   undef S_IRWXO
1153 #   undef S_IRWXU
1154 #   undef S_ISBLK
1155 #   undef S_ISCHR
1156 #   undef S_ISDIR
1157 #   undef S_ISFIFO
1158 #   undef S_ISGID
1159 #   undef S_ISLNK
1160 #   undef S_ISREG
1161 #   undef S_ISSOCK
1162 #   undef S_ISUID
1163 #   undef S_ISVTX
1164 #   undef S_IWGRP
1165 #   undef S_IWOTH
1166 #   undef S_IWUSR
1167 #   undef S_IXGRP
1168 #   undef S_IXOTH
1169 #   undef S_IXUSR
1170 #  endif /* defined(S_IFREG) && defined(HAVE_STATBUF_H) */
1171 #  include <sys/stat.h>
1172 # endif /* HAVE_SYS_STAT_H */
1173 #endif /* not STAT_MACROS_BROKEN_notused */
1174
1175 /*
1176  * Actions to take if <stdio.h> exists.
1177  */
1178 #ifdef HAVE_STDIO_H
1179 # include <stdio.h>
1180 #endif /* HAVE_STDIO_H */
1181
1182 /*
1183  * Actions to take if <stdlib.h> exists.
1184  */
1185 #ifdef HAVE_STDLIB_H
1186 # include <stdlib.h>
1187 #endif /* HAVE_STDLIB_H */
1188
1189 /*
1190  * Actions to take if <regex.h> exists.
1191  */
1192 #ifdef HAVE_REGEX_H
1193 # include <regex.h>
1194 #endif /* HAVE_REGEX_H */
1195
1196
1197 /****************************************************************************/
1198 /*
1199  * Specific macros we're looking for.
1200  */
1201 #ifndef HAVE_MEMSET
1202 # ifdef HAVE_BZERO
1203 #  define       memset(ptr, val, len)   bzero((ptr), (len))
1204 # else /* not HAVE_BZERO */
1205 #  error Cannot find either memset or bzero!
1206 # endif /* not HAVE_BZERO */
1207 #endif /* not HAVE_MEMSET */
1208
1209 #ifndef HAVE_MEMMOVE
1210 # ifdef HAVE_BCOPY
1211 #  define       memmove(to, from, len)  bcopy((from), (to), (len))
1212 # else /* not HAVE_BCOPY */
1213 #  error Cannot find either memmove or bcopy!
1214 # endif /* not HAVE_BCOPY */
1215 #endif /* not HAVE_MEMMOVE */
1216
1217 /*
1218  * memcmp() is more problematic:
1219  * Systems that don't have it, but have bcmp(), will use bcmp() instead.
1220  * Those that have it, but it is bad (SunOS 4 doesn't handle
1221  * 8 bit comparisons correctly), will get to use am_memcmp().
1222  * Otherwise if you have memcmp() and it is good, use it.
1223  */
1224 #ifdef HAVE_MEMCMP
1225 # ifdef HAVE_BAD_MEMCMP
1226 #  define       memcmp          am_memcmp
1227 extern int am_memcmp(const voidp s1, const voidp s2, size_t len);
1228 # endif /* HAVE_BAD_MEMCMP */
1229 #else /* not HAVE_MEMCMP */
1230 # ifdef HAVE_BCMP
1231 #  define       memcmp(a, b, len)       bcmp((a), (b), (len))
1232 # endif /* HAVE_BCMP */
1233 #endif /* not HAVE_MEMCMP */
1234
1235 #ifndef HAVE_SETEUID
1236 # ifdef HAVE_SETRESUID
1237 #  define       seteuid(x)              setresuid(-1,(x),-1)
1238 # else /* not HAVE_SETRESUID */
1239 #  error Cannot find either seteuid or setresuid!
1240 # endif /* not HAVE_SETRESUID */
1241 #endif /* not HAVE_SETEUID */
1242
1243 /*
1244  * Define type of mntent_t.
1245  * Defaults to struct mntent, else struct mnttab.  If neither is found, and
1246  * the operating system does keep not mount tables in the kernel, then flag
1247  * it as an error.  If neither is found and the OS keeps mount tables in the
1248  * kernel, then define our own version of mntent; it will be needed for amd
1249  * to keep its own internal version of the mount tables.
1250  */
1251 #ifdef HAVE_STRUCT_MNTENT
1252 typedef struct mntent mntent_t;
1253 #else /* not HAVE_STRUCT_MNTENT */
1254 # ifdef HAVE_STRUCT_MNTTAB
1255 typedef struct mnttab mntent_t;
1256 /* map struct mnttab field names to struct mntent field names */
1257 #  define mnt_fsname    mnt_special
1258 #  define mnt_dir       mnt_mountp
1259 #  define mnt_opts      mnt_mntopts
1260 #  define mnt_type      mnt_fstype
1261 # else /* not HAVE_STRUCT_MNTTAB */
1262 #  ifdef MOUNT_TABLE_ON_FILE
1263 #   error Could not find definition for struct mntent or struct mnttab!
1264 #  else /* not MOUNT_TABLE_ON_FILE */
1265 typedef struct _am_mntent {
1266   char  *mnt_fsname;            /* name of mounted file system */
1267   char  *mnt_dir;               /* file system path prefix */
1268   char  *mnt_type;              /* MNTTAB_TYPE_* */
1269   char  *mnt_opts;              /* MNTTAB_OPT_* */
1270   int   mnt_freq;               /* dump frequency, in days */
1271   int   mnt_passno;             /* pass number on parallel fsck */
1272 } mntent_t;
1273 #  endif /* not MOUNT_TABLE_ON_FILE */
1274 # endif /* not HAVE_STRUCT_MNTTAB */
1275 #endif /* not HAVE_STRUCT_MNTENT */
1276
1277
1278 /*
1279  * Complete external definitions missing from some systems.
1280  */
1281
1282 #ifndef HAVE_EXTERN_SYS_ERRLIST
1283 extern const char * const sys_errlist[];
1284 #endif /* not HAVE_EXTERN_SYS_ERRLIST */
1285
1286 #ifndef HAVE_EXTERN_OPTARG
1287 extern char *optarg;
1288 extern int optind;
1289 #endif /* not HAVE_EXTERN_OPTARG */
1290
1291 #if defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR)
1292 extern char *clnt_spcreateerror(const char *s);
1293 #endif /* defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR) */
1294
1295 #if defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO)
1296 extern char *clnt_sperrno(const enum clnt_stat num);
1297 #endif /* defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO) */
1298
1299 #ifndef HAVE_EXTERN_FREE
1300 extern void free(voidp);
1301 #endif /* not HAVE_EXTERN_FREE */
1302
1303 #if defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS)
1304 extern void get_myaddress(struct sockaddr_in *addr);
1305 #endif /* defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS) */
1306
1307 #if defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME)
1308 # if defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS)
1309 extern int getdomainname(char *name, int namelen);
1310 # endif /* defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS) */
1311 #endif /* defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME) */
1312
1313 #if defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE)
1314 extern int getdtablesize(void);
1315 #endif /* defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE) */
1316
1317 #if defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME)
1318 extern int gethostname(char *name, int namelen);
1319 #endif /* defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME) */
1320
1321 #ifndef HAVE_EXTERN_GETLOGIN
1322 extern char *getlogin(void);
1323 #endif /* not HAVE_EXTERN_GETLOGIN */
1324
1325 #if defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE)
1326 extern int getpagesize(void);
1327 #endif /* defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE) */
1328
1329 #ifndef HAVE_EXTERN_GETWD
1330 extern char *getwd(char *s);
1331 #endif /* not HAVE_EXTERN_GETWD */
1332
1333 #ifndef HAVE_EXTERN_INNETGR
1334 extern int innetgr(char *, char *, char *, char *);
1335 #endif /* not HAVE_EXTERN_INNETGR */
1336
1337 #if defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP)
1338 extern int mkstemp(char *);
1339 #endif /* defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP) */
1340
1341 #ifndef HAVE_EXTERN_SBRK
1342 extern caddr_t sbrk(int incr);
1343 #endif /* not HAVE_EXTERN_SBRK */
1344
1345 #if defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID)
1346 extern int seteuid(uid_t euid);
1347 #endif /* not defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID) */
1348
1349 #if defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER)
1350 extern int setitimer(int, struct itimerval *, struct itimerval *);
1351 #endif /* defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER) */
1352
1353 #ifndef HAVE_EXTERN_STRCASECMP
1354 /*
1355  * define this extern even if function does not exist, for it will
1356  * be filled in by libamu/strcasecmp.c
1357  */
1358 extern int strcasecmp(const char *s1, const char *s2);
1359 #endif /* not HAVE_EXTERN_STRCASECMP */
1360
1361 #ifndef HAVE_EXTERN_STRDUP
1362 /*
1363  * define this extern even if function does not exist, for it will
1364  * be filled in by libamu/strdup.c
1365  */
1366 extern char *strdup(const char *s);
1367 #endif /* not HAVE_EXTERN_STRDUP */
1368
1369 #if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR)
1370 extern char *strstr(const char *s1, const char *s2);
1371 #endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */
1372
1373 #if defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP)
1374 extern int usleep(u_int useconds);
1375 #endif /* defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP) */
1376
1377 #ifndef HAVE_EXTERN_UALARM
1378 extern u_int ualarm(u_int usecs, u_int interval);
1379 #endif /* not HAVE_EXTERN_UALARM */
1380
1381 #if defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3)
1382 extern int wait3(int *statusp, int options, struct rusage *rusage);
1383 #endif /* defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3) */
1384
1385 #if defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF)
1386 extern int vsnprintf(char *, int, const char *, ...);
1387 #endif /* defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF) */
1388
1389 #ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH
1390 extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
1391 #endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */
1392
1393 /****************************************************************************/
1394 /*
1395  * amd-specific header files.
1396  */
1397 #ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE
1398 # include <amu_nfs_prot.h>
1399 #endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */
1400 #include <am_utils.h>
1401 #include <amq_defs.h>
1402 #include <aux_conf.h>
1403 /* compatibility with old amd, while autoconfiscating it */
1404 #include <am_compat.h>
1405
1406
1407 /****************************************************************************/
1408 /*
1409  * External definitions that depend on other macros available (or not)
1410  * and those are probably declared in any of the above headers.
1411  */
1412
1413 #ifndef HAVE_HASMNTOPT
1414 extern char *hasmntopt(mntent_t *mnt, char *opt);
1415 #endif /* not HAVE_HASMNTOPT */
1416
1417 /*
1418  * include definitions of all possible xdr functions that are otherwise
1419  * not defined elsewhere.
1420  */
1421 #include <am_xdr_func.h>
1422
1423 #endif /* not _AM_DEFS_H */