Merge branch 'vendor/OPENSSH'
[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.4 2005/04/29 09:51:32 joerg 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 #endif /* HAVE_SYS_ERRNO_H */
302
303 /*
304  * Actions to take if <sys/fsid.h> exists.
305  */
306 #ifdef HAVE_SYS_FSID_H
307 # include <sys/fsid.h>
308 #endif /* HAVE_SYS_FSID_H */
309
310 /*
311  * Actions to take if <sys/utsname.h> exists.
312  */
313 #ifdef HAVE_SYS_UTSNAME_H
314 # include <sys/utsname.h>
315 #endif /* HAVE_SYS_UTSNAME_H */
316
317 /*
318  * Actions to take if <sys/mntent.h> exists.
319  */
320 #ifdef HAVE_SYS_MNTENT_H
321 # include <sys/mntent.h>
322 #endif /* HAVE_SYS_MNTENT_H */
323
324 /*
325  * Actions to take if <ndbm.h> or <db1/ndbm.h> exist.
326  * Should be included before <rpcsvc/yp_prot.h> because on some systems
327  * like Linux, it also defines "struct datum".
328  */
329 #ifdef HAVE_NDBM_H
330 # include <ndbm.h>
331 # ifndef DATUM
332 /* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
333 #  define DATUM
334 # endif /* not DATUM */
335 #endif /* HAVE_NDBM_H */
336 #ifdef HAVE_DB1_NDBM_H
337 # include <db1/ndbm.h>
338 # ifndef DATUM
339 /* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
340 #  define DATUM
341 # endif /* not DATUM */
342 #endif /* HAVE_DB1_NDBM_H */
343
344 /*
345  * Actions to take if <net/errno.h> exists.
346  */
347 #ifdef HAVE_NET_ERRNO_H
348 # include <net/errno.h>
349 #endif /* HAVE_NET_ERRNO_H */
350
351 /*
352  * Actions to take if <net/route.h> exists.
353  */
354 #ifdef HAVE_NET_ROUTE_H
355 # include <net/route.h>
356 #endif /* HAVE_NET_ROUTE_H */
357
358 /*
359  * Actions to take if <sys/mbuf.h> exists.
360  */
361 #ifdef HAVE_SYS_MBUF_H
362 # include <sys/mbuf.h>
363 /*
364  * OSF4 (DU-4.0) defines m_next and m_data also in <sys/mount.h> so I must
365  # undefine them here to avoid conflicts.
366  */
367 # ifdef m_next
368 #  undef m_next
369 # endif /* m_next */
370 # ifdef m_data
371 #  undef m_data
372 # endif /* m_data */
373 /*
374  * AIX 3 defines MFREE and m_flags also in <sys/mount.h>.
375  */
376 # ifdef m_flags
377 #  undef m_flags
378 # endif /* m_flags */
379 # ifdef MFREE
380 #  undef MFREE
381 # endif /* MFREE */
382 #endif /* HAVE_SYS_MBUF_H */
383
384 /*
385  * Actions to take if <net/if.h> exists.
386  */
387 #ifdef HAVE_NET_IF_H
388 # include <net/if.h>
389 #endif /* HAVE_NET_IF_H */
390
391 /*
392  * Actions to take if <netdb.h> exists.
393  */
394 #ifdef HAVE_NETDB_H
395 # include <netdb.h>
396 #endif /* HAVE_NETDB_H */
397
398 /*
399  * Actions to take if <netdir.h> exists.
400  */
401 #ifdef HAVE_NETDIR_H
402 # include <netdir.h>
403 #endif /* HAVE_NETDIR_H */
404
405 /*
406  * Actions to take if <net/if_var.h> exists.
407  */
408 #ifdef HAVE_NET_IF_VAR_H
409 # include <net/if_var.h>
410 #endif /* HAVE_NET_IF_VAR_H */
411
412 /*
413  * Actions to take if <netinet/if_ether.h> exists.
414  */
415 #ifdef HAVE_NETINET_IF_ETHER_H
416 # include <netinet/if_ether.h>
417 #endif /* HAVE_NETINET_IF_ETHER_H */
418
419 /*
420  * Actions to take if <netinet/in.h> exists.
421  */
422 #ifdef HAVE_NETINET_IN_H
423 # include <netinet/in.h>
424 #endif /* HAVE_NETINET_IN_H */
425
426 /*
427  * Actions to take if <rpcsvc/yp_prot.h> exists.
428  */
429 #ifdef HAVE_RPCSVC_YP_PROT_H
430 # ifdef HAVE_BAD_HEADERS
431 /* avoid circular dependency in aix 4.3 with <rpcsvc/ypclnt.h> */
432 struct ypall_callback;
433 # endif /* HAVE_BAD_HEADERS */
434 # include <rpcsvc/yp_prot.h>
435 #endif /* HAVE_RPCSVC_YP_PROT_H */
436
437 /*
438  * Actions to take if <rpcsvc/ypclnt.h> exists.
439  */
440 #ifdef HAVE_RPCSVC_YPCLNT_H
441 # include <rpcsvc/ypclnt.h>
442 #endif /* HAVE_RPCSVC_YPCLNT_H */
443
444 /*
445  * Actions to take if <sys/ucred.h> exists.
446  */
447 #ifdef HAVE_SYS_UCRED_H
448 # include <sys/ucred.h>
449 #endif /* HAVE_SYS_UCRED_H */
450
451
452 /*
453  * Actions to take if <sys/mount.h> exists.
454  */
455 #ifdef HAVE_SYS_MOUNT_H
456 /*
457  * Some operating systems must define these variables to get
458  * NFS and other definitions included.
459  */
460 # ifndef NFSCLIENT
461 #  define NFSCLIENT
462 # endif /* not NFSCLIENT */
463 # ifndef NFS
464 #  define NFS
465 # endif /* not NFS */
466 # ifndef PCFS
467 #  define PCFS
468 # endif /* not PCFS */
469 # ifndef LOFS
470 #  define LOFS
471 # endif /* not LOFS */
472 # ifndef RFS
473 #  define RFS
474 # endif /* not RFS */
475 # ifndef MSDOSFS
476 #  define MSDOSFS
477 # endif /* not MSDOSFS */
478 # ifndef MFS
479 #  define MFS
480 # endif /* not MFS */
481 # ifndef CD9660
482 #  define CD9660
483 # endif /* not CD9660 */
484 # ifndef NFS
485 #  define NFS
486 # endif /* not NFS */
487 # include <sys/mount.h>
488 #endif /* HAVE_SYS_MOUNT_H */
489
490 #ifdef HAVE_SYS_VMOUNT_H
491 # include <sys/vmount.h>
492 #endif /* HAVE_SYS_VMOUNT_H */
493
494 /*
495  * Actions to take if <linux/fs.h> exists.
496  */
497 #ifdef HAVE_LINUX_FS_H
498 /*
499  * There are various conflicts in definitions between RedHat Linux, newer
500  * 2.2 kernels, and <netinet/in.h> and <linux/fs.h>.
501  */
502 # ifdef HAVE_SOCKETBITS_H
503 /* conflicts with <socketbits.h> */
504 #  define _LINUX_SOCKET_H
505 #  undef BLKFLSBUF
506 #  undef BLKGETSIZE
507 #  undef BLKRAGET
508 #  undef BLKRASET
509 #  undef BLKROGET
510 #  undef BLKROSET
511 #  undef BLKRRPART
512 #  undef MS_MGC_VAL
513 #  undef MS_RMT_MASK
514 #  if defined(__GLIBC__) && __GLIBC__ >= 2
515 /* conflicts with <waitflags.h> */
516 #   undef WNOHANG
517 #   undef WUNTRACED
518 #  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
519 /* conflicts with <statfsbuf.h> */
520 #  define _SYS_STATFS_H
521 # endif /* HAVE_SOCKETBITS_H */
522
523 # ifdef _SYS_WAIT_H
524 #  if defined(__GLIBC__) && __GLIBC__ >= 2
525 /* conflicts with <bits/waitflags.h> (RedHat/Linux 6.0 and kernels 2.2 */
526 #   undef WNOHANG
527 #   undef WUNTRACED
528 #  endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
529 # endif /* _SYS_WAIT_H */
530
531 # ifdef HAVE_LINUX_POSIX_TYPES_H
532 #  include <linux/posix_types.h>
533 # endif /* HAVE_LINUX_POSIX_TYPES_H */
534 # ifndef _LINUX_BYTEORDER_GENERIC_H
535 #  define _LINUX_BYTEORDER_GENERIC_H
536 # endif /* _LINUX_BYTEORDER_GENERIC_H */
537 /* conflicts with <sys/mount.h> in 2.[12] kernels */
538 # ifdef _SYS_MOUNT_H
539 #  undef BLKFLSBUF
540 #  undef BLKGETSIZE
541 #  undef BLKRAGET
542 #  undef BLKRASET
543 #  undef BLKROGET
544 #  undef BLKROSET
545 #  undef BLKRRPART
546 #  undef BLOCK_SIZE
547 #  undef MS_MANDLOCK
548 #  undef MS_MGC_VAL
549 #  undef MS_NOATIME
550 #  undef MS_NODEV
551 #  undef MS_NODIRATIME
552 #  undef MS_NOEXEC
553 #  undef MS_NOSUID
554 #  undef MS_RDONLY
555 #  undef MS_REMOUNT
556 #  undef MS_RMT_MASK
557 #  undef MS_SYNCHRONOUS
558 #  undef S_APPEND
559 #  undef S_IMMUTABLE
560 /* conflicts with <statfsbuf.h> */
561 #  define _SYS_STATFS_H
562 # endif /* _SYS_MOUNT_H */
563 # include <linux/fs.h>
564 #endif /* HAVE_LINUX_FS_H */
565
566 #ifdef HAVE_CDFS_CDFS_MOUNT_H
567 # include <cdfs/cdfs_mount.h>
568 #endif /* HAVE_CDFS_CDFS_MOUNT_H */
569
570 #ifdef HAVE_CDFS_CDFSMOUNT_H
571 # include <cdfs/cdfsmount.h>
572 #endif /* HAVE_CDFS_CDFSMOUNT_H */
573
574 /*
575  * Actions to take if <linux/auto_fs.h> exists.
576  */
577 #ifdef HAVE_LINUX_AUTO_FS_H
578 # include <linux/auto_fs.h>
579 #endif /* HAVE_LINUX_AUTO_FS_H */
580
581 /*
582  * Actions to take if <sys/fs/autofs.h> exists.
583  */
584 #ifdef HAVE_SYS_FS_AUTOFS_H
585 # include <sys/fs/autofs.h>
586 #endif /* HAVE_SYS_FS_AUTOFS_H */
587
588 /*
589  * Actions to take if <sys/fs/autofs_prot.h> exists.
590  */
591 #ifdef HAVE_SYS_FS_AUTOFS_PROT_H
592 # include <sys/fs/autofs_prot.h>
593 #endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
594
595 /*
596  * NFS PROTOCOL HEADER FILES:
597  */
598
599 /*
600  * Actions to take if <nfs/export.h> exists.
601  */
602 #ifdef HAVE_NFS_EXPORT_H
603 # include <nfs/export.h>
604 #endif /* HAVE_NFS_EXPORT_H */
605
606 /****************************************************************************
607  ** IMPORTANT!!!                                                           **
608  ** We always include am-util's amu_nfs_prot.h.                            **
609  ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" **
610  ****************************************************************************/
611 #include <amu_nfs_prot.h>
612
613 /*
614  * DO NOT INCLUDE THESE FILES:
615  * They conflicts with other NFS headers and are generally not needed.
616  */
617 #ifdef DO_NOT_INCLUDE
618 # ifdef HAVE_NFS_NFS_CLNT_H
619 #  include <nfs/nfs_clnt.h>
620 # endif /* HAVE_NFS_NFS_CLNT_H */
621 # ifdef HAVE_LINUX_NFS_H
622 #  include <linux/nfs.h>
623 # endif /* HAVE_LINUX_NFS_H */
624 #endif /* DO NOT INCLUDE */
625
626 /*
627  * Actions to take if one of the nfs headers exists.
628  */
629 #ifdef HAVE_NFS_NFS_GFS_H
630 # include <nfs/nfs_gfs.h>
631 #endif /* HAVE_NFS_NFS_GFS_H */
632 #ifdef HAVE_NFS_MOUNT_H
633 # include <nfs/mount.h>
634 #endif /* HAVE_NFS_MOUNT_H */
635 #ifdef HAVE_NFS_NFS_MOUNT_H_off
636 /* broken on nexttep3 (includes non-existing headers) */
637 # include <nfs/nfs_mount.h>
638 #endif /* HAVE_NFS_NFS_MOUNT_H */
639 #ifdef HAVE_NFS_PATHCONF_H
640 # include <nfs/pathconf.h>
641 #endif /* HAVE_NFS_PATHCONF_H */
642 #ifdef HAVE_SYS_FS_NFS_MOUNT_H
643 # include <sys/fs/nfs/mount.h>
644 #endif /* HAVE_SYS_FS_NFS_MOUNT_H */
645 #ifdef HAVE_SYS_FS_NFS_NFS_CLNT_H
646 # include <sys/fs/nfs/nfs_clnt.h>
647 #endif /* HAVE_SYS_FS_NFS_NFS_CLNT_H */
648 #ifdef HAVE_SYS_FS_NFS_CLNT_H
649 # include <sys/fs/nfs_clnt.h>
650 #endif /* HAVE_SYS_FS_NFS_CLNT_H */
651 #ifdef HAVE_LINUX_NFS_MOUNT_H
652 # include <linux/nfs_mount.h>
653 #endif /* HAVE_LINUX_NFS_MOUNT_H */
654
655 /*
656  * Actions to take if <pwd.h> exists.
657  */
658 #ifdef HAVE_PWD_H
659 # include <pwd.h>
660 #endif /* HAVE_PWD_H */
661
662 /*
663  * Actions to take if <hesiod.h> exists.
664  */
665 #ifdef HAVE_HESIOD_H
666 # include <hesiod.h>
667 #endif /* HAVE_HESIOD_H */
668
669 /*
670  * Actions to take if <lber.h> exists.
671  * This header file is required before <ldap.h> can be included.
672  */
673 #ifdef HAVE_LBER_H
674 # include <lber.h>
675 #endif /* HAVE_LBER_H */
676
677 /*
678  * Actions to take if <ldap.h> exists.
679  */
680 #ifdef HAVE_LDAP_H
681 # include <ldap.h>
682 #endif /* HAVE_LDAP_H */
683
684 /*
685  * Actions to take if <arpa/nameser.h> exists.
686  * Should be included before <resolv.h>.
687  */
688 #ifdef HAVE_ARPA_NAMESER_H
689 # ifdef NOERROR
690 #  undef NOERROR
691 # endif /* NOERROR */
692 /*
693  * Conflicts with <sys/tpicommon.h> which is included from <sys/tiuser.h>
694  * on Solaris 2.6 systems.  So undefine it first.
695  */
696 # ifdef T_UNSPEC
697 #  undef T_UNSPEC
698 # endif /* T_UNSPEC */
699 # include <arpa/nameser.h>
700 #endif /* HAVE_ARPA_NAMESER_H */
701
702 /*
703  * Actions to take if <arpa/inet.h> exists.
704  */
705 #ifdef HAVE_ARPA_INET_H
706 # ifdef HAVE_BAD_HEADERS
707 /* aix 4.3: avoid including <net/if_dl.h> */
708 struct sockaddr_dl;
709 # endif /* HAVE_BAD_HEADERS */
710 # include <arpa/inet.h>
711 #endif /* HAVE_ARPA_INET_H */
712
713 /*
714  * Actions to take if <resolv.h> exists.
715  */
716 #ifdef HAVE_RESOLV_H
717 # include <resolv.h>
718 #endif /* HAVE_RESOLV_H */
719
720 /*
721  * Actions to take if <sys/uio.h> exists.
722  */
723 #ifdef HAVE_SYS_UIO_H
724 # include <sys/uio.h>
725 #endif /* HAVE_SYS_UIO_H */
726
727 /*
728  * Actions to take if <sys/fs/cachefs_fs.h> exists.
729  */
730 #ifdef HAVE_SYS_FS_CACHEFS_FS_H
731 # include <sys/fs/cachefs_fs.h>
732 #endif /* HAVE_SYS_FS_CACHEFS_FS_H */
733
734 /*
735  * Actions to take if <sys/fs/pc_fs.h> exists.
736  */
737 #ifdef HAVE_SYS_FS_PC_FS_H
738 # include <sys/fs/pc_fs.h>
739 #endif /* HAVE_SYS_FS_PC_FS_H */
740
741 /*
742  * Actions to take if <msdosfs/msdosfsmount.h> exists.
743  */
744 #ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
745 # include <msdosfs/msdosfsmount.h>
746 #endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
747
748 /*
749  * Actions to take if <sys/fs/tmp.h> exists.
750  */
751 #ifdef HAVE_SYS_FS_TMP_H
752 # include <sys/fs/tmp.h>
753 #endif /* HAVE_SYS_FS_TMP_H */
754
755 /*
756  * Actions to take if <sys/fs/ufs_mount.h> exists.
757  */
758 #ifdef HAVE_SYS_FS_UFS_MOUNT_H
759 # include <sys/fs/ufs_mount.h>
760 #endif /* HAVE_SYS_FS_UFS_MOUNT_H */
761 #ifdef  HAVE_UFS_UFS_UFSMOUNT_H_off
762 # error do not include this file here because on netbsd/openbsd it
763 # error causes errors with other header files.  Instead, add it to the
764 # error specific conf/nfs_prot_*.h file.
765 # include <vfs/ufs/ufsmount.h>
766 #endif  /* HAVE_UFS_UFS_UFSMOUNT_H */
767
768 /*
769  * Actions to take if <sys/fs/efs_clnt.h> exists.
770  */
771 #ifdef HAVE_SYS_FS_EFS_CLNT_H
772 # include <sys/fs/efs_clnt.h>
773 #endif /* HAVE_SYS_FS_EFS_CLNT_H */
774
775 /*
776  * Actions to take if <sys/fs/xfs_clnt.h> exists.
777  */
778 #ifdef HAVE_SYS_FS_XFS_CLNT_H
779 # include <sys/fs/xfs_clnt.h>
780 #endif /* HAVE_SYS_FS_XFS_CLNT_H */
781
782 /*
783  * Actions to take if <assert.h> exists.
784  */
785 #ifdef HAVE_ASSERT_H
786 # include <assert.h>
787 #endif /* HAVE_ASSERT_H */
788
789 /*
790  * Actions to take if <cfs.h> exists.
791  */
792 #ifdef HAVE_CFS_H
793 # include <cfs.h>
794 #endif /* HAVE_CFS_H */
795
796 /*
797  * Actions to take if <cluster.h> exists.
798  */
799 #ifdef HAVE_CLUSTER_H
800 # include <cluster.h>
801 #endif /* HAVE_CLUSTER_H */
802
803 /*
804  * Actions to take if <ctype.h> exists.
805  */
806 #ifdef HAVE_CTYPE_H
807 # include <ctype.h>
808 #endif /* HAVE_CTYPE_H */
809
810 /*
811  * Actions to take if <errno.h> exists.
812  */
813 #ifdef HAVE_ERRNO_H
814 # include <errno.h>
815 #endif /* HAVE_ERRNO_H */
816
817 /*
818  * Actions to take if <grp.h> exists.
819  */
820 #ifdef HAVE_GRP_H
821 # include <grp.h>
822 #endif /* HAVE_GRP_H */
823
824 /*
825  * Actions to take if <hsfs/hsfs.h> exists.
826  */
827 #ifdef HAVE_HSFS_HSFS_H
828 # include <hsfs/hsfs.h>
829 #endif /* HAVE_HSFS_HSFS_H */
830
831 /*
832  * Actions to take if <cdfs/cdfsmount.h> exists.
833  */
834 #ifdef HAVE_CDFS_CDFSMOUNT_H
835 # include <cdfs/cdfsmount.h>
836 #endif /* HAVE_CDFS_CDFSMOUNT_H */
837
838 /*
839  * Actions to take if <isofs/cd9660/cd9660_mount.h> exists.
840  */
841 #ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
842 # include <isofs/cd9660/cd9660_mount.h>
843 #endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
844
845 /*
846  * Actions to take if <mount.h> exists.
847  */
848 #ifdef HAVE_MOUNT_H
849 # include <mount.h>
850 #endif /* HAVE_MOUNT_H */
851
852 /*
853  * Actions to take if <nsswitch.h> exists.
854  */
855 #ifdef HAVE_NSSWITCH_H
856 # include <nsswitch.h>
857 #endif /* HAVE_NSSWITCH_H */
858
859 /*
860  * Actions to take if <rpc/auth_des.h> exists.
861  */
862 #ifdef HAVE_RPC_AUTH_DES_H
863 # include <rpc/auth_des.h>
864 #endif /* HAVE_RPC_AUTH_DES_H */
865
866 /*
867  * Actions to take if <rpc/pmap_clnt.h> exists.
868  */
869 #ifdef HAVE_RPC_PMAP_CLNT_H
870 # include <rpc/pmap_clnt.h>
871 #endif /* HAVE_RPC_PMAP_CLNT_H */
872
873 /*
874  * Actions to take if <rpc/pmap_prot.h> exists.
875  */
876 #ifdef HAVE_RPC_PMAP_PROT_H
877 # include <rpc/pmap_prot.h>
878 #endif /* HAVE_RPC_PMAP_PROT_H */
879
880
881 /*
882  * Actions to take if <rpcsvc/mount.h> exists.
883  * AIX does not protect against this file doubly included,
884  * so I have to do my own protection here.
885  */
886 #ifdef COMMENT_OUT
887 #ifdef HAVE_RPCSVC_MOUNT_H
888 # ifndef _RPCSVC_MOUNT_H
889 #  include <rpcsvc/mount.h>
890 # endif /* not _RPCSVC_MOUNT_H */
891 #endif /* HAVE_RPCSVC_MOUNT_H */
892 #endif
893 #  include "mount.h"
894
895 /*
896  * Actions to take if <rpcsvc/nis.h> exists.
897  */
898 #ifdef HAVE_RPCSVC_NIS_H
899 # include <rpcsvc/nis.h>
900 #endif /* HAVE_RPCSVC_NIS_H */
901
902 /*
903  * Actions to take if <setjmp.h> exists.
904  */
905 #ifdef HAVE_SETJMP_H
906 # include <setjmp.h>
907 #endif /* HAVE_SETJMP_H */
908
909 /*
910  * Actions to take if <signal.h> exists.
911  */
912 #ifdef HAVE_SIGNAL_H
913 # include <signal.h>
914 #endif /* HAVE_SIGNAL_H */
915
916 /*
917  * Actions to take if <string.h> exists.
918  */
919 #ifdef HAVE_STRING_H
920 # include <string.h>
921 #endif /* HAVE_STRING_H */
922
923 /*
924  * Actions to take if <strings.h> exists.
925  */
926 #ifdef HAVE_STRINGS_H
927 # include <strings.h>
928 #endif /* HAVE_STRINGS_H */
929
930 /*
931  * Actions to take if <sys/config.h> exists.
932  */
933 #ifdef HAVE_SYS_CONFIG_H
934 # include <sys/config.h>
935 #endif /* HAVE_SYS_CONFIG_H */
936
937 /*
938  * Actions to take if <sys/dg_mount.h> exists.
939  */
940 #ifdef HAVE_SYS_DG_MOUNT_H
941 # include <sys/dg_mount.h>
942 #endif /* HAVE_SYS_DG_MOUNT_H */
943
944 /*
945  * Actions to take if <sys/fs_types.h> exists.
946  */
947 #ifdef HAVE_SYS_FS_TYPES_H
948 /*
949  * Define KERNEL here to avoid multiple definitions of gt_names[] on
950  * Ultrix 4.3.
951  */
952 # define KERNEL
953 # include <sys/fs_types.h>
954 # undef KERNEL
955 #endif /* HAVE_SYS_FS_TYPES_H */
956
957 /*
958  * Actions to take if <sys/fstyp.h> exists.
959  */
960 #ifdef HAVE_SYS_FSTYP_H
961 # include <sys/fstyp.h>
962 #endif /* HAVE_SYS_FSTYP_H */
963
964 /*
965  * Actions to take if <sys/lock.h> exists.
966  */
967 #ifdef HAVE_SYS_LOCK_H
968 # include <sys/lock.h>
969 #endif /* HAVE_SYS_LOCK_H */
970
971 /*
972  * Actions to take if <sys/machine.h> exists.
973  */
974 #ifdef HAVE_SYS_MACHINE_H
975 # include <sys/machine.h>
976 #endif /* HAVE_SYS_MACHINE_H */
977
978 /*
979  * Actions to take if <sys/mntctl.h> exists.
980  */
981 #ifdef HAVE_SYS_MNTCTL_H
982 # include <sys/mntctl.h>
983 #endif /* HAVE_SYS_MNTCTL_H */
984
985 /*
986  * Actions to take if <sys/mnttab.h> exists.
987  */
988 #ifdef HAVE_SYS_MNTTAB_H
989 # include <sys/mnttab.h>
990 #endif /* HAVE_SYS_MNTTAB_H */
991
992 /*
993  * Actions to take if <mnttab.h> exists.
994  * Do not include it if MNTTAB is already defined because it probably
995  * came from <sys/mnttab.h> and we do not want conflicting definitions.
996  */
997 #if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
998 # include <mnttab.h>
999 #endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
1000
1001 /*
1002  * Actions to take if <netconfig.h> exists.
1003  */
1004 #ifdef HAVE_NETCONFIG_H
1005 # include <netconfig.h>
1006 /* Some systems (Solaris 2.5.1) don't declare this external */
1007 extern char *nc_sperror(void);
1008 #endif /* HAVE_NETCONFIG_H */
1009
1010 /*
1011  * Actions to take if <sys/netconfig.h> exists.
1012  */
1013 #ifdef HAVE_SYS_NETCONFIG_H
1014 # include <sys/netconfig.h>
1015 #endif /* HAVE_SYS_NETCONFIG_H */
1016
1017 /*
1018  * Actions to take if <sys/pathconf.h> exists.
1019  */
1020 #ifdef HAVE_SYS_PATHCONF_H
1021 # include <sys/pathconf.h>
1022 #endif /* HAVE_SYS_PATHCONF_H */
1023
1024 /*
1025  * Actions to take if <sys/resource.h> exists.
1026  */
1027 #ifdef HAVE_SYS_RESOURCE_H
1028 # include <sys/resource.h>
1029 #endif /* HAVE_SYS_RESOURCE_H */
1030
1031 /*
1032  * Actions to take if <sys/sema.h> exists.
1033  */
1034 #ifdef HAVE_SYS_SEMA_H
1035 # include <sys/sema.h>
1036 #endif /* HAVE_SYS_SEMA_H */
1037
1038 /*
1039  * Actions to take if <sys/signal.h> exists.
1040  */
1041 #ifdef HAVE_SYS_SIGNAL_H
1042 # include <sys/signal.h>
1043 #endif /* HAVE_SYS_SIGNAL_H */
1044
1045 /*
1046  * Actions to take if <sys/sockio.h> exists.
1047  */
1048 #ifdef HAVE_SYS_SOCKIO_H
1049 # include <sys/sockio.h>
1050 #endif /* HAVE_SYS_SOCKIO_H */
1051
1052 /*
1053  * Actions to take if <sys/syscall.h> exists.
1054  */
1055 #ifdef HAVE_SYS_SYSCALL_H
1056 # include <sys/syscall.h>
1057 #endif /* HAVE_SYS_SYSCALL_H */
1058
1059 /*
1060  * Actions to take if <sys/syslimits.h> exists.
1061  */
1062 #ifdef HAVE_SYS_SYSLIMITS_H
1063 # include <sys/syslimits.h>
1064 #endif /* HAVE_SYS_SYSLIMITS_H */
1065
1066 /*
1067  * Actions to take if <tiuser.h> exists.
1068  */
1069 #ifdef HAVE_TIUSER_H
1070 /*
1071  * Some systems like AIX have multiple definitions for T_NULL and others
1072  * that are defined first in <arpa/nameser.h>.
1073  */
1074 # ifdef HAVE_ARPA_NAMESER_H
1075 #  ifdef T_NULL
1076 #   undef T_NULL
1077 #  endif /* T_NULL */
1078 #  ifdef T_UNSPEC
1079 #   undef T_UNSPEC
1080 #  endif /* T_UNSPEC */
1081 #  ifdef T_IDLE
1082 #   undef T_IDLE
1083 #  endif /* T_IDLE */
1084 # endif /* HAVE_ARPA_NAMESER_H */
1085 # include <tiuser.h>
1086 #endif /* HAVE_TIUSER_H */
1087
1088 /*
1089  * Actions to take if <sys/tiuser.h> exists.
1090  */
1091 #ifdef HAVE_SYS_TIUSER_H
1092 # include <sys/tiuser.h>
1093 #endif /* HAVE_SYS_TIUSER_H */
1094
1095 /*
1096  * Actions to take if <sys/statfs.h> exists.
1097  */
1098 #ifdef HAVE_SYS_STATFS_H
1099 # include <sys/statfs.h>
1100 #endif /* HAVE_SYS_STATFS_H */
1101
1102 /*
1103  * Actions to take if <sys/vfs.h> exists.
1104  */
1105 #ifdef HAVE_SYS_VFS_H
1106 # include <sys/vfs.h>
1107 #endif /* HAVE_SYS_VFS_H */
1108
1109 /*
1110  * Actions to take if <sys/vmount.h> exists.
1111  */
1112 #ifdef HAVE_SYS_VMOUNT_H
1113 # include <sys/vmount.h>
1114 #endif /* HAVE_SYS_VMOUNT_H */
1115
1116 /*
1117  * Actions to take if <ufs/ufs_mount.h> exists.
1118  */
1119 #ifdef HAVE_UFS_UFS_MOUNT_H
1120 # include <vfs/ufs/ufsmount.h>
1121 #endif /* HAVE_UFS_UFS_MOUNT_H */
1122
1123 /*
1124  * Are S_ISDIR, S_ISREG, et al broken?  If not, include <sys/stat.h>.
1125  * Turned off the not using sys/stat.h based on if the macros are
1126  * "broken", because they incorrectly get reported as broken on
1127  * ncr2.
1128  */
1129 #ifndef STAT_MACROS_BROKEN_notused
1130 /*
1131  * RedHat Linux 4.2 (alpha) has a problem in the headers that causes
1132  * duplicate definitions, and also some other nasty bugs.  Upgrade to Redhat
1133  * 5.0!
1134  */
1135 # ifdef HAVE_SYS_STAT_H
1136 /* avoid duplicates or conflicts with <linux/stat.h> (RedHat alpha linux) */
1137 #  if defined(S_IFREG) && defined(HAVE_STATBUF_H)
1138 #   include <statbuf.h>
1139 #   undef S_IFBLK
1140 #   undef S_IFCHR
1141 #   undef S_IFDIR
1142 #   undef S_IFIFO
1143 #   undef S_IFLNK
1144 #   undef S_IFMT
1145 #   undef S_IFREG
1146 #   undef S_IFSOCK
1147 #   undef S_IRGRP
1148 #   undef S_IROTH
1149 #   undef S_IRUSR
1150 #   undef S_IRWXG
1151 #   undef S_IRWXO
1152 #   undef S_IRWXU
1153 #   undef S_ISBLK
1154 #   undef S_ISCHR
1155 #   undef S_ISDIR
1156 #   undef S_ISFIFO
1157 #   undef S_ISGID
1158 #   undef S_ISLNK
1159 #   undef S_ISREG
1160 #   undef S_ISSOCK
1161 #   undef S_ISUID
1162 #   undef S_ISVTX
1163 #   undef S_IWGRP
1164 #   undef S_IWOTH
1165 #   undef S_IWUSR
1166 #   undef S_IXGRP
1167 #   undef S_IXOTH
1168 #   undef S_IXUSR
1169 #  endif /* defined(S_IFREG) && defined(HAVE_STATBUF_H) */
1170 #  include <sys/stat.h>
1171 # endif /* HAVE_SYS_STAT_H */
1172 #endif /* not STAT_MACROS_BROKEN_notused */
1173
1174 /*
1175  * Actions to take if <stdio.h> exists.
1176  */
1177 #ifdef HAVE_STDIO_H
1178 # include <stdio.h>
1179 #endif /* HAVE_STDIO_H */
1180
1181 /*
1182  * Actions to take if <stdlib.h> exists.
1183  */
1184 #ifdef HAVE_STDLIB_H
1185 # include <stdlib.h>
1186 #endif /* HAVE_STDLIB_H */
1187
1188 /*
1189  * Actions to take if <regex.h> exists.
1190  */
1191 #ifdef HAVE_REGEX_H
1192 # include <regex.h>
1193 #endif /* HAVE_REGEX_H */
1194
1195
1196 /****************************************************************************/
1197 /*
1198  * Specific macros we're looking for.
1199  */
1200 #ifndef HAVE_MEMSET
1201 # ifdef HAVE_BZERO
1202 #  define       memset(ptr, val, len)   bzero((ptr), (len))
1203 # else /* not HAVE_BZERO */
1204 #  error Cannot find either memset or bzero!
1205 # endif /* not HAVE_BZERO */
1206 #endif /* not HAVE_MEMSET */
1207
1208 #ifndef HAVE_MEMMOVE
1209 # ifdef HAVE_BCOPY
1210 #  define       memmove(to, from, len)  bcopy((from), (to), (len))
1211 # else /* not HAVE_BCOPY */
1212 #  error Cannot find either memmove or bcopy!
1213 # endif /* not HAVE_BCOPY */
1214 #endif /* not HAVE_MEMMOVE */
1215
1216 /*
1217  * memcmp() is more problematic:
1218  * Systems that don't have it, but have bcmp(), will use bcmp() instead.
1219  * Those that have it, but it is bad (SunOS 4 doesn't handle
1220  * 8 bit comparisons correctly), will get to use am_memcmp().
1221  * Otherwise if you have memcmp() and it is good, use it.
1222  */
1223 #ifdef HAVE_MEMCMP
1224 # ifdef HAVE_BAD_MEMCMP
1225 #  define       memcmp          am_memcmp
1226 extern int am_memcmp(const voidp s1, const voidp s2, size_t len);
1227 # endif /* HAVE_BAD_MEMCMP */
1228 #else /* not HAVE_MEMCMP */
1229 # ifdef HAVE_BCMP
1230 #  define       memcmp(a, b, len)       bcmp((a), (b), (len))
1231 # endif /* HAVE_BCMP */
1232 #endif /* not HAVE_MEMCMP */
1233
1234 #ifndef HAVE_SETEUID
1235 # ifdef HAVE_SETRESUID
1236 #  define       seteuid(x)              setresuid(-1,(x),-1)
1237 # else /* not HAVE_SETRESUID */
1238 #  error Cannot find either seteuid or setresuid!
1239 # endif /* not HAVE_SETRESUID */
1240 #endif /* not HAVE_SETEUID */
1241
1242 /*
1243  * Define type of mntent_t.
1244  * Defaults to struct mntent, else struct mnttab.  If neither is found, and
1245  * the operating system does keep not mount tables in the kernel, then flag
1246  * it as an error.  If neither is found and the OS keeps mount tables in the
1247  * kernel, then define our own version of mntent; it will be needed for amd
1248  * to keep its own internal version of the mount tables.
1249  */
1250 #ifdef HAVE_STRUCT_MNTENT
1251 typedef struct mntent mntent_t;
1252 #else /* not HAVE_STRUCT_MNTENT */
1253 # ifdef HAVE_STRUCT_MNTTAB
1254 typedef struct mnttab mntent_t;
1255 /* map struct mnttab field names to struct mntent field names */
1256 #  define mnt_fsname    mnt_special
1257 #  define mnt_dir       mnt_mountp
1258 #  define mnt_opts      mnt_mntopts
1259 #  define mnt_type      mnt_fstype
1260 # else /* not HAVE_STRUCT_MNTTAB */
1261 #  ifdef MOUNT_TABLE_ON_FILE
1262 #   error Could not find definition for struct mntent or struct mnttab!
1263 #  else /* not MOUNT_TABLE_ON_FILE */
1264 typedef struct _am_mntent {
1265   char  *mnt_fsname;            /* name of mounted file system */
1266   char  *mnt_dir;               /* file system path prefix */
1267   char  *mnt_type;              /* MNTTAB_TYPE_* */
1268   char  *mnt_opts;              /* MNTTAB_OPT_* */
1269   int   mnt_freq;               /* dump frequency, in days */
1270   int   mnt_passno;             /* pass number on parallel fsck */
1271 } mntent_t;
1272 #  endif /* not MOUNT_TABLE_ON_FILE */
1273 # endif /* not HAVE_STRUCT_MNTTAB */
1274 #endif /* not HAVE_STRUCT_MNTENT */
1275
1276
1277 /*
1278  * Complete external definitions missing from some systems.
1279  */
1280
1281 #ifndef HAVE_EXTERN_SYS_ERRLIST
1282 extern const char * const sys_errlist[];
1283 #endif /* not HAVE_EXTERN_SYS_ERRLIST */
1284
1285 #ifndef HAVE_EXTERN_OPTARG
1286 extern char *optarg;
1287 extern int optind;
1288 #endif /* not HAVE_EXTERN_OPTARG */
1289
1290 #if defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR)
1291 extern char *clnt_spcreateerror(const char *s);
1292 #endif /* defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR) */
1293
1294 #if defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO)
1295 extern char *clnt_sperrno(const enum clnt_stat num);
1296 #endif /* defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO) */
1297
1298 #ifndef HAVE_EXTERN_FREE
1299 extern void free(voidp);
1300 #endif /* not HAVE_EXTERN_FREE */
1301
1302 #if defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS)
1303 extern void get_myaddress(struct sockaddr_in *addr);
1304 #endif /* defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS) */
1305
1306 #if defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME)
1307 # if defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS)
1308 extern int getdomainname(char *name, int namelen);
1309 # endif /* defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS) */
1310 #endif /* defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME) */
1311
1312 #if defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE)
1313 extern int getdtablesize(void);
1314 #endif /* defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE) */
1315
1316 #if defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME)
1317 extern int gethostname(char *name, int namelen);
1318 #endif /* defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME) */
1319
1320 #ifndef HAVE_EXTERN_GETLOGIN
1321 extern char *getlogin(void);
1322 #endif /* not HAVE_EXTERN_GETLOGIN */
1323
1324 #if defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE)
1325 extern int getpagesize(void);
1326 #endif /* defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE) */
1327
1328 #ifndef HAVE_EXTERN_GETWD
1329 extern char *getwd(char *s);
1330 #endif /* not HAVE_EXTERN_GETWD */
1331
1332 #ifndef HAVE_EXTERN_INNETGR
1333 extern int innetgr(char *, char *, char *, char *);
1334 #endif /* not HAVE_EXTERN_INNETGR */
1335
1336 #if defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP)
1337 extern int mkstemp(char *);
1338 #endif /* defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP) */
1339
1340 #ifndef HAVE_EXTERN_SBRK
1341 extern caddr_t sbrk(int incr);
1342 #endif /* not HAVE_EXTERN_SBRK */
1343
1344 #if defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID)
1345 extern int seteuid(uid_t euid);
1346 #endif /* not defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID) */
1347
1348 #if defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER)
1349 extern int setitimer(int, struct itimerval *, struct itimerval *);
1350 #endif /* defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER) */
1351
1352 #ifndef HAVE_EXTERN_STRCASECMP
1353 /*
1354  * define this extern even if function does not exist, for it will
1355  * be filled in by libamu/strcasecmp.c
1356  */
1357 extern int strcasecmp(const char *s1, const char *s2);
1358 #endif /* not HAVE_EXTERN_STRCASECMP */
1359
1360 #ifndef HAVE_EXTERN_STRDUP
1361 /*
1362  * define this extern even if function does not exist, for it will
1363  * be filled in by libamu/strdup.c
1364  */
1365 extern char *strdup(const char *s);
1366 #endif /* not HAVE_EXTERN_STRDUP */
1367
1368 #if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR)
1369 extern char *strstr(const char *s1, const char *s2);
1370 #endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */
1371
1372 #if defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP)
1373 extern int usleep(u_int useconds);
1374 #endif /* defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP) */
1375
1376 #ifndef HAVE_EXTERN_UALARM
1377 extern u_int ualarm(u_int usecs, u_int interval);
1378 #endif /* not HAVE_EXTERN_UALARM */
1379
1380 #if defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3)
1381 extern int wait3(int *statusp, int options, struct rusage *rusage);
1382 #endif /* defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3) */
1383
1384 #if defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF)
1385 extern int vsnprintf(char *, int, const char *, ...);
1386 #endif /* defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF) */
1387
1388 #ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH
1389 extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
1390 #endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */
1391
1392 /****************************************************************************/
1393 /*
1394  * amd-specific header files.
1395  */
1396 #ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE
1397 # include <amu_nfs_prot.h>
1398 #endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */
1399 #include <am_utils.h>
1400 #include <amq_defs.h>
1401 #include <aux_conf.h>
1402 /* compatibility with old amd, while autoconfiscating it */
1403 #include <am_compat.h>
1404
1405
1406 /****************************************************************************/
1407 /*
1408  * External definitions that depend on other macros available (or not)
1409  * and those are probably declared in any of the above headers.
1410  */
1411
1412 #ifndef HAVE_HASMNTOPT
1413 extern char *hasmntopt(mntent_t *mnt, char *opt);
1414 #endif /* not HAVE_HASMNTOPT */
1415
1416 /*
1417  * include definitions of all possible xdr functions that are otherwise
1418  * not defined elsewhere.
1419  */
1420 #include <am_xdr_func.h>
1421
1422 #endif /* not _AM_DEFS_H */