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