10Sstevel@tonic-gate /* 2*5087Sjp161948 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 3*5087Sjp161948 * 4*5087Sjp161948 * Redistribution and use in source and binary forms, with or without 5*5087Sjp161948 * modification, are permitted provided that the following conditions 6*5087Sjp161948 * are met: 7*5087Sjp161948 * 1. Redistributions of source code must retain the above copyright 8*5087Sjp161948 * notice, this list of conditions and the following disclaimer. 9*5087Sjp161948 * 2. Redistributions in binary form must reproduce the above copyright 10*5087Sjp161948 * notice, this list of conditions and the following disclaimer in the 11*5087Sjp161948 * documentation and/or other materials provided with the distribution. 12*5087Sjp161948 * 13*5087Sjp161948 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14*5087Sjp161948 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15*5087Sjp161948 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16*5087Sjp161948 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17*5087Sjp161948 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18*5087Sjp161948 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19*5087Sjp161948 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20*5087Sjp161948 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21*5087Sjp161948 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22*5087Sjp161948 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*5087Sjp161948 */ 24*5087Sjp161948 /* 25*5087Sjp161948 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 260Sstevel@tonic-gate * Use is subject to license terms. 270Sstevel@tonic-gate */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _DEFINES_H 300Sstevel@tonic-gate #define _DEFINES_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* $Id: defines.h,v 1.96 2002/09/26 00:38:48 tim Exp $ */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* Constants */ 420Sstevel@tonic-gate 430Sstevel@tonic-gate #ifndef SHUT_RDWR 440Sstevel@tonic-gate enum 450Sstevel@tonic-gate { 460Sstevel@tonic-gate SHUT_RD = 0, /* No more receptions. */ 470Sstevel@tonic-gate SHUT_WR, /* No more transmissions. */ 480Sstevel@tonic-gate SHUT_RDWR /* No more receptions or transmissions. */ 490Sstevel@tonic-gate }; 500Sstevel@tonic-gate # define SHUT_RD SHUT_RD 510Sstevel@tonic-gate # define SHUT_WR SHUT_WR 520Sstevel@tonic-gate # define SHUT_RDWR SHUT_RDWR 530Sstevel@tonic-gate #endif 540Sstevel@tonic-gate 550Sstevel@tonic-gate #ifndef IPTOS_LOWDELAY 560Sstevel@tonic-gate # define IPTOS_LOWDELAY 0x10 570Sstevel@tonic-gate # define IPTOS_THROUGHPUT 0x08 580Sstevel@tonic-gate # define IPTOS_RELIABILITY 0x04 590Sstevel@tonic-gate # define IPTOS_LOWCOST 0x02 600Sstevel@tonic-gate # define IPTOS_MINCOST IPTOS_LOWCOST 610Sstevel@tonic-gate #endif /* IPTOS_LOWDELAY */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate #ifndef MAXPATHLEN 640Sstevel@tonic-gate # ifdef PATH_MAX 650Sstevel@tonic-gate # define MAXPATHLEN PATH_MAX 660Sstevel@tonic-gate # else /* PATH_MAX */ 670Sstevel@tonic-gate # define MAXPATHLEN 64 /* Should be safe */ 680Sstevel@tonic-gate # endif /* PATH_MAX */ 690Sstevel@tonic-gate #endif /* MAXPATHLEN */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate #ifndef STDIN_FILENO 720Sstevel@tonic-gate # define STDIN_FILENO 0 730Sstevel@tonic-gate #endif 740Sstevel@tonic-gate #ifndef STDOUT_FILENO 750Sstevel@tonic-gate # define STDOUT_FILENO 1 760Sstevel@tonic-gate #endif 770Sstevel@tonic-gate #ifndef STDERR_FILENO 780Sstevel@tonic-gate # define STDERR_FILENO 2 790Sstevel@tonic-gate #endif 800Sstevel@tonic-gate 810Sstevel@tonic-gate #ifndef NGROUPS_MAX /* Disable groupaccess if NGROUP_MAX is not set */ 820Sstevel@tonic-gate #ifdef NGROUPS 830Sstevel@tonic-gate #define NGROUPS_MAX NGROUPS 840Sstevel@tonic-gate #else 850Sstevel@tonic-gate #define NGROUPS_MAX 0 860Sstevel@tonic-gate #endif 870Sstevel@tonic-gate #endif 880Sstevel@tonic-gate 890Sstevel@tonic-gate #ifndef O_NONBLOCK /* Non Blocking Open */ 900Sstevel@tonic-gate # define O_NONBLOCK 00004 910Sstevel@tonic-gate #endif 920Sstevel@tonic-gate 930Sstevel@tonic-gate #ifndef S_ISDIR 940Sstevel@tonic-gate # define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) 950Sstevel@tonic-gate #endif /* S_ISDIR */ 960Sstevel@tonic-gate 970Sstevel@tonic-gate #ifndef S_ISREG 980Sstevel@tonic-gate # define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) 990Sstevel@tonic-gate #endif /* S_ISREG */ 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate #ifndef S_ISLNK 1020Sstevel@tonic-gate # define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) 1030Sstevel@tonic-gate #endif /* S_ISLNK */ 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate #ifndef S_IXUSR 1060Sstevel@tonic-gate # define S_IXUSR 0000100 /* execute/search permission, */ 1070Sstevel@tonic-gate # define S_IXGRP 0000010 /* execute/search permission, */ 1080Sstevel@tonic-gate # define S_IXOTH 0000001 /* execute/search permission, */ 1090Sstevel@tonic-gate # define _S_IWUSR 0000200 /* write permission, */ 1100Sstevel@tonic-gate # define S_IWUSR _S_IWUSR /* write permission, owner */ 1110Sstevel@tonic-gate # define S_IWGRP 0000020 /* write permission, group */ 1120Sstevel@tonic-gate # define S_IWOTH 0000002 /* write permission, other */ 1130Sstevel@tonic-gate # define S_IRUSR 0000400 /* read permission, owner */ 1140Sstevel@tonic-gate # define S_IRGRP 0000040 /* read permission, group */ 1150Sstevel@tonic-gate # define S_IROTH 0000004 /* read permission, other */ 1160Sstevel@tonic-gate # define S_IRWXU 0000700 /* read, write, execute */ 1170Sstevel@tonic-gate # define S_IRWXG 0000070 /* read, write, execute */ 1180Sstevel@tonic-gate # define S_IRWXO 0000007 /* read, write, execute */ 1190Sstevel@tonic-gate #endif /* S_IXUSR */ 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) 1220Sstevel@tonic-gate #define MAP_ANON MAP_ANONYMOUS 1230Sstevel@tonic-gate #endif 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #ifndef MAP_FAILED 1260Sstevel@tonic-gate # define MAP_FAILED ((void *)-1) 1270Sstevel@tonic-gate #endif 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this constant in the system headers */ 1300Sstevel@tonic-gate #ifdef MISSING_NFDBITS 1310Sstevel@tonic-gate # define NFDBITS (8 * sizeof(unsigned long)) 1320Sstevel@tonic-gate #endif 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate /* 1350Sstevel@tonic-gate SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but 1360Sstevel@tonic-gate including rpc/rpc.h breaks Solaris 6 1370Sstevel@tonic-gate */ 1380Sstevel@tonic-gate #ifndef INADDR_LOOPBACK 1390Sstevel@tonic-gate #define INADDR_LOOPBACK ((u_long)0x7f000001) 1400Sstevel@tonic-gate #endif 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* Types */ 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate /* If sys/types.h does not supply intXX_t, supply them ourselves */ 1450Sstevel@tonic-gate /* (or die trying) */ 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate #ifndef HAVE_U_INT 1490Sstevel@tonic-gate typedef unsigned int u_int; 1500Sstevel@tonic-gate #endif 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate #ifndef HAVE_INTXX_T 1530Sstevel@tonic-gate # if (SIZEOF_CHAR == 1) 1540Sstevel@tonic-gate typedef char int8_t; 1550Sstevel@tonic-gate # else 1560Sstevel@tonic-gate # error "8 bit int type not found." 1570Sstevel@tonic-gate # endif 1580Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 2) 1590Sstevel@tonic-gate typedef short int int16_t; 1600Sstevel@tonic-gate # else 1610Sstevel@tonic-gate # ifdef _UNICOS 1620Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 4) 1630Sstevel@tonic-gate typedef short int16_t; 1640Sstevel@tonic-gate # else 1650Sstevel@tonic-gate typedef long int16_t; 1660Sstevel@tonic-gate # endif 1670Sstevel@tonic-gate # else 1680Sstevel@tonic-gate # error "16 bit int type not found." 1690Sstevel@tonic-gate # endif /* _UNICOS */ 1700Sstevel@tonic-gate # endif 1710Sstevel@tonic-gate # if (SIZEOF_INT == 4) 1720Sstevel@tonic-gate typedef int int32_t; 1730Sstevel@tonic-gate # else 1740Sstevel@tonic-gate # ifdef _UNICOS 1750Sstevel@tonic-gate typedef long int32_t; 1760Sstevel@tonic-gate # else 1770Sstevel@tonic-gate # error "32 bit int type not found." 1780Sstevel@tonic-gate # endif /* _UNICOS */ 1790Sstevel@tonic-gate # endif 1800Sstevel@tonic-gate #endif 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ 1830Sstevel@tonic-gate #ifndef HAVE_U_INTXX_T 1840Sstevel@tonic-gate # ifdef HAVE_UINTXX_T 1850Sstevel@tonic-gate typedef uint8_t u_int8_t; 1860Sstevel@tonic-gate typedef uint16_t u_int16_t; 1870Sstevel@tonic-gate typedef uint32_t u_int32_t; 1880Sstevel@tonic-gate # define HAVE_U_INTXX_T 1 1890Sstevel@tonic-gate # else 1900Sstevel@tonic-gate # if (SIZEOF_CHAR == 1) 1910Sstevel@tonic-gate typedef unsigned char u_int8_t; 1920Sstevel@tonic-gate # else 1930Sstevel@tonic-gate # error "8 bit int type not found." 1940Sstevel@tonic-gate # endif 1950Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 2) 1960Sstevel@tonic-gate typedef unsigned short int u_int16_t; 1970Sstevel@tonic-gate # else 1980Sstevel@tonic-gate # ifdef _UNICOS 1990Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 4) 2000Sstevel@tonic-gate typedef unsigned short u_int16_t; 2010Sstevel@tonic-gate # else 2020Sstevel@tonic-gate typedef unsigned long u_int16_t; 2030Sstevel@tonic-gate # endif 2040Sstevel@tonic-gate # else 2050Sstevel@tonic-gate # error "16 bit int type not found." 2060Sstevel@tonic-gate # endif 2070Sstevel@tonic-gate # endif 2080Sstevel@tonic-gate # if (SIZEOF_INT == 4) 2090Sstevel@tonic-gate typedef unsigned int u_int32_t; 2100Sstevel@tonic-gate # else 2110Sstevel@tonic-gate # ifdef _UNICOS 2120Sstevel@tonic-gate typedef unsigned long u_int32_t; 2130Sstevel@tonic-gate # else 2140Sstevel@tonic-gate # error "32 bit int type not found." 2150Sstevel@tonic-gate # endif 2160Sstevel@tonic-gate # endif 2170Sstevel@tonic-gate # endif 2180Sstevel@tonic-gate #define __BIT_TYPES_DEFINED__ 2190Sstevel@tonic-gate #endif 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate /* 64-bit types */ 2220Sstevel@tonic-gate #ifndef HAVE_INT64_T 2230Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8) 2240Sstevel@tonic-gate typedef long int int64_t; 2250Sstevel@tonic-gate # define HAVE_INT64_T 1 2260Sstevel@tonic-gate # else 2270Sstevel@tonic-gate # if (SIZEOF_LONG_LONG_INT == 8) 2280Sstevel@tonic-gate typedef long long int int64_t; 2290Sstevel@tonic-gate # define HAVE_INT64_T 1 2300Sstevel@tonic-gate # endif 2310Sstevel@tonic-gate # endif 2320Sstevel@tonic-gate #endif 2330Sstevel@tonic-gate #ifndef HAVE_U_INT64_T 2340Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8) 2350Sstevel@tonic-gate typedef unsigned long int u_int64_t; 2360Sstevel@tonic-gate # define HAVE_U_INT64_T 1 2370Sstevel@tonic-gate # else 2380Sstevel@tonic-gate # if (SIZEOF_LONG_LONG_INT == 8) 2390Sstevel@tonic-gate typedef unsigned long long int u_int64_t; 2400Sstevel@tonic-gate # define HAVE_U_INT64_T 1 2410Sstevel@tonic-gate # endif 2420Sstevel@tonic-gate # endif 2430Sstevel@tonic-gate #endif 2440Sstevel@tonic-gate #if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8) 2450Sstevel@tonic-gate # define HAVE_LONG_LONG_INT 1 2460Sstevel@tonic-gate #endif 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate #ifndef HAVE_U_CHAR 2490Sstevel@tonic-gate typedef unsigned char u_char; 2500Sstevel@tonic-gate # define HAVE_U_CHAR 2510Sstevel@tonic-gate #endif /* HAVE_U_CHAR */ 2520Sstevel@tonic-gate 2530Sstevel@tonic-gate #ifndef SIZE_T_MAX 2540Sstevel@tonic-gate #define SIZE_T_MAX ULONG_MAX 2550Sstevel@tonic-gate #endif /* SIZE_T_MAX */ 2560Sstevel@tonic-gate 2570Sstevel@tonic-gate #ifndef HAVE_SIZE_T 2580Sstevel@tonic-gate typedef unsigned int size_t; 2590Sstevel@tonic-gate # define HAVE_SIZE_T 2600Sstevel@tonic-gate #endif /* HAVE_SIZE_T */ 2610Sstevel@tonic-gate 2620Sstevel@tonic-gate #ifndef HAVE_SSIZE_T 2630Sstevel@tonic-gate typedef int ssize_t; 2640Sstevel@tonic-gate # define HAVE_SSIZE_T 2650Sstevel@tonic-gate #endif /* HAVE_SSIZE_T */ 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate #ifndef HAVE_CLOCK_T 2680Sstevel@tonic-gate typedef long clock_t; 2690Sstevel@tonic-gate # define HAVE_CLOCK_T 2700Sstevel@tonic-gate #endif /* HAVE_CLOCK_T */ 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate #ifndef HAVE_SA_FAMILY_T 2730Sstevel@tonic-gate typedef int sa_family_t; 2740Sstevel@tonic-gate # define HAVE_SA_FAMILY_T 2750Sstevel@tonic-gate #endif /* HAVE_SA_FAMILY_T */ 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate #ifndef HAVE_PID_T 2780Sstevel@tonic-gate typedef int pid_t; 2790Sstevel@tonic-gate # define HAVE_PID_T 2800Sstevel@tonic-gate #endif /* HAVE_PID_T */ 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate #ifndef HAVE_SIG_ATOMIC_T 2830Sstevel@tonic-gate typedef int sig_atomic_t; 2840Sstevel@tonic-gate # define HAVE_SIG_ATOMIC_T 2850Sstevel@tonic-gate #endif /* HAVE_SIG_ATOMIC_T */ 2860Sstevel@tonic-gate 2870Sstevel@tonic-gate #ifndef HAVE_MODE_T 2880Sstevel@tonic-gate typedef int mode_t; 2890Sstevel@tonic-gate # define HAVE_MODE_T 2900Sstevel@tonic-gate #endif /* HAVE_MODE_T */ 2910Sstevel@tonic-gate 2920Sstevel@tonic-gate #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) 2930Sstevel@tonic-gate # define ss_family __ss_family 2940Sstevel@tonic-gate #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */ 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate #ifndef HAVE_SYS_UN_H 2970Sstevel@tonic-gate struct sockaddr_un { 2980Sstevel@tonic-gate short sun_family; /* AF_UNIX */ 2990Sstevel@tonic-gate char sun_path[108]; /* path name (gag) */ 3000Sstevel@tonic-gate }; 3010Sstevel@tonic-gate #endif /* HAVE_SYS_UN_H */ 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE) 3040Sstevel@tonic-gate #define _STRUCT_WINSIZE 3050Sstevel@tonic-gate struct winsize { 3060Sstevel@tonic-gate unsigned short ws_row; /* rows, in characters */ 3070Sstevel@tonic-gate unsigned short ws_col; /* columns, in character */ 3080Sstevel@tonic-gate unsigned short ws_xpixel; /* horizontal size, pixels */ 3090Sstevel@tonic-gate unsigned short ws_ypixel; /* vertical size, pixels */ 3100Sstevel@tonic-gate }; 3110Sstevel@tonic-gate #endif 3120Sstevel@tonic-gate 3130Sstevel@tonic-gate /* *-*-nto-qnx does not define this type in the system headers */ 3140Sstevel@tonic-gate #ifdef MISSING_FD_MASK 3150Sstevel@tonic-gate typedef unsigned long int fd_mask; 3160Sstevel@tonic-gate #endif 3170Sstevel@tonic-gate 3180Sstevel@tonic-gate /* Paths */ 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate #ifndef _PATH_BSHELL 3210Sstevel@tonic-gate # define _PATH_BSHELL "/bin/sh" 3220Sstevel@tonic-gate #endif 3230Sstevel@tonic-gate #ifndef _PATH_CSHELL 3240Sstevel@tonic-gate # define _PATH_CSHELL "/bin/csh" 3250Sstevel@tonic-gate #endif 3260Sstevel@tonic-gate #ifndef _PATH_SHELLS 3270Sstevel@tonic-gate # define _PATH_SHELLS "/etc/shells" 3280Sstevel@tonic-gate #endif 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate #ifdef USER_PATH 3310Sstevel@tonic-gate # ifdef _PATH_STDPATH 3320Sstevel@tonic-gate # undef _PATH_STDPATH 3330Sstevel@tonic-gate # endif 3340Sstevel@tonic-gate # define _PATH_STDPATH USER_PATH 3350Sstevel@tonic-gate #endif 3360Sstevel@tonic-gate 3370Sstevel@tonic-gate #ifndef _PATH_STDPATH 3380Sstevel@tonic-gate # define _PATH_STDPATH "/usr/bin" 3390Sstevel@tonic-gate #endif 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate #ifndef _PATH_DEVNULL 3420Sstevel@tonic-gate # define _PATH_DEVNULL "/dev/null" 3430Sstevel@tonic-gate #endif 3440Sstevel@tonic-gate 3450Sstevel@tonic-gate #ifndef MAIL_DIRECTORY 3460Sstevel@tonic-gate # define MAIL_DIRECTORY "/var/spool/mail" 3470Sstevel@tonic-gate #endif 3480Sstevel@tonic-gate 3490Sstevel@tonic-gate #ifndef MAILDIR 3500Sstevel@tonic-gate # define MAILDIR MAIL_DIRECTORY 3510Sstevel@tonic-gate #endif 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate #if !defined(_PATH_MAILDIR) && defined(MAILDIR) 3540Sstevel@tonic-gate # define _PATH_MAILDIR MAILDIR 3550Sstevel@tonic-gate #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ 3560Sstevel@tonic-gate 3570Sstevel@tonic-gate #ifndef _PATH_RSH 3580Sstevel@tonic-gate # ifdef RSH_PATH 3590Sstevel@tonic-gate # define _PATH_RSH RSH_PATH 3600Sstevel@tonic-gate # else /* RSH_PATH */ 3610Sstevel@tonic-gate # define _PATH_RSH "/usr/bin/rsh" 3620Sstevel@tonic-gate # endif /* RSH_PATH */ 3630Sstevel@tonic-gate #endif /* _PATH_RSH */ 3640Sstevel@tonic-gate 3650Sstevel@tonic-gate #ifndef _PATH_NOLOGIN 3660Sstevel@tonic-gate # define _PATH_NOLOGIN "/etc/nologin" 3670Sstevel@tonic-gate #endif 3680Sstevel@tonic-gate 3690Sstevel@tonic-gate /* Define this to be the path of the xauth program. */ 3700Sstevel@tonic-gate #ifdef XAUTH_PATH 3710Sstevel@tonic-gate #define _PATH_XAUTH XAUTH_PATH 3720Sstevel@tonic-gate #endif /* XAUTH_PATH */ 3730Sstevel@tonic-gate 3740Sstevel@tonic-gate /* derived from XF4/xc/lib/dps/Xlibnet.h */ 3750Sstevel@tonic-gate #ifndef X_UNIX_PATH 3760Sstevel@tonic-gate # ifdef __hpux 3770Sstevel@tonic-gate # define X_UNIX_PATH "/var/spool/sockets/X11/%u" 3780Sstevel@tonic-gate # else 3790Sstevel@tonic-gate # define X_UNIX_PATH "/tmp/.X11-unix/X%u" 3800Sstevel@tonic-gate # endif 3810Sstevel@tonic-gate #endif /* X_UNIX_PATH */ 3820Sstevel@tonic-gate #define _PATH_UNIX_X X_UNIX_PATH 3830Sstevel@tonic-gate 3840Sstevel@tonic-gate #ifndef _PATH_TTY 3850Sstevel@tonic-gate # define _PATH_TTY "/dev/tty" 3860Sstevel@tonic-gate #endif 3870Sstevel@tonic-gate 3880Sstevel@tonic-gate /* Macros */ 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate #if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H) 3910Sstevel@tonic-gate # define HAVE_LOGIN_CAP 3920Sstevel@tonic-gate #endif 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate #ifndef MAX 3950Sstevel@tonic-gate # define MAX(a,b) (((a)>(b))?(a):(b)) 3960Sstevel@tonic-gate # define MIN(a,b) (((a)<(b))?(a):(b)) 3970Sstevel@tonic-gate #endif 3980Sstevel@tonic-gate 3990Sstevel@tonic-gate #ifndef roundup 4000Sstevel@tonic-gate # define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 4010Sstevel@tonic-gate #endif 4020Sstevel@tonic-gate 4030Sstevel@tonic-gate #ifndef timersub 4040Sstevel@tonic-gate #define timersub(a, b, result) \ 4050Sstevel@tonic-gate do { \ 4060Sstevel@tonic-gate (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 4070Sstevel@tonic-gate (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 4080Sstevel@tonic-gate if ((result)->tv_usec < 0) { \ 4090Sstevel@tonic-gate --(result)->tv_sec; \ 4100Sstevel@tonic-gate (result)->tv_usec += 1000000; \ 4110Sstevel@tonic-gate } \ 4120Sstevel@tonic-gate } while (0) 4130Sstevel@tonic-gate #endif 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate #ifndef __P 4160Sstevel@tonic-gate # define __P(x) x 4170Sstevel@tonic-gate #endif 4180Sstevel@tonic-gate 4190Sstevel@tonic-gate #if !defined(IN6_IS_ADDR_V4MAPPED) 4200Sstevel@tonic-gate # define IN6_IS_ADDR_V4MAPPED(a) \ 4210Sstevel@tonic-gate ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ 4220Sstevel@tonic-gate (((u_int32_t *) (a))[2] == htonl (0xffff))) 4230Sstevel@tonic-gate #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */ 4240Sstevel@tonic-gate 4250Sstevel@tonic-gate #if !defined(__GNUC__) || (__GNUC__ < 2) 4260Sstevel@tonic-gate # define __attribute__(x) 4270Sstevel@tonic-gate #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ 4280Sstevel@tonic-gate 429*5087Sjp161948 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__) 430*5087Sjp161948 # define __bounded__(x, y, z) 431*5087Sjp161948 #endif 432*5087Sjp161948 4330Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this macro in the system headers */ 4340Sstevel@tonic-gate #ifdef MISSING_HOWMANY 4350Sstevel@tonic-gate # define howmany(x,y) (((x)+((y)-1))/(y)) 4360Sstevel@tonic-gate #endif 4370Sstevel@tonic-gate 4380Sstevel@tonic-gate #ifndef OSSH_ALIGNBYTES 4390Sstevel@tonic-gate #define OSSH_ALIGNBYTES (sizeof(int) - 1) 4400Sstevel@tonic-gate #endif 4410Sstevel@tonic-gate #ifndef __CMSG_ALIGN 4420Sstevel@tonic-gate #define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES) 4430Sstevel@tonic-gate #endif 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate /* Length of the contents of a control message of length len */ 4460Sstevel@tonic-gate #ifndef CMSG_LEN 4470Sstevel@tonic-gate #define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 4480Sstevel@tonic-gate #endif 4490Sstevel@tonic-gate 4500Sstevel@tonic-gate /* Length of the space taken up by a padded control message of length len */ 4510Sstevel@tonic-gate #ifndef CMSG_SPACE 4520Sstevel@tonic-gate #define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) 4530Sstevel@tonic-gate #endif 4540Sstevel@tonic-gate 4550Sstevel@tonic-gate /* Function replacement / compatibility hacks */ 4560Sstevel@tonic-gate 4570Sstevel@tonic-gate #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) 4580Sstevel@tonic-gate # define HAVE_GETADDRINFO 4590Sstevel@tonic-gate #endif 4600Sstevel@tonic-gate 4610Sstevel@tonic-gate #ifndef HAVE_GETOPT_OPTRESET 4620Sstevel@tonic-gate # undef getopt 4630Sstevel@tonic-gate # undef opterr 4640Sstevel@tonic-gate # undef optind 4650Sstevel@tonic-gate # undef optopt 4660Sstevel@tonic-gate # undef optreset 4670Sstevel@tonic-gate # undef optarg 4680Sstevel@tonic-gate # define getopt(ac, av, o) BSDgetopt(ac, av, o) 4690Sstevel@tonic-gate # define opterr BSDopterr 4700Sstevel@tonic-gate # define optind BSDoptind 4710Sstevel@tonic-gate # define optopt BSDoptopt 4720Sstevel@tonic-gate # define optreset BSDoptreset 4730Sstevel@tonic-gate # define optarg BSDoptarg 4740Sstevel@tonic-gate #endif 4750Sstevel@tonic-gate 4760Sstevel@tonic-gate /* In older versions of libpam, pam_strerror takes a single argument */ 4770Sstevel@tonic-gate #ifdef HAVE_OLD_PAM 4780Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((b)) 4790Sstevel@tonic-gate #else 4800Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((a),(b)) 4810Sstevel@tonic-gate #endif 4820Sstevel@tonic-gate 4830Sstevel@tonic-gate #ifdef PAM_SUN_CODEBASE 4840Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member) 4850Sstevel@tonic-gate #else 4860Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member) 4870Sstevel@tonic-gate #endif 4880Sstevel@tonic-gate 4890Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) 4900Sstevel@tonic-gate # undef HAVE_GETADDRINFO 4910Sstevel@tonic-gate #endif 4920Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO) 4930Sstevel@tonic-gate # undef HAVE_FREEADDRINFO 4940Sstevel@tonic-gate #endif 4950Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR) 4960Sstevel@tonic-gate # undef HAVE_GAI_STRERROR 4970Sstevel@tonic-gate #endif 4980Sstevel@tonic-gate 4990Sstevel@tonic-gate #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) 5000Sstevel@tonic-gate # define memmove(s1, s2, n) bcopy((s2), (s1), (n)) 5010Sstevel@tonic-gate #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */ 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) 5040Sstevel@tonic-gate # define USE_VHANGUP 5050Sstevel@tonic-gate #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */ 5060Sstevel@tonic-gate 5070Sstevel@tonic-gate #ifndef GETPGRP_VOID 5080Sstevel@tonic-gate # define getpgrp() getpgrp(0) 5090Sstevel@tonic-gate #endif 5100Sstevel@tonic-gate 5110Sstevel@tonic-gate /* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */ 5120Sstevel@tonic-gate #if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f) 5130Sstevel@tonic-gate # define OPENSSL_free(x) Free(x) 5140Sstevel@tonic-gate #endif 5150Sstevel@tonic-gate 5160Sstevel@tonic-gate #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__) 5170Sstevel@tonic-gate # define __func__ __FUNCTION__ 5180Sstevel@tonic-gate #elif !defined(HAVE___func__) 5190Sstevel@tonic-gate # define __func__ "" 5200Sstevel@tonic-gate #endif 5210Sstevel@tonic-gate 5220Sstevel@tonic-gate /* 5230Sstevel@tonic-gate * Define this to use pipes instead of socketpairs for communicating with the 5240Sstevel@tonic-gate * client program. Socketpairs do not seem to work on all systems. 5250Sstevel@tonic-gate * 5260Sstevel@tonic-gate * configure.ac sets this for a few OS's which are known to have problems 5270Sstevel@tonic-gate * but you may need to set it yourself 5280Sstevel@tonic-gate */ 5290Sstevel@tonic-gate /* #define USE_PIPES 1 */ 5300Sstevel@tonic-gate 5310Sstevel@tonic-gate /** 5320Sstevel@tonic-gate ** login recorder definitions 5330Sstevel@tonic-gate **/ 5340Sstevel@tonic-gate 5350Sstevel@tonic-gate /* FIXME: put default paths back in */ 5360Sstevel@tonic-gate #ifndef UTMP_FILE 5370Sstevel@tonic-gate # ifdef _PATH_UTMP 5380Sstevel@tonic-gate # define UTMP_FILE _PATH_UTMP 5390Sstevel@tonic-gate # else 5400Sstevel@tonic-gate # ifdef CONF_UTMP_FILE 5410Sstevel@tonic-gate # define UTMP_FILE CONF_UTMP_FILE 5420Sstevel@tonic-gate # endif 5430Sstevel@tonic-gate # endif 5440Sstevel@tonic-gate #endif 5450Sstevel@tonic-gate #ifndef WTMP_FILE 5460Sstevel@tonic-gate # ifdef _PATH_WTMP 5470Sstevel@tonic-gate # define WTMP_FILE _PATH_WTMP 5480Sstevel@tonic-gate # else 5490Sstevel@tonic-gate # ifdef CONF_WTMP_FILE 5500Sstevel@tonic-gate # define WTMP_FILE CONF_WTMP_FILE 5510Sstevel@tonic-gate # endif 5520Sstevel@tonic-gate # endif 5530Sstevel@tonic-gate #endif 5540Sstevel@tonic-gate /* pick up the user's location for lastlog if given */ 5550Sstevel@tonic-gate #ifndef LASTLOG_FILE 5560Sstevel@tonic-gate # ifdef _PATH_LASTLOG 5570Sstevel@tonic-gate # define LASTLOG_FILE _PATH_LASTLOG 5580Sstevel@tonic-gate # else 5590Sstevel@tonic-gate # ifdef CONF_LASTLOG_FILE 5600Sstevel@tonic-gate # define LASTLOG_FILE CONF_LASTLOG_FILE 5610Sstevel@tonic-gate # endif 5620Sstevel@tonic-gate # endif 5630Sstevel@tonic-gate #endif 5640Sstevel@tonic-gate 5650Sstevel@tonic-gate 5660Sstevel@tonic-gate /* The login() library function in libutil is first choice */ 5670Sstevel@tonic-gate #if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN) 5680Sstevel@tonic-gate # define USE_LOGIN 5690Sstevel@tonic-gate 5700Sstevel@tonic-gate #else 5710Sstevel@tonic-gate /* Simply select your favourite login types. */ 5720Sstevel@tonic-gate /* Can't do if-else because some systems use several... <sigh> */ 5730Sstevel@tonic-gate # if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX) 5740Sstevel@tonic-gate # define USE_UTMPX 5750Sstevel@tonic-gate # endif 5760Sstevel@tonic-gate # if defined(UTMP_FILE) && !defined(DISABLE_UTMP) 5770Sstevel@tonic-gate # define USE_UTMP 5780Sstevel@tonic-gate # endif 5790Sstevel@tonic-gate # if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX) 5800Sstevel@tonic-gate # define USE_WTMPX 5810Sstevel@tonic-gate # endif 5820Sstevel@tonic-gate # if defined(WTMP_FILE) && !defined(DISABLE_WTMP) 5830Sstevel@tonic-gate # define USE_WTMP 5840Sstevel@tonic-gate # endif 5850Sstevel@tonic-gate 5860Sstevel@tonic-gate #endif 5870Sstevel@tonic-gate 5880Sstevel@tonic-gate /* I hope that the presence of LASTLOG_FILE is enough to detect this */ 5890Sstevel@tonic-gate #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG) 5900Sstevel@tonic-gate # define USE_LASTLOG 5910Sstevel@tonic-gate #endif 5920Sstevel@tonic-gate 5930Sstevel@tonic-gate /** end of login recorder definitions */ 5940Sstevel@tonic-gate 5950Sstevel@tonic-gate #ifdef __cplusplus 5960Sstevel@tonic-gate } 5970Sstevel@tonic-gate #endif 5980Sstevel@tonic-gate 5990Sstevel@tonic-gate #endif /* _DEFINES_H */ 600