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