am_defs.h revision 82805
1/*
2 * Copyright (c) 1997-2001 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.15.2.9 2001/04/07 00:47:44 ib42 Exp $
42 * $FreeBSD: head/contrib/amd/include/am_defs.h 82805 2001-09-02 19:04:09Z obrien $
43 *
44 */
45
46/*
47 * Definitions that are not specific to the am-utils package, but
48 * are rather generic, and can be used elsewhere.
49 */
50
51#ifndef _AM_DEFS_H
52#define _AM_DEFS_H
53
54/*
55 * Actions to take if ANSI C.
56 */
57#if STDC_HEADERS
58# include <string.h>
59/* for function prototypes */
60# define P(x) x
61# define P_void void
62#else /* not STDC_HEADERS */
63/* empty function prototypes */
64# define P(x) ()
65# define P_void
66# ifndef HAVE_STRCHR
67#  define strchr index
68#  define strrchr rindex
69# endif /* not HAVE_STRCHR */
70char *strchr(), *strrchr(), *strdup();
71#endif /* not STDC_HEADERS */
72
73/*
74 * Handle gcc __attribute__ if available.
75 */
76#ifndef __attribute__
77/* This feature is available in gcc versions 2.5 and later.  */
78# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
79#  define __attribute__(Spec) /* empty */
80# endif /* __GNUC__ < 2 ... */
81/*
82 * The __-protected variants of `format' and `printf' attributes
83 * are accepted by gcc versions 2.6.4 (effectively 2.7) and later.
84 */
85# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
86#  define __format__ format
87#  define __printf__ printf
88# endif /* __GNUC__ < 2 ... */
89#endif /* not __attribute__ */
90
91/*
92 * How to handle signals of any type
93 */
94#ifdef HAVE_SYS_WAIT_H
95# include <sys/wait.h>
96#endif /* HAVE_SYS_WAIT_H */
97#ifndef WEXITSTATUS
98# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
99#endif /* not WEXITSTATUS */
100#ifndef WIFEXITED
101# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
102#endif /* not WIFEXITED */
103
104/*
105 * Actions to take regarding <time.h> and <sys/time.h>.
106 */
107#if TIME_WITH_SYS_TIME
108# include <sys/time.h>
109# include <time.h>
110#else /* not TIME_WITH_SYS_TIME */
111# if HAVE_SYS_TIME_H
112#  include <sys/time.h>
113# else /* not HAVE_SYS_TIME_H */
114#  include <time.h>
115# endif /* not HAVE_SYS_TIME_H */
116#endif /* not TIME_WITH_SYS_TIME */
117
118/*
119 * Actions to take if <machine/endian.h> exists.
120 */
121#ifdef HAVE_MACHINE_ENDIAN_H
122# include <machine/endian.h>
123#endif /* HAVE_MACHINE_ENDIAN_H */
124
125/*
126 * Big-endian or little-endian?
127 */
128#ifdef WORDS_BIGENDIAN
129# define ARCH_ENDIAN "big"
130#else /* not WORDS_BIGENDIAN */
131# define ARCH_ENDIAN "little"
132#endif /* not WORDS_BIGENDIAN */
133
134/*
135 * Actions to take if HAVE_SYS_TYPES_H is defined.
136 */
137#if HAVE_SYS_TYPES_H
138# include <sys/types.h>
139#endif /* HAVE_SYS_TYPES_H */
140
141/*
142 * Actions to take if HAVE_UNISTD_H is defined.
143 */
144#if HAVE_UNISTD_H
145# include <unistd.h>
146#endif /* HAVE_UNISTD_H */
147
148/* after <unistd.h>, check if this is a POSIX.1 system */
149#ifdef _POSIX_VERSION
150/* Code for POSIX.1 systems. */
151#endif /* _POSIX_VERSION */
152
153/*
154 * Variable length argument lists.
155 * Must use only one of the two!
156 */
157#ifdef HAVE_STDARG_H
158# include <stdarg.h>
159/*
160 * On Solaris 2.6, <sys/varargs.h> is included in <sys/fs/autofs.h>
161 * So this ensures that only one is included.
162 */
163# ifndef _SYS_VARARGS_H
164#  define _SYS_VARARGS_H
165# endif /* not _SYS_VARARGS_H */
166#else /* not HAVE_STDARG_H */
167# ifdef HAVE_VARARGS_H
168#  include <varargs.h>
169# endif /* HAVE_VARARGS_H */
170#endif /* not HAVE_STDARG_H */
171
172/*
173 * Pick the right header file and macros for directory processing functions.
174 */
175#if HAVE_DIRENT_H
176# include <dirent.h>
177# define NAMLEN(dirent) strlen((dirent)->d_name)
178#else /* not HAVE_DIRENT_H */
179# define dirent direct
180# define NAMLEN(dirent) (dirent)->d_namlen
181# if HAVE_SYS_NDIR_H
182#  include <sys/ndir.h>
183# endif /* HAVE_SYS_NDIR_H */
184# if HAVE_SYS_DIR_H
185#  include <sys/dir.h>
186# endif /* HAVE_SYS_DIR_H */
187# if HAVE_NDIR_H
188#  include <ndir.h>
189# endif /* HAVE_NDIR_H */
190#endif /* not HAVE_DIRENT_H */
191
192/*
193 * Actions to take if HAVE_FCNTL_H is defined.
194 */
195#if HAVE_FCNTL_H
196# include <fcntl.h>
197#endif /* HAVE_FCNTL_H */
198
199/*
200 * Actions to take if HAVE_MEMORY_H is defined.
201 */
202#if HAVE_MEMORY_H
203# include <memory.h>
204#endif /* HAVE_MEMORY_H */
205
206/*
207 * Actions to take if HAVE_SYS_FILE_H is defined.
208 */
209#if HAVE_SYS_FILE_H
210# include <sys/file.h>
211#endif /* HAVE_SYS_FILE_H */
212
213/*
214 * Actions to take if HAVE_SYS_IOCTL_H is defined.
215 */
216#if HAVE_SYS_IOCTL_H
217# include <sys/ioctl.h>
218#endif /* HAVE_SYS_IOCTL_H */
219
220/*
221 * Actions to take if HAVE_SYSLOG_H or HAVE_SYS_SYSLOG_H is defined.
222 */
223#ifdef HAVE_SYSLOG_H
224# include <syslog.h>
225#else /* not HAVE_SYSLOG_H */
226# if HAVE_SYS_SYSLOG_H
227#  include <sys/syslog.h>
228# endif /* HAVE_SYS_SYSLOG_H */
229#endif /* HAVE_SYSLOG_H */
230
231/*
232 * Actions to take if <sys/param.h> exists.
233 */
234#ifdef HAVE_SYS_PARAM_H
235# include <sys/param.h>
236#endif /* HAVE_SYS_PARAM_H */
237
238/*
239 * Actions to take if <sys/socket.h> exists.
240 */
241#ifdef HAVE_SYS_SOCKET_H
242# include <sys/socket.h>
243#endif /* HAVE_SYS_SOCKET_H */
244
245/*
246 * Actions to take if <rpc/rpc.h> exists.
247 */
248#ifdef HAVE_RPC_RPC_H
249/*
250 * Turn on PORTMAP, so that additional header files would get included
251 * and the important definition for UDPMSGSIZE is included too.
252 */
253# ifndef PORTMAP
254#  define PORTMAP
255# endif /* not PORTMAP */
256# include <rpc/rpc.h>
257# ifndef XDRPROC_T_TYPE
258typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
259# endif /* not XDRPROC_T_TYPE */
260#endif /* HAVE_RPC_RPC_H */
261
262/*
263 * Actions to take if <rpc/types.h> exists.
264 */
265#ifdef HAVE_RPC_TYPES_H
266# include <rpc/types.h>
267#endif /* HAVE_RPC_TYPES_H */
268
269/*
270 * Actions to take if <rpc/xdr.h> exists.
271 */
272/* Prevent multiple inclusion on Ultrix 4 */
273#if defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__)
274# include <rpc/xdr.h>
275#endif /* defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__) */
276
277/*
278 * Actions to take if <malloc.h> exists.
279 */
280#ifdef HAVE_MALLOC_H
281# include <malloc.h>
282#endif /* HAVE_MALLOC_H */
283
284/*
285 * Actions to take if <mntent.h> exists.
286 */
287#ifdef HAVE_MNTENT_H
288/* some systems need <stdio.h> before <mntent.h> is included */
289# ifdef HAVE_STDIO_H
290#  include <stdio.h>
291# endif /* HAVE_STDIO_H */
292# include <mntent.h>
293#endif /* HAVE_MNTENT_H */
294
295/*
296 * Actions to take if <sys/errno.h> exists.
297 */
298#ifdef HAVE_SYS_ERRNO_H
299# include <sys/errno.h>
300extern int errno;
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#else /* not 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#endif /* HAVE_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> */
433struct 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 1
463# endif /* not NFSCLIENT */
464# ifndef NFS
465#  define NFS 1
466# endif /* not NFS */
467# ifndef PCFS
468#  define PCFS 1
469# endif /* not PCFS */
470# ifndef LOFS
471#  define LOFS 1
472# endif /* not LOFS */
473# ifndef RFS
474#  define RFS 1
475# endif /* not RFS */
476# ifndef MSDOSFS
477#  define MSDOSFS 1
478# endif /* not MSDOSFS */
479# ifndef MFS
480#  define MFS 1
481# endif /* not MFS */
482# ifndef CD9660
483#  define CD9660 1
484# endif /* not CD9660 */
485# include <sys/mount.h>
486#endif /* HAVE_SYS_MOUNT_H */
487
488#ifdef HAVE_SYS_VMOUNT_H
489# include <sys/vmount.h>
490#endif /* HAVE_SYS_VMOUNT_H */
491
492/*
493 * Actions to take if <linux/fs.h> exists.
494 * There is no point in including this on a glibc2 system,
495 * we're only asking for trouble
496 */
497#if defined HAVE_LINUX_FS_H && (!defined __GLIBC__ || __GLIBC__ < 2)
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# ifndef _LINUX_STRING_H_
564#  define _LINUX_STRING_H_
565# endif /* not _LINUX_STRING_H_ */
566# ifdef HAVE_LINUX_KDEV_T_H
567#  define __KERNEL__
568#  include <linux/kdev_t.h>
569#  undef __KERNEL__
570# endif /* HAVE_LINUX_KDEV_T_H */
571# ifdef HAVE_LINUX_LIST_H
572#  define __KERNEL__
573#  include <linux/list.h>
574#  undef __KERNEL__
575# endif /* HAVE_LINUX_LIST_H */
576# include <linux/fs.h>
577#endif /* HAVE_LINUX_FS_H && (!__GLIBC__ || __GLIBC__ < 2) */
578
579#ifdef HAVE_CDFS_CDFS_MOUNT_H
580# include <cdfs/cdfs_mount.h>
581#endif /* HAVE_CDFS_CDFS_MOUNT_H */
582
583#ifdef HAVE_CDFS_CDFSMOUNT_H
584# include <cdfs/cdfsmount.h>
585#endif /* HAVE_CDFS_CDFSMOUNT_H */
586
587/*
588 * Actions to take if <linux/auto_fs.h> exists.
589 * We really don't want <linux/fs.h> pulled in here
590 */
591#ifndef _LINUX_FS_H
592#define _LINUX_FS_H
593#endif /* _LINUX_FS_H */
594#ifdef HAVE_LINUX_AUTO_FS_H
595# include <linux/auto_fs.h>
596#endif /* HAVE_LINUX_AUTO_FS_H */
597
598/*
599 * Actions to take if <sys/fs/autofs.h> exists.
600 */
601#ifdef HAVE_SYS_FS_AUTOFS_H
602# include <sys/fs/autofs.h>
603#endif /* HAVE_SYS_FS_AUTOFS_H */
604
605/*
606 * Actions to take if <sys/fs/autofs_prot.h> exists.
607 * We really don't want <linux/fs.h> pulled in here
608 */
609#ifndef _LINUX_FS_H
610#define _LINUX_FS_H
611#endif /* _LINUX_FS_H */
612#ifdef HAVE_SYS_FS_AUTOFS_PROT_H
613# include <sys/fs/autofs_prot.h>
614#endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
615
616/*
617 * NFS PROTOCOL HEADER FILES:
618 */
619
620/*
621 * Actions to take if <nfs/export.h> exists.
622 */
623#ifdef HAVE_NFS_EXPORT_H
624# include <nfs/export.h>
625#endif /* HAVE_NFS_EXPORT_H */
626
627/****************************************************************************
628 ** IMPORTANT!!!							   **
629 ** We always include am-util's amu_nfs_prot.h.				   **
630 ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" **
631 ****************************************************************************/
632#include <amu_nfs_prot.h>
633
634/*
635 * DO NOT INCLUDE THESE FILES:
636 * They conflicts with other NFS headers and are generally not needed.
637 */
638#ifdef DO_NOT_INCLUDE
639# ifdef HAVE_NFS_NFS_CLNT_H
640#  include <nfs/nfs_clnt.h>
641# endif /* HAVE_NFS_NFS_CLNT_H */
642# ifdef HAVE_LINUX_NFS_H
643#  include <linux/nfs.h>
644# endif /* HAVE_LINUX_NFS_H */
645#endif /* DO NOT INCLUDE */
646
647/*
648 * Actions to take if one of the nfs headers exists.
649 */
650#ifdef HAVE_NFS_NFS_GFS_H
651# include <nfs/nfs_gfs.h>
652#endif /* HAVE_NFS_NFS_GFS_H */
653#ifdef HAVE_NFS_MOUNT_H
654# include <nfs/mount.h>
655#endif /* HAVE_NFS_MOUNT_H */
656#ifdef HAVE_NFS_NFS_MOUNT_H_off
657/* broken on nextstep3 (includes non-existing headers) */
658# include <nfs/nfs_mount.h>
659#endif /* HAVE_NFS_NFS_MOUNT_H */
660#ifdef HAVE_NFS_PATHCONF_H
661# include <nfs/pathconf.h>
662#endif /* HAVE_NFS_PATHCONF_H */
663#ifdef HAVE_SYS_FS_NFS_MOUNT_H
664# include <sys/fs/nfs/mount.h>
665#endif /* HAVE_SYS_FS_NFS_MOUNT_H */
666#ifdef HAVE_SYS_FS_NFS_NFS_CLNT_H
667# include <sys/fs/nfs/nfs_clnt.h>
668#endif /* HAVE_SYS_FS_NFS_NFS_CLNT_H */
669#ifdef HAVE_SYS_FS_NFS_CLNT_H
670# include <sys/fs/nfs_clnt.h>
671#endif /* HAVE_SYS_FS_NFS_CLNT_H */
672#ifdef HAVE_LINUX_NFS_MOUNT_H
673# define _LINUX_NFS_H
674# define _LINUX_NFS2_H
675# define _LINUX_NFS3_H
676# define _LINUX_NFS_FS_H
677# define _LINUX_IN_H
678# include <linux/nfs_mount.h>
679#endif /* HAVE_LINUX_NFS_MOUNT_H */
680
681/*
682 * Actions to take if <pwd.h> exists.
683 */
684#ifdef HAVE_PWD_H
685# include <pwd.h>
686#endif /* HAVE_PWD_H */
687
688/*
689 * Actions to take if <hesiod.h> exists.
690 */
691#ifdef HAVE_HESIOD_H
692# include <hesiod.h>
693#endif /* HAVE_HESIOD_H */
694
695/*
696 * Actions to take if <lber.h> exists.
697 * This header file is required before <ldap.h> can be included.
698 */
699#ifdef HAVE_LBER_H
700# include <lber.h>
701#endif /* HAVE_LBER_H */
702
703/*
704 * Actions to take if <ldap.h> exists.
705 */
706#ifdef HAVE_LDAP_H
707# include <ldap.h>
708#endif /* HAVE_LDAP_H */
709
710/*
711 * Actions to take if <arpa/nameser.h> exists.
712 * Should be included before <resolv.h>.
713 */
714#ifdef HAVE_ARPA_NAMESER_H
715# ifdef NOERROR
716#  undef NOERROR
717# endif /* NOERROR */
718/*
719 * Conflicts with <sys/tpicommon.h> which is included from <sys/tiuser.h>
720 * on Solaris 2.6 systems.  So undefine it first.
721 */
722# ifdef T_UNSPEC
723#  undef T_UNSPEC
724# endif /* T_UNSPEC */
725# include <arpa/nameser.h>
726#endif /* HAVE_ARPA_NAMESER_H */
727
728/*
729 * Actions to take if <arpa/inet.h> exists.
730 */
731#ifdef HAVE_ARPA_INET_H
732# ifdef HAVE_BAD_HEADERS
733/* aix 4.3: avoid including <net/if_dl.h> */
734struct sockaddr_dl;
735# endif /* HAVE_BAD_HEADERS */
736# include <arpa/inet.h>
737#endif /* HAVE_ARPA_INET_H */
738
739/*
740 * Actions to take if <resolv.h> exists.
741 */
742#ifdef HAVE_RESOLV_H
743# include <resolv.h>
744#endif /* HAVE_RESOLV_H */
745
746/*
747 * Actions to take if <sys/uio.h> exists.
748 */
749#ifdef HAVE_SYS_UIO_H
750# include <sys/uio.h>
751#endif /* HAVE_SYS_UIO_H */
752
753/*
754 * Actions to take if <sys/fs/cachefs_fs.h> exists.
755 */
756#ifdef HAVE_SYS_FS_CACHEFS_FS_H
757# include <sys/fs/cachefs_fs.h>
758#endif /* HAVE_SYS_FS_CACHEFS_FS_H */
759
760/*
761 * Actions to take if <sys/fs/pc_fs.h> exists.
762 */
763#ifdef HAVE_SYS_FS_PC_FS_H
764# include <sys/fs/pc_fs.h>
765#endif /* HAVE_SYS_FS_PC_FS_H */
766
767/*
768 * Actions to take if <msdosfs/msdosfsmount.h> exists.
769 */
770#ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
771# include <msdosfs/msdosfsmount.h>
772#endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
773#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H
774# include <fs/msdosfs/msdosfsmount.h>
775#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */
776
777/*
778 * Actions to take if <sys/fs/tmp.h> exists.
779 */
780#ifdef HAVE_SYS_FS_TMP_H
781# include <sys/fs/tmp.h>
782#endif /* HAVE_SYS_FS_TMP_H */
783
784/*
785 * Actions to take if <sys/fs/ufs_mount.h> exists.
786 */
787#ifdef HAVE_SYS_FS_UFS_MOUNT_H
788# include <sys/fs/ufs_mount.h>
789#endif /* HAVE_SYS_FS_UFS_MOUNT_H */
790#ifdef	HAVE_UFS_UFS_UFSMOUNT_H_off
791# error do not include this file here because on netbsd/openbsd it
792# error causes errors with other header files.  Instead, add it to the
793# error specific conf/nfs_prot_*.h file.
794# include <ufs/ufs/ufsmount.h>
795#endif	/* HAVE_UFS_UFS_UFSMOUNT_H */
796
797/*
798 * Actions to take if <sys/fs/efs_clnt.h> exists.
799 */
800#ifdef HAVE_SYS_FS_EFS_CLNT_H
801# include <sys/fs/efs_clnt.h>
802#endif /* HAVE_SYS_FS_EFS_CLNT_H */
803
804/*
805 * Actions to take if <sys/fs/xfs_clnt.h> exists.
806 */
807#ifdef HAVE_SYS_FS_XFS_CLNT_H
808# include <sys/fs/xfs_clnt.h>
809#endif /* HAVE_SYS_FS_XFS_CLNT_H */
810
811/*
812 * Actions to take if <assert.h> exists.
813 */
814#ifdef HAVE_ASSERT_H
815# include <assert.h>
816#endif /* HAVE_ASSERT_H */
817
818/*
819 * Actions to take if <cfs.h> exists.
820 */
821#ifdef HAVE_CFS_H
822# include <cfs.h>
823#endif /* HAVE_CFS_H */
824
825/*
826 * Actions to take if <cluster.h> exists.
827 */
828#ifdef HAVE_CLUSTER_H
829# include <cluster.h>
830#endif /* HAVE_CLUSTER_H */
831
832/*
833 * Actions to take if <ctype.h> exists.
834 */
835#ifdef HAVE_CTYPE_H
836# include <ctype.h>
837#endif /* HAVE_CTYPE_H */
838
839/*
840 * Actions to take if <errno.h> exists.
841 */
842#ifdef HAVE_ERRNO_H
843# include <errno.h>
844#endif /* HAVE_ERRNO_H */
845
846/*
847 * Actions to take if <grp.h> exists.
848 */
849#ifdef HAVE_GRP_H
850# include <grp.h>
851#endif /* HAVE_GRP_H */
852
853/*
854 * Actions to take if <hsfs/hsfs.h> exists.
855 */
856#ifdef HAVE_HSFS_HSFS_H
857# include <hsfs/hsfs.h>
858#endif /* HAVE_HSFS_HSFS_H */
859
860/*
861 * Actions to take if <cdfs/cdfsmount.h> exists.
862 */
863#ifdef HAVE_CDFS_CDFSMOUNT_H
864# include <cdfs/cdfsmount.h>
865#endif /* HAVE_CDFS_CDFSMOUNT_H */
866
867/*
868 * Actions to take if <isofs/cd9660/cd9660_mount.h> exists.
869 */
870#ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
871# include <isofs/cd9660/cd9660_mount.h>
872#endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
873
874/*
875 * Actions to take if <mount.h> exists.
876 */
877#ifdef HAVE_MOUNT_H
878# include <mount.h>
879#endif /* HAVE_MOUNT_H */
880
881/*
882 * Actions to take if <nsswitch.h> exists.
883 */
884#ifdef HAVE_NSSWITCH_H
885# include <nsswitch.h>
886#endif /* HAVE_NSSWITCH_H */
887
888/*
889 * Actions to take if <rpc/auth_des.h> exists.
890 */
891#ifdef HAVE_RPC_AUTH_DES_H
892# include <rpc/auth_des.h>
893#endif /* HAVE_RPC_AUTH_DES_H */
894
895/*
896 * Actions to take if <rpc/pmap_clnt.h> exists.
897 */
898#ifdef HAVE_RPC_PMAP_CLNT_H
899# include <rpc/pmap_clnt.h>
900#endif /* HAVE_RPC_PMAP_CLNT_H */
901
902/*
903 * Actions to take if <rpc/pmap_prot.h> exists.
904 */
905#ifdef HAVE_RPC_PMAP_PROT_H
906# include <rpc/pmap_prot.h>
907#endif /* HAVE_RPC_PMAP_PROT_H */
908
909
910/*
911 * Actions to take if <rpcsvc/mount.h> exists.
912 * AIX does not protect against this file doubly included,
913 * so I have to do my own protection here.
914 */
915#ifdef COMMENT_OUT
916#ifdef HAVE_RPCSVC_MOUNT_H
917# ifndef _RPCSVC_MOUNT_H
918#  include <rpcsvc/mount.h>
919# endif /* not _RPCSVC_MOUNT_H */
920#endif /* HAVE_RPCSVC_MOUNT_H */
921#endif
922#  include "mount.h"
923
924/*
925 * Actions to take if <rpcsvc/nis.h> exists.
926 */
927#ifdef HAVE_RPCSVC_NIS_H
928# include <rpcsvc/nis.h>
929#endif /* HAVE_RPCSVC_NIS_H */
930
931/*
932 * Actions to take if <setjmp.h> exists.
933 */
934#ifdef HAVE_SETJMP_H
935# include <setjmp.h>
936#endif /* HAVE_SETJMP_H */
937
938/*
939 * Actions to take if <signal.h> exists.
940 */
941#ifdef HAVE_SIGNAL_H
942# include <signal.h>
943#endif /* HAVE_SIGNAL_H */
944
945/*
946 * Actions to take if <string.h> exists.
947 */
948#ifdef HAVE_STRING_H
949# include <string.h>
950#endif /* HAVE_STRING_H */
951
952/*
953 * Actions to take if <strings.h> exists.
954 */
955#ifdef HAVE_STRINGS_H
956# include <strings.h>
957#endif /* HAVE_STRINGS_H */
958
959/*
960 * Actions to take if <sys/config.h> exists.
961 */
962#ifdef HAVE_SYS_CONFIG_H
963# include <sys/config.h>
964#endif /* HAVE_SYS_CONFIG_H */
965
966/*
967 * Actions to take if <sys/dg_mount.h> exists.
968 */
969#ifdef HAVE_SYS_DG_MOUNT_H
970# include <sys/dg_mount.h>
971#endif /* HAVE_SYS_DG_MOUNT_H */
972
973/*
974 * Actions to take if <sys/fs_types.h> exists.
975 */
976#ifdef HAVE_SYS_FS_TYPES_H
977/*
978 * Define KERNEL here to avoid multiple definitions of gt_names[] on
979 * Ultrix 4.3.
980 */
981# define KERNEL
982# include <sys/fs_types.h>
983# undef KERNEL
984#endif /* HAVE_SYS_FS_TYPES_H */
985
986/*
987 * Actions to take if <sys/fstyp.h> exists.
988 */
989#ifdef HAVE_SYS_FSTYP_H
990# include <sys/fstyp.h>
991#endif /* HAVE_SYS_FSTYP_H */
992
993/*
994 * Actions to take if <sys/lock.h> exists.
995 */
996#ifdef HAVE_SYS_LOCK_H
997# include <sys/lock.h>
998#endif /* HAVE_SYS_LOCK_H */
999
1000/*
1001 * Actions to take if <sys/machine.h> exists.
1002 */
1003#ifdef HAVE_SYS_MACHINE_H
1004# include <sys/machine.h>
1005#endif /* HAVE_SYS_MACHINE_H */
1006
1007/*
1008 * Actions to take if <sys/mntctl.h> exists.
1009 */
1010#ifdef HAVE_SYS_MNTCTL_H
1011# include <sys/mntctl.h>
1012#endif /* HAVE_SYS_MNTCTL_H */
1013
1014/*
1015 * Actions to take if <sys/mnttab.h> exists.
1016 */
1017#ifdef HAVE_SYS_MNTTAB_H
1018# include <sys/mnttab.h>
1019#endif /* HAVE_SYS_MNTTAB_H */
1020
1021/*
1022 * Actions to take if <mnttab.h> exists.
1023 * Do not include it if MNTTAB is already defined because it probably
1024 * came from <sys/mnttab.h> and we do not want conflicting definitions.
1025 */
1026#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
1027# include <mnttab.h>
1028#endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
1029
1030/*
1031 * Actions to take if <netconfig.h> exists.
1032 */
1033#ifdef HAVE_NETCONFIG_H
1034# include <netconfig.h>
1035/* Some systems (Solaris 2.5.1) don't declare this external */
1036extern char *nc_sperror(void);
1037#endif /* HAVE_NETCONFIG_H */
1038
1039/*
1040 * Actions to take if <sys/netconfig.h> exists.
1041 */
1042#ifdef HAVE_SYS_NETCONFIG_H
1043# include <sys/netconfig.h>
1044#endif /* HAVE_SYS_NETCONFIG_H */
1045
1046/*
1047 * Actions to take if <sys/pathconf.h> exists.
1048 */
1049#ifdef HAVE_SYS_PATHCONF_H
1050# include <sys/pathconf.h>
1051#endif /* HAVE_SYS_PATHCONF_H */
1052
1053/*
1054 * Actions to take if <sys/resource.h> exists.
1055 */
1056#ifdef HAVE_SYS_RESOURCE_H
1057# include <sys/resource.h>
1058#endif /* HAVE_SYS_RESOURCE_H */
1059
1060/*
1061 * Actions to take if <sys/sema.h> exists.
1062 */
1063#ifdef HAVE_SYS_SEMA_H
1064# include <sys/sema.h>
1065#endif /* HAVE_SYS_SEMA_H */
1066
1067/*
1068 * Actions to take if <sys/signal.h> exists.
1069 */
1070#ifdef HAVE_SYS_SIGNAL_H
1071# include <sys/signal.h>
1072#endif /* HAVE_SYS_SIGNAL_H */
1073
1074/*
1075 * Actions to take if <sys/sockio.h> exists.
1076 */
1077#ifdef HAVE_SYS_SOCKIO_H
1078# include <sys/sockio.h>
1079#endif /* HAVE_SYS_SOCKIO_H */
1080
1081/*
1082 * Actions to take if <sys/syscall.h> exists.
1083 */
1084#ifdef HAVE_SYS_SYSCALL_H
1085# include <sys/syscall.h>
1086#endif /* HAVE_SYS_SYSCALL_H */
1087
1088/*
1089 * Actions to take if <sys/syslimits.h> exists.
1090 */
1091#ifdef HAVE_SYS_SYSLIMITS_H
1092# include <sys/syslimits.h>
1093#endif /* HAVE_SYS_SYSLIMITS_H */
1094
1095/*
1096 * Actions to take if <tiuser.h> exists.
1097 */
1098#ifdef HAVE_TIUSER_H
1099/*
1100 * Some systems like AIX have multiple definitions for T_NULL and others
1101 * that are defined first in <arpa/nameser.h>.
1102 */
1103# ifdef HAVE_ARPA_NAMESER_H
1104#  ifdef T_NULL
1105#   undef T_NULL
1106#  endif /* T_NULL */
1107#  ifdef T_UNSPEC
1108#   undef T_UNSPEC
1109#  endif /* T_UNSPEC */
1110#  ifdef T_IDLE
1111#   undef T_IDLE
1112#  endif /* T_IDLE */
1113# endif /* HAVE_ARPA_NAMESER_H */
1114# include <tiuser.h>
1115#endif /* HAVE_TIUSER_H */
1116
1117/*
1118 * Actions to take if <sys/tiuser.h> exists.
1119 */
1120#ifdef HAVE_SYS_TIUSER_H
1121# include <sys/tiuser.h>
1122#endif /* HAVE_SYS_TIUSER_H */
1123
1124/*
1125 * Actions to take if <sys/statfs.h> exists.
1126 */
1127#ifdef HAVE_SYS_STATFS_H
1128# include <sys/statfs.h>
1129#endif /* HAVE_SYS_STATFS_H */
1130
1131/*
1132 * Actions to take if <sys/vfs.h> exists.
1133 */
1134#ifdef HAVE_SYS_VFS_H
1135# include <sys/vfs.h>
1136#endif /* HAVE_SYS_VFS_H */
1137
1138/*
1139 * Actions to take if <sys/vmount.h> exists.
1140 */
1141#ifdef HAVE_SYS_VMOUNT_H
1142# include <sys/vmount.h>
1143#endif /* HAVE_SYS_VMOUNT_H */
1144
1145/*
1146 * Actions to take if <ufs/ufs_mount.h> exists.
1147 */
1148#ifdef HAVE_UFS_UFS_MOUNT_H
1149# include <ufs/ufs_mount.h>
1150#endif /* HAVE_UFS_UFS_MOUNT_H */
1151#ifdef HAVE_UFS_UFS_UFSMOUNT_H
1152# include <ufs/ufs/ufsmount.h>
1153#endif /* HAVE_UFS_UFS_UFSMOUNT_H */
1154
1155/*
1156 * Are S_ISDIR, S_ISREG, et al broken?  If not, include <sys/stat.h>.
1157 * Turned off the not using sys/stat.h based on if the macros are
1158 * "broken", because they incorrectly get reported as broken on
1159 * ncr2.
1160 */
1161#ifndef STAT_MACROS_BROKEN_notused
1162/*
1163 * RedHat Linux 4.2 (alpha) has a problem in the headers that causes
1164 * duplicate definitions, and also some other nasty bugs.  Upgrade to Redhat
1165 * 5.0!
1166 */
1167# ifdef HAVE_SYS_STAT_H
1168/* avoid duplicates or conflicts with <linux/stat.h> (RedHat alpha linux) */
1169#  if defined(S_IFREG) && defined(HAVE_STATBUF_H)
1170#   include <statbuf.h>
1171#   undef S_IFBLK
1172#   undef S_IFCHR
1173#   undef S_IFDIR
1174#   undef S_IFIFO
1175#   undef S_IFLNK
1176#   undef S_IFMT
1177#   undef S_IFREG
1178#   undef S_IFSOCK
1179#   undef S_IRGRP
1180#   undef S_IROTH
1181#   undef S_IRUSR
1182#   undef S_IRWXG
1183#   undef S_IRWXO
1184#   undef S_IRWXU
1185#   undef S_ISBLK
1186#   undef S_ISCHR
1187#   undef S_ISDIR
1188#   undef S_ISFIFO
1189#   undef S_ISGID
1190#   undef S_ISLNK
1191#   undef S_ISREG
1192#   undef S_ISSOCK
1193#   undef S_ISUID
1194#   undef S_ISVTX
1195#   undef S_IWGRP
1196#   undef S_IWOTH
1197#   undef S_IWUSR
1198#   undef S_IXGRP
1199#   undef S_IXOTH
1200#   undef S_IXUSR
1201#  endif /* defined(S_IFREG) && defined(HAVE_STATBUF_H) */
1202#  include <sys/stat.h>
1203# endif /* HAVE_SYS_STAT_H */
1204#endif /* not STAT_MACROS_BROKEN_notused */
1205
1206/*
1207 * Actions to take if <stdio.h> exists.
1208 */
1209#ifdef HAVE_STDIO_H
1210# include <stdio.h>
1211#endif /* HAVE_STDIO_H */
1212
1213/*
1214 * Actions to take if <stdlib.h> exists.
1215 */
1216#ifdef HAVE_STDLIB_H
1217# include <stdlib.h>
1218#endif /* HAVE_STDLIB_H */
1219
1220/*
1221 * Actions to take if <regex.h> exists.
1222 */
1223#ifdef HAVE_REGEX_H
1224# include <regex.h>
1225#endif /* HAVE_REGEX_H */
1226
1227
1228/****************************************************************************/
1229/*
1230 * Specific macros we're looking for.
1231 */
1232#ifndef HAVE_MEMSET
1233# ifdef HAVE_BZERO
1234#  define	memset(ptr, val, len)	bzero((ptr), (len))
1235# else /* not HAVE_BZERO */
1236#  error Cannot find either memset or bzero!
1237# endif /* not HAVE_BZERO */
1238#endif /* not HAVE_MEMSET */
1239
1240#ifndef HAVE_MEMMOVE
1241# ifdef HAVE_BCOPY
1242#  define	memmove(to, from, len)	bcopy((from), (to), (len))
1243# else /* not HAVE_BCOPY */
1244#  error Cannot find either memmove or bcopy!
1245# endif /* not HAVE_BCOPY */
1246#endif /* not HAVE_MEMMOVE */
1247
1248/*
1249 * memcmp() is more problematic:
1250 * Systems that don't have it, but have bcmp(), will use bcmp() instead.
1251 * Those that have it, but it is bad (SunOS 4 doesn't handle
1252 * 8 bit comparisons correctly), will get to use am_memcmp().
1253 * Otherwise if you have memcmp() and it is good, use it.
1254 */
1255#ifdef HAVE_MEMCMP
1256# ifdef HAVE_BAD_MEMCMP
1257#  define	memcmp		am_memcmp
1258extern int am_memcmp(const voidp s1, const voidp s2, size_t len);
1259# endif /* HAVE_BAD_MEMCMP */
1260#else /* not HAVE_MEMCMP */
1261# ifdef HAVE_BCMP
1262#  define	memcmp(a, b, len)	bcmp((a), (b), (len))
1263# endif /* HAVE_BCMP */
1264#endif /* not HAVE_MEMCMP */
1265
1266#ifndef HAVE_SETEUID
1267# ifdef HAVE_SETRESUID
1268#  define	seteuid(x)		setresuid(-1,(x),-1)
1269# else /* not HAVE_SETRESUID */
1270#  error Cannot find either seteuid or setresuid!
1271# endif /* not HAVE_SETRESUID */
1272#endif /* not HAVE_SETEUID */
1273
1274/*
1275 * Define type of mntent_t.
1276 * Defaults to struct mntent, else struct mnttab.  If neither is found, and
1277 * the operating system does keep not mount tables in the kernel, then flag
1278 * it as an error.  If neither is found and the OS keeps mount tables in the
1279 * kernel, then define our own version of mntent; it will be needed for amd
1280 * to keep its own internal version of the mount tables.
1281 */
1282#ifdef HAVE_STRUCT_MNTENT
1283typedef struct mntent mntent_t;
1284#else /* not HAVE_STRUCT_MNTENT */
1285# ifdef HAVE_STRUCT_MNTTAB
1286typedef struct mnttab mntent_t;
1287/* map struct mnttab field names to struct mntent field names */
1288#  define mnt_fsname	mnt_special
1289#  define mnt_dir	mnt_mountp
1290#  define mnt_opts	mnt_mntopts
1291#  define mnt_type	mnt_fstype
1292# else /* not HAVE_STRUCT_MNTTAB */
1293#  ifdef MOUNT_TABLE_ON_FILE
1294#   error Could not find definition for struct mntent or struct mnttab!
1295#  else /* not MOUNT_TABLE_ON_FILE */
1296typedef struct _am_mntent {
1297  char	*mnt_fsname;		/* name of mounted file system */
1298  char	*mnt_dir;		/* file system path prefix */
1299  char	*mnt_type;		/* MNTTAB_TYPE_* */
1300  char	*mnt_opts;		/* MNTTAB_OPT_* */
1301  int	mnt_freq;		/* dump frequency, in days */
1302  int	mnt_passno;		/* pass number on parallel fsck */
1303} mntent_t;
1304#  endif /* not MOUNT_TABLE_ON_FILE */
1305# endif /* not HAVE_STRUCT_MNTTAB */
1306#endif /* not HAVE_STRUCT_MNTENT */
1307
1308
1309/*
1310 * Complete external definitions missing from some systems.
1311 */
1312
1313#ifndef HAVE_EXTERN_SYS_ERRLIST
1314extern const char *const sys_errlist[];
1315#endif /* not HAVE_EXTERN_SYS_ERRLIST */
1316
1317#ifndef HAVE_EXTERN_OPTARG
1318extern char *optarg;
1319extern int optind;
1320#endif /* not HAVE_EXTERN_OPTARG */
1321
1322#if defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR)
1323extern char *clnt_spcreateerror(const char *s);
1324#endif /* defined(HAVE_CLNT_SPCREATEERROR) && !defined(HAVE_EXTERN_CLNT_SPCREATEERROR) */
1325
1326#if defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO)
1327extern char *clnt_sperrno(const enum clnt_stat num);
1328#endif /* defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO) */
1329
1330#ifndef HAVE_EXTERN_FREE
1331extern void free(voidp);
1332#endif /* not HAVE_EXTERN_FREE */
1333
1334#if defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS)
1335extern void get_myaddress(struct sockaddr_in *addr);
1336#endif /* defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS) */
1337
1338#if defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME)
1339# if defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS)
1340extern int getdomainname(char *name, int namelen);
1341# endif /* defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS) */
1342#endif /* defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME) */
1343
1344#if defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE)
1345extern int getdtablesize(void);
1346#endif /* defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE) */
1347
1348#if defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME)
1349extern int gethostname(char *name, int namelen);
1350#endif /* defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME) */
1351
1352#ifndef HAVE_EXTERN_GETLOGIN
1353extern char *getlogin(void);
1354#endif /* not HAVE_EXTERN_GETLOGIN */
1355
1356#if defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE)
1357extern int getpagesize(void);
1358#endif /* defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE) */
1359
1360#ifndef HAVE_EXTERN_GETWD
1361extern char *getwd(char *s);
1362#endif /* not HAVE_EXTERN_GETWD */
1363
1364#ifndef HAVE_EXTERN_INNETGR
1365extern int innetgr(char *, char *, char *, char *);
1366#endif /* not HAVE_EXTERN_INNETGR */
1367
1368#if defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP)
1369extern int mkstemp(char *);
1370#endif /* defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP) */
1371
1372#ifndef HAVE_EXTERN_SBRK
1373extern caddr_t sbrk(int incr);
1374#endif /* not HAVE_EXTERN_SBRK */
1375
1376#if defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID)
1377extern int seteuid(uid_t euid);
1378#endif /* not defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID) */
1379
1380#if defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER)
1381extern int setitimer(int, struct itimerval *, struct itimerval *);
1382#endif /* defined(HAVE_SETITIMER) && !defined(HAVE_EXTERN_SETITIMER) */
1383
1384#ifndef HAVE_EXTERN_STRCASECMP
1385/*
1386 * define this extern even if function does not exist, for it will
1387 * be filled in by libamu/strcasecmp.c
1388 */
1389extern int strcasecmp(const char *s1, const char *s2);
1390#endif /* not HAVE_EXTERN_STRCASECMP */
1391
1392#ifndef HAVE_EXTERN_STRDUP
1393/*
1394 * define this extern even if function does not exist, for it will
1395 * be filled in by libamu/strdup.c
1396 */
1397extern char *strdup(const char *s);
1398#endif /* not HAVE_EXTERN_STRDUP */
1399
1400#if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR)
1401extern char *strstr(const char *s1, const char *s2);
1402#endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */
1403
1404#if defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP)
1405extern int usleep(u_int useconds);
1406#endif /* defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP) */
1407
1408#ifndef HAVE_EXTERN_UALARM
1409extern u_int ualarm(u_int usecs, u_int interval);
1410#endif /* not HAVE_EXTERN_UALARM */
1411
1412#if defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3)
1413extern int wait3(int *statusp, int options, struct rusage *rusage);
1414#endif /* defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3) */
1415
1416#if defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF)
1417extern int vsnprintf(char *, int, const char *, ...);
1418#endif /* defined(HAVE_VSNPRINTF) && !defined(HAVE_EXTERN_VSNPRINTF) */
1419
1420#ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH
1421extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
1422#endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */
1423
1424/****************************************************************************/
1425/*
1426 * amd-specific header files.
1427 */
1428#ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE
1429# include <amu_nfs_prot.h>
1430#endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */
1431#include <am_utils.h>
1432#include <amq_defs.h>
1433#include <aux_conf.h>
1434/* compatibility with old amd, while autoconfiscating it */
1435#include <am_compat.h>
1436
1437
1438/****************************************************************************/
1439/*
1440 * External definitions that depend on other macros available (or not)
1441 * and those are probably declared in any of the above headers.
1442 */
1443
1444#ifndef HAVE_HASMNTOPT
1445extern char *hasmntopt(mntent_t *mnt, char *opt);
1446#endif /* not HAVE_HASMNTOPT */
1447
1448/*
1449 * include definitions of all possible xdr functions that are otherwise
1450 * not defined elsewhere.
1451 */
1452#include <am_xdr_func.h>
1453
1454#endif /* not _AM_DEFS_H */
1455