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