17c478bd9Sstevel@tonic-gate /* 2*90685d2cSjp161948 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 3*90685d2cSjp161948 * 4*90685d2cSjp161948 * Redistribution and use in source and binary forms, with or without 5*90685d2cSjp161948 * modification, are permitted provided that the following conditions 6*90685d2cSjp161948 * are met: 7*90685d2cSjp161948 * 1. Redistributions of source code must retain the above copyright 8*90685d2cSjp161948 * notice, this list of conditions and the following disclaimer. 9*90685d2cSjp161948 * 2. Redistributions in binary form must reproduce the above copyright 10*90685d2cSjp161948 * notice, this list of conditions and the following disclaimer in the 11*90685d2cSjp161948 * documentation and/or other materials provided with the distribution. 12*90685d2cSjp161948 * 13*90685d2cSjp161948 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14*90685d2cSjp161948 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15*90685d2cSjp161948 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16*90685d2cSjp161948 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17*90685d2cSjp161948 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18*90685d2cSjp161948 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19*90685d2cSjp161948 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20*90685d2cSjp161948 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21*90685d2cSjp161948 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22*90685d2cSjp161948 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*90685d2cSjp161948 */ 24*90685d2cSjp161948 /* 25*90685d2cSjp161948 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 267c478bd9Sstevel@tonic-gate * Use is subject to license terms. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _DEFINES_H 307c478bd9Sstevel@tonic-gate #define _DEFINES_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* $Id: defines.h,v 1.96 2002/09/26 00:38:48 tim Exp $ */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* Constants */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #ifndef SHUT_RDWR 447c478bd9Sstevel@tonic-gate enum 457c478bd9Sstevel@tonic-gate { 467c478bd9Sstevel@tonic-gate SHUT_RD = 0, /* No more receptions. */ 477c478bd9Sstevel@tonic-gate SHUT_WR, /* No more transmissions. */ 487c478bd9Sstevel@tonic-gate SHUT_RDWR /* No more receptions or transmissions. */ 497c478bd9Sstevel@tonic-gate }; 507c478bd9Sstevel@tonic-gate # define SHUT_RD SHUT_RD 517c478bd9Sstevel@tonic-gate # define SHUT_WR SHUT_WR 527c478bd9Sstevel@tonic-gate # define SHUT_RDWR SHUT_RDWR 537c478bd9Sstevel@tonic-gate #endif 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate #ifndef IPTOS_LOWDELAY 567c478bd9Sstevel@tonic-gate # define IPTOS_LOWDELAY 0x10 577c478bd9Sstevel@tonic-gate # define IPTOS_THROUGHPUT 0x08 587c478bd9Sstevel@tonic-gate # define IPTOS_RELIABILITY 0x04 597c478bd9Sstevel@tonic-gate # define IPTOS_LOWCOST 0x02 607c478bd9Sstevel@tonic-gate # define IPTOS_MINCOST IPTOS_LOWCOST 617c478bd9Sstevel@tonic-gate #endif /* IPTOS_LOWDELAY */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #ifndef MAXPATHLEN 647c478bd9Sstevel@tonic-gate # ifdef PATH_MAX 657c478bd9Sstevel@tonic-gate # define MAXPATHLEN PATH_MAX 667c478bd9Sstevel@tonic-gate # else /* PATH_MAX */ 677c478bd9Sstevel@tonic-gate # define MAXPATHLEN 64 /* Should be safe */ 687c478bd9Sstevel@tonic-gate # endif /* PATH_MAX */ 697c478bd9Sstevel@tonic-gate #endif /* MAXPATHLEN */ 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #ifndef STDIN_FILENO 727c478bd9Sstevel@tonic-gate # define STDIN_FILENO 0 737c478bd9Sstevel@tonic-gate #endif 747c478bd9Sstevel@tonic-gate #ifndef STDOUT_FILENO 757c478bd9Sstevel@tonic-gate # define STDOUT_FILENO 1 767c478bd9Sstevel@tonic-gate #endif 777c478bd9Sstevel@tonic-gate #ifndef STDERR_FILENO 787c478bd9Sstevel@tonic-gate # define STDERR_FILENO 2 797c478bd9Sstevel@tonic-gate #endif 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #ifndef NGROUPS_MAX /* Disable groupaccess if NGROUP_MAX is not set */ 827c478bd9Sstevel@tonic-gate #ifdef NGROUPS 837c478bd9Sstevel@tonic-gate #define NGROUPS_MAX NGROUPS 847c478bd9Sstevel@tonic-gate #else 857c478bd9Sstevel@tonic-gate #define NGROUPS_MAX 0 867c478bd9Sstevel@tonic-gate #endif 877c478bd9Sstevel@tonic-gate #endif 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #ifndef O_NONBLOCK /* Non Blocking Open */ 907c478bd9Sstevel@tonic-gate # define O_NONBLOCK 00004 917c478bd9Sstevel@tonic-gate #endif 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #ifndef S_ISDIR 947c478bd9Sstevel@tonic-gate # define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) 957c478bd9Sstevel@tonic-gate #endif /* S_ISDIR */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #ifndef S_ISREG 987c478bd9Sstevel@tonic-gate # define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) 997c478bd9Sstevel@tonic-gate #endif /* S_ISREG */ 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #ifndef S_ISLNK 1027c478bd9Sstevel@tonic-gate # define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) 1037c478bd9Sstevel@tonic-gate #endif /* S_ISLNK */ 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #ifndef S_IXUSR 1067c478bd9Sstevel@tonic-gate # define S_IXUSR 0000100 /* execute/search permission, */ 1077c478bd9Sstevel@tonic-gate # define S_IXGRP 0000010 /* execute/search permission, */ 1087c478bd9Sstevel@tonic-gate # define S_IXOTH 0000001 /* execute/search permission, */ 1097c478bd9Sstevel@tonic-gate # define _S_IWUSR 0000200 /* write permission, */ 1107c478bd9Sstevel@tonic-gate # define S_IWUSR _S_IWUSR /* write permission, owner */ 1117c478bd9Sstevel@tonic-gate # define S_IWGRP 0000020 /* write permission, group */ 1127c478bd9Sstevel@tonic-gate # define S_IWOTH 0000002 /* write permission, other */ 1137c478bd9Sstevel@tonic-gate # define S_IRUSR 0000400 /* read permission, owner */ 1147c478bd9Sstevel@tonic-gate # define S_IRGRP 0000040 /* read permission, group */ 1157c478bd9Sstevel@tonic-gate # define S_IROTH 0000004 /* read permission, other */ 1167c478bd9Sstevel@tonic-gate # define S_IRWXU 0000700 /* read, write, execute */ 1177c478bd9Sstevel@tonic-gate # define S_IRWXG 0000070 /* read, write, execute */ 1187c478bd9Sstevel@tonic-gate # define S_IRWXO 0000007 /* read, write, execute */ 1197c478bd9Sstevel@tonic-gate #endif /* S_IXUSR */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) 1227c478bd9Sstevel@tonic-gate #define MAP_ANON MAP_ANONYMOUS 1237c478bd9Sstevel@tonic-gate #endif 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #ifndef MAP_FAILED 1267c478bd9Sstevel@tonic-gate # define MAP_FAILED ((void *)-1) 1277c478bd9Sstevel@tonic-gate #endif 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this constant in the system headers */ 1307c478bd9Sstevel@tonic-gate #ifdef MISSING_NFDBITS 1317c478bd9Sstevel@tonic-gate # define NFDBITS (8 * sizeof(unsigned long)) 1327c478bd9Sstevel@tonic-gate #endif 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate /* 1357c478bd9Sstevel@tonic-gate SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but 1367c478bd9Sstevel@tonic-gate including rpc/rpc.h breaks Solaris 6 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate #ifndef INADDR_LOOPBACK 1397c478bd9Sstevel@tonic-gate #define INADDR_LOOPBACK ((u_long)0x7f000001) 1407c478bd9Sstevel@tonic-gate #endif 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate /* Types */ 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate /* If sys/types.h does not supply intXX_t, supply them ourselves */ 1457c478bd9Sstevel@tonic-gate /* (or die trying) */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT 1497c478bd9Sstevel@tonic-gate typedef unsigned int u_int; 1507c478bd9Sstevel@tonic-gate #endif 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate #ifndef HAVE_INTXX_T 1537c478bd9Sstevel@tonic-gate # if (SIZEOF_CHAR == 1) 1547c478bd9Sstevel@tonic-gate typedef char int8_t; 1557c478bd9Sstevel@tonic-gate # else 1567c478bd9Sstevel@tonic-gate # error "8 bit int type not found." 1577c478bd9Sstevel@tonic-gate # endif 1587c478bd9Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 2) 1597c478bd9Sstevel@tonic-gate typedef short int int16_t; 1607c478bd9Sstevel@tonic-gate # else 1617c478bd9Sstevel@tonic-gate # ifdef _UNICOS 1627c478bd9Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 4) 1637c478bd9Sstevel@tonic-gate typedef short int16_t; 1647c478bd9Sstevel@tonic-gate # else 1657c478bd9Sstevel@tonic-gate typedef long int16_t; 1667c478bd9Sstevel@tonic-gate # endif 1677c478bd9Sstevel@tonic-gate # else 1687c478bd9Sstevel@tonic-gate # error "16 bit int type not found." 1697c478bd9Sstevel@tonic-gate # endif /* _UNICOS */ 1707c478bd9Sstevel@tonic-gate # endif 1717c478bd9Sstevel@tonic-gate # if (SIZEOF_INT == 4) 1727c478bd9Sstevel@tonic-gate typedef int int32_t; 1737c478bd9Sstevel@tonic-gate # else 1747c478bd9Sstevel@tonic-gate # ifdef _UNICOS 1757c478bd9Sstevel@tonic-gate typedef long int32_t; 1767c478bd9Sstevel@tonic-gate # else 1777c478bd9Sstevel@tonic-gate # error "32 bit int type not found." 1787c478bd9Sstevel@tonic-gate # endif /* _UNICOS */ 1797c478bd9Sstevel@tonic-gate # endif 1807c478bd9Sstevel@tonic-gate #endif 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ 1837c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INTXX_T 1847c478bd9Sstevel@tonic-gate # ifdef HAVE_UINTXX_T 1857c478bd9Sstevel@tonic-gate typedef uint8_t u_int8_t; 1867c478bd9Sstevel@tonic-gate typedef uint16_t u_int16_t; 1877c478bd9Sstevel@tonic-gate typedef uint32_t u_int32_t; 1887c478bd9Sstevel@tonic-gate # define HAVE_U_INTXX_T 1 1897c478bd9Sstevel@tonic-gate # else 1907c478bd9Sstevel@tonic-gate # if (SIZEOF_CHAR == 1) 1917c478bd9Sstevel@tonic-gate typedef unsigned char u_int8_t; 1927c478bd9Sstevel@tonic-gate # else 1937c478bd9Sstevel@tonic-gate # error "8 bit int type not found." 1947c478bd9Sstevel@tonic-gate # endif 1957c478bd9Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 2) 1967c478bd9Sstevel@tonic-gate typedef unsigned short int u_int16_t; 1977c478bd9Sstevel@tonic-gate # else 1987c478bd9Sstevel@tonic-gate # ifdef _UNICOS 1997c478bd9Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 4) 2007c478bd9Sstevel@tonic-gate typedef unsigned short u_int16_t; 2017c478bd9Sstevel@tonic-gate # else 2027c478bd9Sstevel@tonic-gate typedef unsigned long u_int16_t; 2037c478bd9Sstevel@tonic-gate # endif 2047c478bd9Sstevel@tonic-gate # else 2057c478bd9Sstevel@tonic-gate # error "16 bit int type not found." 2067c478bd9Sstevel@tonic-gate # endif 2077c478bd9Sstevel@tonic-gate # endif 2087c478bd9Sstevel@tonic-gate # if (SIZEOF_INT == 4) 2097c478bd9Sstevel@tonic-gate typedef unsigned int u_int32_t; 2107c478bd9Sstevel@tonic-gate # else 2117c478bd9Sstevel@tonic-gate # ifdef _UNICOS 2127c478bd9Sstevel@tonic-gate typedef unsigned long u_int32_t; 2137c478bd9Sstevel@tonic-gate # else 2147c478bd9Sstevel@tonic-gate # error "32 bit int type not found." 2157c478bd9Sstevel@tonic-gate # endif 2167c478bd9Sstevel@tonic-gate # endif 2177c478bd9Sstevel@tonic-gate # endif 2187c478bd9Sstevel@tonic-gate #define __BIT_TYPES_DEFINED__ 2197c478bd9Sstevel@tonic-gate #endif 2207c478bd9Sstevel@tonic-gate 2217c478bd9Sstevel@tonic-gate /* 64-bit types */ 2227c478bd9Sstevel@tonic-gate #ifndef HAVE_INT64_T 2237c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8) 2247c478bd9Sstevel@tonic-gate typedef long int int64_t; 2257c478bd9Sstevel@tonic-gate # define HAVE_INT64_T 1 2267c478bd9Sstevel@tonic-gate # else 2277c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_LONG_INT == 8) 2287c478bd9Sstevel@tonic-gate typedef long long int int64_t; 2297c478bd9Sstevel@tonic-gate # define HAVE_INT64_T 1 2307c478bd9Sstevel@tonic-gate # endif 2317c478bd9Sstevel@tonic-gate # endif 2327c478bd9Sstevel@tonic-gate #endif 2337c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT64_T 2347c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8) 2357c478bd9Sstevel@tonic-gate typedef unsigned long int u_int64_t; 2367c478bd9Sstevel@tonic-gate # define HAVE_U_INT64_T 1 2377c478bd9Sstevel@tonic-gate # else 2387c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_LONG_INT == 8) 2397c478bd9Sstevel@tonic-gate typedef unsigned long long int u_int64_t; 2407c478bd9Sstevel@tonic-gate # define HAVE_U_INT64_T 1 2417c478bd9Sstevel@tonic-gate # endif 2427c478bd9Sstevel@tonic-gate # endif 2437c478bd9Sstevel@tonic-gate #endif 2447c478bd9Sstevel@tonic-gate #if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8) 2457c478bd9Sstevel@tonic-gate # define HAVE_LONG_LONG_INT 1 2467c478bd9Sstevel@tonic-gate #endif 2477c478bd9Sstevel@tonic-gate 2487c478bd9Sstevel@tonic-gate #ifndef HAVE_U_CHAR 2497c478bd9Sstevel@tonic-gate typedef unsigned char u_char; 2507c478bd9Sstevel@tonic-gate # define HAVE_U_CHAR 2517c478bd9Sstevel@tonic-gate #endif /* HAVE_U_CHAR */ 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate #ifndef SIZE_T_MAX 2547c478bd9Sstevel@tonic-gate #define SIZE_T_MAX ULONG_MAX 2557c478bd9Sstevel@tonic-gate #endif /* SIZE_T_MAX */ 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate #ifndef HAVE_SIZE_T 2587c478bd9Sstevel@tonic-gate typedef unsigned int size_t; 2597c478bd9Sstevel@tonic-gate # define HAVE_SIZE_T 2607c478bd9Sstevel@tonic-gate #endif /* HAVE_SIZE_T */ 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate #ifndef HAVE_SSIZE_T 2637c478bd9Sstevel@tonic-gate typedef int ssize_t; 2647c478bd9Sstevel@tonic-gate # define HAVE_SSIZE_T 2657c478bd9Sstevel@tonic-gate #endif /* HAVE_SSIZE_T */ 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate #ifndef HAVE_CLOCK_T 2687c478bd9Sstevel@tonic-gate typedef long clock_t; 2697c478bd9Sstevel@tonic-gate # define HAVE_CLOCK_T 2707c478bd9Sstevel@tonic-gate #endif /* HAVE_CLOCK_T */ 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate #ifndef HAVE_SA_FAMILY_T 2737c478bd9Sstevel@tonic-gate typedef int sa_family_t; 2747c478bd9Sstevel@tonic-gate # define HAVE_SA_FAMILY_T 2757c478bd9Sstevel@tonic-gate #endif /* HAVE_SA_FAMILY_T */ 2767c478bd9Sstevel@tonic-gate 2777c478bd9Sstevel@tonic-gate #ifndef HAVE_PID_T 2787c478bd9Sstevel@tonic-gate typedef int pid_t; 2797c478bd9Sstevel@tonic-gate # define HAVE_PID_T 2807c478bd9Sstevel@tonic-gate #endif /* HAVE_PID_T */ 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate #ifndef HAVE_SIG_ATOMIC_T 2837c478bd9Sstevel@tonic-gate typedef int sig_atomic_t; 2847c478bd9Sstevel@tonic-gate # define HAVE_SIG_ATOMIC_T 2857c478bd9Sstevel@tonic-gate #endif /* HAVE_SIG_ATOMIC_T */ 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #ifndef HAVE_MODE_T 2887c478bd9Sstevel@tonic-gate typedef int mode_t; 2897c478bd9Sstevel@tonic-gate # define HAVE_MODE_T 2907c478bd9Sstevel@tonic-gate #endif /* HAVE_MODE_T */ 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) 2937c478bd9Sstevel@tonic-gate # define ss_family __ss_family 2947c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */ 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate #ifndef HAVE_SYS_UN_H 2977c478bd9Sstevel@tonic-gate struct sockaddr_un { 2987c478bd9Sstevel@tonic-gate short sun_family; /* AF_UNIX */ 2997c478bd9Sstevel@tonic-gate char sun_path[108]; /* path name (gag) */ 3007c478bd9Sstevel@tonic-gate }; 3017c478bd9Sstevel@tonic-gate #endif /* HAVE_SYS_UN_H */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE) 3047c478bd9Sstevel@tonic-gate #define _STRUCT_WINSIZE 3057c478bd9Sstevel@tonic-gate struct winsize { 3067c478bd9Sstevel@tonic-gate unsigned short ws_row; /* rows, in characters */ 3077c478bd9Sstevel@tonic-gate unsigned short ws_col; /* columns, in character */ 3087c478bd9Sstevel@tonic-gate unsigned short ws_xpixel; /* horizontal size, pixels */ 3097c478bd9Sstevel@tonic-gate unsigned short ws_ypixel; /* vertical size, pixels */ 3107c478bd9Sstevel@tonic-gate }; 3117c478bd9Sstevel@tonic-gate #endif 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate /* *-*-nto-qnx does not define this type in the system headers */ 3147c478bd9Sstevel@tonic-gate #ifdef MISSING_FD_MASK 3157c478bd9Sstevel@tonic-gate typedef unsigned long int fd_mask; 3167c478bd9Sstevel@tonic-gate #endif 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate /* Paths */ 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate #ifndef _PATH_BSHELL 3217c478bd9Sstevel@tonic-gate # define _PATH_BSHELL "/bin/sh" 3227c478bd9Sstevel@tonic-gate #endif 3237c478bd9Sstevel@tonic-gate #ifndef _PATH_CSHELL 3247c478bd9Sstevel@tonic-gate # define _PATH_CSHELL "/bin/csh" 3257c478bd9Sstevel@tonic-gate #endif 3267c478bd9Sstevel@tonic-gate #ifndef _PATH_SHELLS 3277c478bd9Sstevel@tonic-gate # define _PATH_SHELLS "/etc/shells" 3287c478bd9Sstevel@tonic-gate #endif 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate #ifdef USER_PATH 3317c478bd9Sstevel@tonic-gate # ifdef _PATH_STDPATH 3327c478bd9Sstevel@tonic-gate # undef _PATH_STDPATH 3337c478bd9Sstevel@tonic-gate # endif 3347c478bd9Sstevel@tonic-gate # define _PATH_STDPATH USER_PATH 3357c478bd9Sstevel@tonic-gate #endif 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate #ifndef _PATH_STDPATH 3387c478bd9Sstevel@tonic-gate # define _PATH_STDPATH "/usr/bin" 3397c478bd9Sstevel@tonic-gate #endif 3407c478bd9Sstevel@tonic-gate 3417c478bd9Sstevel@tonic-gate #ifndef _PATH_DEVNULL 3427c478bd9Sstevel@tonic-gate # define _PATH_DEVNULL "/dev/null" 3437c478bd9Sstevel@tonic-gate #endif 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate #ifndef MAIL_DIRECTORY 3467c478bd9Sstevel@tonic-gate # define MAIL_DIRECTORY "/var/spool/mail" 3477c478bd9Sstevel@tonic-gate #endif 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate #ifndef MAILDIR 3507c478bd9Sstevel@tonic-gate # define MAILDIR MAIL_DIRECTORY 3517c478bd9Sstevel@tonic-gate #endif 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate #if !defined(_PATH_MAILDIR) && defined(MAILDIR) 3547c478bd9Sstevel@tonic-gate # define _PATH_MAILDIR MAILDIR 3557c478bd9Sstevel@tonic-gate #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate #ifndef _PATH_RSH 3587c478bd9Sstevel@tonic-gate # ifdef RSH_PATH 3597c478bd9Sstevel@tonic-gate # define _PATH_RSH RSH_PATH 3607c478bd9Sstevel@tonic-gate # else /* RSH_PATH */ 3617c478bd9Sstevel@tonic-gate # define _PATH_RSH "/usr/bin/rsh" 3627c478bd9Sstevel@tonic-gate # endif /* RSH_PATH */ 3637c478bd9Sstevel@tonic-gate #endif /* _PATH_RSH */ 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate #ifndef _PATH_NOLOGIN 3667c478bd9Sstevel@tonic-gate # define _PATH_NOLOGIN "/etc/nologin" 3677c478bd9Sstevel@tonic-gate #endif 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate /* Define this to be the path of the xauth program. */ 3707c478bd9Sstevel@tonic-gate #ifdef XAUTH_PATH 3717c478bd9Sstevel@tonic-gate #define _PATH_XAUTH XAUTH_PATH 3727c478bd9Sstevel@tonic-gate #endif /* XAUTH_PATH */ 3737c478bd9Sstevel@tonic-gate 3747c478bd9Sstevel@tonic-gate /* derived from XF4/xc/lib/dps/Xlibnet.h */ 3757c478bd9Sstevel@tonic-gate #ifndef X_UNIX_PATH 3767c478bd9Sstevel@tonic-gate # ifdef __hpux 3777c478bd9Sstevel@tonic-gate # define X_UNIX_PATH "/var/spool/sockets/X11/%u" 3787c478bd9Sstevel@tonic-gate # else 3797c478bd9Sstevel@tonic-gate # define X_UNIX_PATH "/tmp/.X11-unix/X%u" 3807c478bd9Sstevel@tonic-gate # endif 3817c478bd9Sstevel@tonic-gate #endif /* X_UNIX_PATH */ 3827c478bd9Sstevel@tonic-gate #define _PATH_UNIX_X X_UNIX_PATH 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate #ifndef _PATH_TTY 3857c478bd9Sstevel@tonic-gate # define _PATH_TTY "/dev/tty" 3867c478bd9Sstevel@tonic-gate #endif 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate /* Macros */ 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate #if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H) 3917c478bd9Sstevel@tonic-gate # define HAVE_LOGIN_CAP 3927c478bd9Sstevel@tonic-gate #endif 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate #ifndef MAX 3957c478bd9Sstevel@tonic-gate # define MAX(a,b) (((a)>(b))?(a):(b)) 3967c478bd9Sstevel@tonic-gate # define MIN(a,b) (((a)<(b))?(a):(b)) 3977c478bd9Sstevel@tonic-gate #endif 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate #ifndef roundup 4007c478bd9Sstevel@tonic-gate # define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 4017c478bd9Sstevel@tonic-gate #endif 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate #ifndef timersub 4047c478bd9Sstevel@tonic-gate #define timersub(a, b, result) \ 4057c478bd9Sstevel@tonic-gate do { \ 4067c478bd9Sstevel@tonic-gate (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 4077c478bd9Sstevel@tonic-gate (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 4087c478bd9Sstevel@tonic-gate if ((result)->tv_usec < 0) { \ 4097c478bd9Sstevel@tonic-gate --(result)->tv_sec; \ 4107c478bd9Sstevel@tonic-gate (result)->tv_usec += 1000000; \ 4117c478bd9Sstevel@tonic-gate } \ 4127c478bd9Sstevel@tonic-gate } while (0) 4137c478bd9Sstevel@tonic-gate #endif 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate #ifndef __P 4167c478bd9Sstevel@tonic-gate # define __P(x) x 4177c478bd9Sstevel@tonic-gate #endif 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate #if !defined(IN6_IS_ADDR_V4MAPPED) 4207c478bd9Sstevel@tonic-gate # define IN6_IS_ADDR_V4MAPPED(a) \ 4217c478bd9Sstevel@tonic-gate ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ 4227c478bd9Sstevel@tonic-gate (((u_int32_t *) (a))[2] == htonl (0xffff))) 4237c478bd9Sstevel@tonic-gate #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */ 4247c478bd9Sstevel@tonic-gate 4257c478bd9Sstevel@tonic-gate #if !defined(__GNUC__) || (__GNUC__ < 2) 4267c478bd9Sstevel@tonic-gate # define __attribute__(x) 4277c478bd9Sstevel@tonic-gate #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ 4287c478bd9Sstevel@tonic-gate 429*90685d2cSjp161948 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__) 430*90685d2cSjp161948 # define __bounded__(x, y, z) 431*90685d2cSjp161948 #endif 432*90685d2cSjp161948 4337c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this macro in the system headers */ 4347c478bd9Sstevel@tonic-gate #ifdef MISSING_HOWMANY 4357c478bd9Sstevel@tonic-gate # define howmany(x,y) (((x)+((y)-1))/(y)) 4367c478bd9Sstevel@tonic-gate #endif 4377c478bd9Sstevel@tonic-gate 4387c478bd9Sstevel@tonic-gate #ifndef OSSH_ALIGNBYTES 4397c478bd9Sstevel@tonic-gate #define OSSH_ALIGNBYTES (sizeof(int) - 1) 4407c478bd9Sstevel@tonic-gate #endif 4417c478bd9Sstevel@tonic-gate #ifndef __CMSG_ALIGN 4427c478bd9Sstevel@tonic-gate #define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES) 4437c478bd9Sstevel@tonic-gate #endif 4447c478bd9Sstevel@tonic-gate 4457c478bd9Sstevel@tonic-gate /* Length of the contents of a control message of length len */ 4467c478bd9Sstevel@tonic-gate #ifndef CMSG_LEN 4477c478bd9Sstevel@tonic-gate #define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 4487c478bd9Sstevel@tonic-gate #endif 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gate /* Length of the space taken up by a padded control message of length len */ 4517c478bd9Sstevel@tonic-gate #ifndef CMSG_SPACE 4527c478bd9Sstevel@tonic-gate #define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) 4537c478bd9Sstevel@tonic-gate #endif 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate /* Function replacement / compatibility hacks */ 4567c478bd9Sstevel@tonic-gate 4577c478bd9Sstevel@tonic-gate #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) 4587c478bd9Sstevel@tonic-gate # define HAVE_GETADDRINFO 4597c478bd9Sstevel@tonic-gate #endif 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate #ifndef HAVE_GETOPT_OPTRESET 4627c478bd9Sstevel@tonic-gate # undef getopt 4637c478bd9Sstevel@tonic-gate # undef opterr 4647c478bd9Sstevel@tonic-gate # undef optind 4657c478bd9Sstevel@tonic-gate # undef optopt 4667c478bd9Sstevel@tonic-gate # undef optreset 4677c478bd9Sstevel@tonic-gate # undef optarg 4687c478bd9Sstevel@tonic-gate # define getopt(ac, av, o) BSDgetopt(ac, av, o) 4697c478bd9Sstevel@tonic-gate # define opterr BSDopterr 4707c478bd9Sstevel@tonic-gate # define optind BSDoptind 4717c478bd9Sstevel@tonic-gate # define optopt BSDoptopt 4727c478bd9Sstevel@tonic-gate # define optreset BSDoptreset 4737c478bd9Sstevel@tonic-gate # define optarg BSDoptarg 4747c478bd9Sstevel@tonic-gate #endif 4757c478bd9Sstevel@tonic-gate 4767c478bd9Sstevel@tonic-gate /* In older versions of libpam, pam_strerror takes a single argument */ 4777c478bd9Sstevel@tonic-gate #ifdef HAVE_OLD_PAM 4787c478bd9Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((b)) 4797c478bd9Sstevel@tonic-gate #else 4807c478bd9Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((a),(b)) 4817c478bd9Sstevel@tonic-gate #endif 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate #ifdef PAM_SUN_CODEBASE 4847c478bd9Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member) 4857c478bd9Sstevel@tonic-gate #else 4867c478bd9Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member) 4877c478bd9Sstevel@tonic-gate #endif 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) 4907c478bd9Sstevel@tonic-gate # undef HAVE_GETADDRINFO 4917c478bd9Sstevel@tonic-gate #endif 4927c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO) 4937c478bd9Sstevel@tonic-gate # undef HAVE_FREEADDRINFO 4947c478bd9Sstevel@tonic-gate #endif 4957c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR) 4967c478bd9Sstevel@tonic-gate # undef HAVE_GAI_STRERROR 4977c478bd9Sstevel@tonic-gate #endif 4987c478bd9Sstevel@tonic-gate 4997c478bd9Sstevel@tonic-gate #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) 5007c478bd9Sstevel@tonic-gate # define memmove(s1, s2, n) bcopy((s2), (s1), (n)) 5017c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */ 5027c478bd9Sstevel@tonic-gate 5037c478bd9Sstevel@tonic-gate #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) 5047c478bd9Sstevel@tonic-gate # define USE_VHANGUP 5057c478bd9Sstevel@tonic-gate #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */ 5067c478bd9Sstevel@tonic-gate 5077c478bd9Sstevel@tonic-gate #ifndef GETPGRP_VOID 5087c478bd9Sstevel@tonic-gate # define getpgrp() getpgrp(0) 5097c478bd9Sstevel@tonic-gate #endif 5107c478bd9Sstevel@tonic-gate 5117c478bd9Sstevel@tonic-gate /* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */ 5127c478bd9Sstevel@tonic-gate #if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f) 5137c478bd9Sstevel@tonic-gate # define OPENSSL_free(x) Free(x) 5147c478bd9Sstevel@tonic-gate #endif 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gate #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__) 5177c478bd9Sstevel@tonic-gate # define __func__ __FUNCTION__ 5187c478bd9Sstevel@tonic-gate #elif !defined(HAVE___func__) 5197c478bd9Sstevel@tonic-gate # define __func__ "" 5207c478bd9Sstevel@tonic-gate #endif 5217c478bd9Sstevel@tonic-gate 5227c478bd9Sstevel@tonic-gate /* 5237c478bd9Sstevel@tonic-gate * Define this to use pipes instead of socketpairs for communicating with the 5247c478bd9Sstevel@tonic-gate * client program. Socketpairs do not seem to work on all systems. 5257c478bd9Sstevel@tonic-gate * 5267c478bd9Sstevel@tonic-gate * configure.ac sets this for a few OS's which are known to have problems 5277c478bd9Sstevel@tonic-gate * but you may need to set it yourself 5287c478bd9Sstevel@tonic-gate */ 5297c478bd9Sstevel@tonic-gate /* #define USE_PIPES 1 */ 5307c478bd9Sstevel@tonic-gate 5317c478bd9Sstevel@tonic-gate /** 5327c478bd9Sstevel@tonic-gate ** login recorder definitions 5337c478bd9Sstevel@tonic-gate **/ 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gate /* FIXME: put default paths back in */ 5367c478bd9Sstevel@tonic-gate #ifndef UTMP_FILE 5377c478bd9Sstevel@tonic-gate # ifdef _PATH_UTMP 5387c478bd9Sstevel@tonic-gate # define UTMP_FILE _PATH_UTMP 5397c478bd9Sstevel@tonic-gate # else 5407c478bd9Sstevel@tonic-gate # ifdef CONF_UTMP_FILE 5417c478bd9Sstevel@tonic-gate # define UTMP_FILE CONF_UTMP_FILE 5427c478bd9Sstevel@tonic-gate # endif 5437c478bd9Sstevel@tonic-gate # endif 5447c478bd9Sstevel@tonic-gate #endif 5457c478bd9Sstevel@tonic-gate #ifndef WTMP_FILE 5467c478bd9Sstevel@tonic-gate # ifdef _PATH_WTMP 5477c478bd9Sstevel@tonic-gate # define WTMP_FILE _PATH_WTMP 5487c478bd9Sstevel@tonic-gate # else 5497c478bd9Sstevel@tonic-gate # ifdef CONF_WTMP_FILE 5507c478bd9Sstevel@tonic-gate # define WTMP_FILE CONF_WTMP_FILE 5517c478bd9Sstevel@tonic-gate # endif 5527c478bd9Sstevel@tonic-gate # endif 5537c478bd9Sstevel@tonic-gate #endif 5547c478bd9Sstevel@tonic-gate /* pick up the user's location for lastlog if given */ 5557c478bd9Sstevel@tonic-gate #ifndef LASTLOG_FILE 5567c478bd9Sstevel@tonic-gate # ifdef _PATH_LASTLOG 5577c478bd9Sstevel@tonic-gate # define LASTLOG_FILE _PATH_LASTLOG 5587c478bd9Sstevel@tonic-gate # else 5597c478bd9Sstevel@tonic-gate # ifdef CONF_LASTLOG_FILE 5607c478bd9Sstevel@tonic-gate # define LASTLOG_FILE CONF_LASTLOG_FILE 5617c478bd9Sstevel@tonic-gate # endif 5627c478bd9Sstevel@tonic-gate # endif 5637c478bd9Sstevel@tonic-gate #endif 5647c478bd9Sstevel@tonic-gate 5657c478bd9Sstevel@tonic-gate 5667c478bd9Sstevel@tonic-gate /* The login() library function in libutil is first choice */ 5677c478bd9Sstevel@tonic-gate #if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN) 5687c478bd9Sstevel@tonic-gate # define USE_LOGIN 5697c478bd9Sstevel@tonic-gate 5707c478bd9Sstevel@tonic-gate #else 5717c478bd9Sstevel@tonic-gate /* Simply select your favourite login types. */ 5727c478bd9Sstevel@tonic-gate /* Can't do if-else because some systems use several... <sigh> */ 5737c478bd9Sstevel@tonic-gate # if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX) 5747c478bd9Sstevel@tonic-gate # define USE_UTMPX 5757c478bd9Sstevel@tonic-gate # endif 5767c478bd9Sstevel@tonic-gate # if defined(UTMP_FILE) && !defined(DISABLE_UTMP) 5777c478bd9Sstevel@tonic-gate # define USE_UTMP 5787c478bd9Sstevel@tonic-gate # endif 5797c478bd9Sstevel@tonic-gate # if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX) 5807c478bd9Sstevel@tonic-gate # define USE_WTMPX 5817c478bd9Sstevel@tonic-gate # endif 5827c478bd9Sstevel@tonic-gate # if defined(WTMP_FILE) && !defined(DISABLE_WTMP) 5837c478bd9Sstevel@tonic-gate # define USE_WTMP 5847c478bd9Sstevel@tonic-gate # endif 5857c478bd9Sstevel@tonic-gate 5867c478bd9Sstevel@tonic-gate #endif 5877c478bd9Sstevel@tonic-gate 5887c478bd9Sstevel@tonic-gate /* I hope that the presence of LASTLOG_FILE is enough to detect this */ 5897c478bd9Sstevel@tonic-gate #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG) 5907c478bd9Sstevel@tonic-gate # define USE_LASTLOG 5917c478bd9Sstevel@tonic-gate #endif 5927c478bd9Sstevel@tonic-gate 5937c478bd9Sstevel@tonic-gate /** end of login recorder definitions */ 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate #ifdef __cplusplus 5967c478bd9Sstevel@tonic-gate } 5977c478bd9Sstevel@tonic-gate #endif 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate #endif /* _DEFINES_H */ 600