xref: /titanic_50/usr/src/cmd/ssh/include/defines.h (revision 743541abe0006f1be576e21a976c36fb2e87accc)
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 
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 
81*743541abSjp161948 /* Disable groupaccess if NGROUPS_UMAX, NGROUPS_MAX and NGROUPS are not set */
82*743541abSjp161948 #ifndef NGROUPS_UMAX
83*743541abSjp161948 #ifdef NGROUPS_MAX
84*743541abSjp161948 #define NGROUPS_UMAX NGROUPS_MAX
85*743541abSjp161948 #elif defined(NGROUPS)
86*743541abSjp161948 #define NGROUPS_UMAX NGROUPS
877c478bd9Sstevel@tonic-gate #else
88*743541abSjp161948 #define NGROUPS_UMAX 0
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate #endif
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #ifndef O_NONBLOCK	/* Non Blocking Open */
937c478bd9Sstevel@tonic-gate # define O_NONBLOCK      00004
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #ifndef S_ISDIR
977c478bd9Sstevel@tonic-gate # define S_ISDIR(mode)	(((mode) & (_S_IFMT)) == (_S_IFDIR))
987c478bd9Sstevel@tonic-gate #endif /* S_ISDIR */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #ifndef S_ISREG
1017c478bd9Sstevel@tonic-gate # define S_ISREG(mode)	(((mode) & (_S_IFMT)) == (_S_IFREG))
1027c478bd9Sstevel@tonic-gate #endif /* S_ISREG */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #ifndef S_ISLNK
1057c478bd9Sstevel@tonic-gate # define S_ISLNK(mode)	(((mode) & S_IFMT) == S_IFLNK)
1067c478bd9Sstevel@tonic-gate #endif /* S_ISLNK */
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #ifndef S_IXUSR
1097c478bd9Sstevel@tonic-gate # define S_IXUSR			0000100	/* execute/search permission, */
1107c478bd9Sstevel@tonic-gate # define S_IXGRP			0000010	/* execute/search permission, */
1117c478bd9Sstevel@tonic-gate # define S_IXOTH			0000001	/* execute/search permission, */
1127c478bd9Sstevel@tonic-gate # define _S_IWUSR			0000200	/* write permission, */
1137c478bd9Sstevel@tonic-gate # define S_IWUSR			_S_IWUSR	/* write permission, owner */
1147c478bd9Sstevel@tonic-gate # define S_IWGRP			0000020	/* write permission, group */
1157c478bd9Sstevel@tonic-gate # define S_IWOTH			0000002	/* write permission, other */
1167c478bd9Sstevel@tonic-gate # define S_IRUSR			0000400	/* read permission, owner */
1177c478bd9Sstevel@tonic-gate # define S_IRGRP			0000040	/* read permission, group */
1187c478bd9Sstevel@tonic-gate # define S_IROTH			0000004	/* read permission, other */
1197c478bd9Sstevel@tonic-gate # define S_IRWXU			0000700	/* read, write, execute */
1207c478bd9Sstevel@tonic-gate # define S_IRWXG			0000070	/* read, write, execute */
1217c478bd9Sstevel@tonic-gate # define S_IRWXO			0000007	/* read, write, execute */
1227c478bd9Sstevel@tonic-gate #endif /* S_IXUSR */
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
1257c478bd9Sstevel@tonic-gate #define MAP_ANON MAP_ANONYMOUS
1267c478bd9Sstevel@tonic-gate #endif
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate #ifndef MAP_FAILED
1297c478bd9Sstevel@tonic-gate # define MAP_FAILED ((void *)-1)
1307c478bd9Sstevel@tonic-gate #endif
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this constant in the system headers */
1337c478bd9Sstevel@tonic-gate #ifdef MISSING_NFDBITS
1347c478bd9Sstevel@tonic-gate # define	NFDBITS (8 * sizeof(unsigned long))
1357c478bd9Sstevel@tonic-gate #endif
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate /*
1387c478bd9Sstevel@tonic-gate SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but
1397c478bd9Sstevel@tonic-gate including rpc/rpc.h breaks Solaris 6
1407c478bd9Sstevel@tonic-gate */
1417c478bd9Sstevel@tonic-gate #ifndef INADDR_LOOPBACK
1427c478bd9Sstevel@tonic-gate #define INADDR_LOOPBACK ((u_long)0x7f000001)
1437c478bd9Sstevel@tonic-gate #endif
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /* Types */
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /* If sys/types.h does not supply intXX_t, supply them ourselves */
1487c478bd9Sstevel@tonic-gate /* (or die trying) */
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT
1527c478bd9Sstevel@tonic-gate typedef unsigned int u_int;
1537c478bd9Sstevel@tonic-gate #endif
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate #ifndef HAVE_INTXX_T
1567c478bd9Sstevel@tonic-gate # if (SIZEOF_CHAR == 1)
1577c478bd9Sstevel@tonic-gate typedef char int8_t;
1587c478bd9Sstevel@tonic-gate # else
1597c478bd9Sstevel@tonic-gate #  error "8 bit int type not found."
1607c478bd9Sstevel@tonic-gate # endif
1617c478bd9Sstevel@tonic-gate # if (SIZEOF_SHORT_INT == 2)
1627c478bd9Sstevel@tonic-gate typedef short int int16_t;
1637c478bd9Sstevel@tonic-gate # else
1647c478bd9Sstevel@tonic-gate #  ifdef _UNICOS
1657c478bd9Sstevel@tonic-gate #   if (SIZEOF_SHORT_INT == 4)
1667c478bd9Sstevel@tonic-gate typedef short int16_t;
1677c478bd9Sstevel@tonic-gate #   else
1687c478bd9Sstevel@tonic-gate typedef long  int16_t;
1697c478bd9Sstevel@tonic-gate #   endif
1707c478bd9Sstevel@tonic-gate #  else
1717c478bd9Sstevel@tonic-gate #   error "16 bit int type not found."
1727c478bd9Sstevel@tonic-gate #  endif /* _UNICOS */
1737c478bd9Sstevel@tonic-gate # endif
1747c478bd9Sstevel@tonic-gate # if (SIZEOF_INT == 4)
1757c478bd9Sstevel@tonic-gate typedef int int32_t;
1767c478bd9Sstevel@tonic-gate # else
1777c478bd9Sstevel@tonic-gate #  ifdef _UNICOS
1787c478bd9Sstevel@tonic-gate typedef long  int32_t;
1797c478bd9Sstevel@tonic-gate #  else
1807c478bd9Sstevel@tonic-gate #   error "32 bit int type not found."
1817c478bd9Sstevel@tonic-gate #  endif /* _UNICOS */
1827c478bd9Sstevel@tonic-gate # endif
1837c478bd9Sstevel@tonic-gate #endif
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
1867c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INTXX_T
1877c478bd9Sstevel@tonic-gate # ifdef HAVE_UINTXX_T
1887c478bd9Sstevel@tonic-gate typedef uint8_t u_int8_t;
1897c478bd9Sstevel@tonic-gate typedef uint16_t u_int16_t;
1907c478bd9Sstevel@tonic-gate typedef uint32_t u_int32_t;
1917c478bd9Sstevel@tonic-gate # define HAVE_U_INTXX_T 1
1927c478bd9Sstevel@tonic-gate # else
1937c478bd9Sstevel@tonic-gate #  if (SIZEOF_CHAR == 1)
1947c478bd9Sstevel@tonic-gate typedef unsigned char u_int8_t;
1957c478bd9Sstevel@tonic-gate #  else
1967c478bd9Sstevel@tonic-gate #   error "8 bit int type not found."
1977c478bd9Sstevel@tonic-gate #  endif
1987c478bd9Sstevel@tonic-gate #  if (SIZEOF_SHORT_INT == 2)
1997c478bd9Sstevel@tonic-gate typedef unsigned short int u_int16_t;
2007c478bd9Sstevel@tonic-gate #  else
2017c478bd9Sstevel@tonic-gate #   ifdef _UNICOS
2027c478bd9Sstevel@tonic-gate #    if (SIZEOF_SHORT_INT == 4)
2037c478bd9Sstevel@tonic-gate typedef unsigned short u_int16_t;
2047c478bd9Sstevel@tonic-gate #    else
2057c478bd9Sstevel@tonic-gate typedef unsigned long  u_int16_t;
2067c478bd9Sstevel@tonic-gate #    endif
2077c478bd9Sstevel@tonic-gate #   else
2087c478bd9Sstevel@tonic-gate #    error "16 bit int type not found."
2097c478bd9Sstevel@tonic-gate #   endif
2107c478bd9Sstevel@tonic-gate #  endif
2117c478bd9Sstevel@tonic-gate #  if (SIZEOF_INT == 4)
2127c478bd9Sstevel@tonic-gate typedef unsigned int u_int32_t;
2137c478bd9Sstevel@tonic-gate #  else
2147c478bd9Sstevel@tonic-gate #   ifdef _UNICOS
2157c478bd9Sstevel@tonic-gate typedef unsigned long  u_int32_t;
2167c478bd9Sstevel@tonic-gate #   else
2177c478bd9Sstevel@tonic-gate #    error "32 bit int type not found."
2187c478bd9Sstevel@tonic-gate #   endif
2197c478bd9Sstevel@tonic-gate #  endif
2207c478bd9Sstevel@tonic-gate # endif
2217c478bd9Sstevel@tonic-gate #define __BIT_TYPES_DEFINED__
2227c478bd9Sstevel@tonic-gate #endif
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /* 64-bit types */
2257c478bd9Sstevel@tonic-gate #ifndef HAVE_INT64_T
2267c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8)
2277c478bd9Sstevel@tonic-gate typedef long int int64_t;
2287c478bd9Sstevel@tonic-gate #   define HAVE_INT64_T 1
2297c478bd9Sstevel@tonic-gate # else
2307c478bd9Sstevel@tonic-gate #  if (SIZEOF_LONG_LONG_INT == 8)
2317c478bd9Sstevel@tonic-gate typedef long long int int64_t;
2327c478bd9Sstevel@tonic-gate #   define HAVE_INT64_T 1
2337c478bd9Sstevel@tonic-gate #  endif
2347c478bd9Sstevel@tonic-gate # endif
2357c478bd9Sstevel@tonic-gate #endif
2367c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT64_T
2377c478bd9Sstevel@tonic-gate # if (SIZEOF_LONG_INT == 8)
2387c478bd9Sstevel@tonic-gate typedef unsigned long int u_int64_t;
2397c478bd9Sstevel@tonic-gate #   define HAVE_U_INT64_T 1
2407c478bd9Sstevel@tonic-gate # else
2417c478bd9Sstevel@tonic-gate #  if (SIZEOF_LONG_LONG_INT == 8)
2427c478bd9Sstevel@tonic-gate typedef unsigned long long int u_int64_t;
2437c478bd9Sstevel@tonic-gate #   define HAVE_U_INT64_T 1
2447c478bd9Sstevel@tonic-gate #  endif
2457c478bd9Sstevel@tonic-gate # endif
2467c478bd9Sstevel@tonic-gate #endif
2477c478bd9Sstevel@tonic-gate #if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8)
2487c478bd9Sstevel@tonic-gate # define HAVE_LONG_LONG_INT 1
2497c478bd9Sstevel@tonic-gate #endif
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate #ifndef HAVE_U_CHAR
2527c478bd9Sstevel@tonic-gate typedef unsigned char u_char;
2537c478bd9Sstevel@tonic-gate # define HAVE_U_CHAR
2547c478bd9Sstevel@tonic-gate #endif /* HAVE_U_CHAR */
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate #ifndef SIZE_T_MAX
2577c478bd9Sstevel@tonic-gate #define SIZE_T_MAX ULONG_MAX
2587c478bd9Sstevel@tonic-gate #endif /* SIZE_T_MAX */
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate #ifndef HAVE_SIZE_T
2617c478bd9Sstevel@tonic-gate typedef unsigned int size_t;
2627c478bd9Sstevel@tonic-gate # define HAVE_SIZE_T
2637c478bd9Sstevel@tonic-gate #endif /* HAVE_SIZE_T */
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate #ifndef HAVE_SSIZE_T
2667c478bd9Sstevel@tonic-gate typedef int ssize_t;
2677c478bd9Sstevel@tonic-gate # define HAVE_SSIZE_T
2687c478bd9Sstevel@tonic-gate #endif /* HAVE_SSIZE_T */
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate #ifndef HAVE_CLOCK_T
2717c478bd9Sstevel@tonic-gate typedef long clock_t;
2727c478bd9Sstevel@tonic-gate # define HAVE_CLOCK_T
2737c478bd9Sstevel@tonic-gate #endif /* HAVE_CLOCK_T */
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #ifndef HAVE_SA_FAMILY_T
2767c478bd9Sstevel@tonic-gate typedef int sa_family_t;
2777c478bd9Sstevel@tonic-gate # define HAVE_SA_FAMILY_T
2787c478bd9Sstevel@tonic-gate #endif /* HAVE_SA_FAMILY_T */
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate #ifndef HAVE_PID_T
2817c478bd9Sstevel@tonic-gate typedef int pid_t;
2827c478bd9Sstevel@tonic-gate # define HAVE_PID_T
2837c478bd9Sstevel@tonic-gate #endif /* HAVE_PID_T */
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate #ifndef HAVE_SIG_ATOMIC_T
2867c478bd9Sstevel@tonic-gate typedef int sig_atomic_t;
2877c478bd9Sstevel@tonic-gate # define HAVE_SIG_ATOMIC_T
2887c478bd9Sstevel@tonic-gate #endif /* HAVE_SIG_ATOMIC_T */
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate #ifndef HAVE_MODE_T
2917c478bd9Sstevel@tonic-gate typedef int mode_t;
2927c478bd9Sstevel@tonic-gate # define HAVE_MODE_T
2937c478bd9Sstevel@tonic-gate #endif /* HAVE_MODE_T */
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
2967c478bd9Sstevel@tonic-gate # define ss_family __ss_family
2977c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate #ifndef HAVE_SYS_UN_H
3007c478bd9Sstevel@tonic-gate struct	sockaddr_un {
3017c478bd9Sstevel@tonic-gate 	short	sun_family;		/* AF_UNIX */
3027c478bd9Sstevel@tonic-gate 	char	sun_path[108];		/* path name (gag) */
3037c478bd9Sstevel@tonic-gate };
3047c478bd9Sstevel@tonic-gate #endif /* HAVE_SYS_UN_H */
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
3077c478bd9Sstevel@tonic-gate #define _STRUCT_WINSIZE
3087c478bd9Sstevel@tonic-gate struct winsize {
3097c478bd9Sstevel@tonic-gate       unsigned short ws_row;          /* rows, in characters */
3107c478bd9Sstevel@tonic-gate       unsigned short ws_col;          /* columns, in character */
3117c478bd9Sstevel@tonic-gate       unsigned short ws_xpixel;       /* horizontal size, pixels */
3127c478bd9Sstevel@tonic-gate       unsigned short ws_ypixel;       /* vertical size, pixels */
3137c478bd9Sstevel@tonic-gate };
3147c478bd9Sstevel@tonic-gate #endif
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate /* *-*-nto-qnx does not define this type in the system headers */
3177c478bd9Sstevel@tonic-gate #ifdef MISSING_FD_MASK
3187c478bd9Sstevel@tonic-gate  typedef unsigned long int	fd_mask;
3197c478bd9Sstevel@tonic-gate #endif
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate /* Paths */
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate #ifndef _PATH_BSHELL
3247c478bd9Sstevel@tonic-gate # define _PATH_BSHELL "/bin/sh"
3257c478bd9Sstevel@tonic-gate #endif
3267c478bd9Sstevel@tonic-gate #ifndef _PATH_CSHELL
3277c478bd9Sstevel@tonic-gate # define _PATH_CSHELL "/bin/csh"
3287c478bd9Sstevel@tonic-gate #endif
3297c478bd9Sstevel@tonic-gate #ifndef _PATH_SHELLS
3307c478bd9Sstevel@tonic-gate # define _PATH_SHELLS "/etc/shells"
3317c478bd9Sstevel@tonic-gate #endif
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate #ifdef USER_PATH
3347c478bd9Sstevel@tonic-gate # ifdef _PATH_STDPATH
3357c478bd9Sstevel@tonic-gate #  undef _PATH_STDPATH
3367c478bd9Sstevel@tonic-gate # endif
3377c478bd9Sstevel@tonic-gate # define _PATH_STDPATH USER_PATH
3387c478bd9Sstevel@tonic-gate #endif
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #ifndef _PATH_STDPATH
3417c478bd9Sstevel@tonic-gate # define _PATH_STDPATH "/usr/bin"
3427c478bd9Sstevel@tonic-gate #endif
3437c478bd9Sstevel@tonic-gate 
3447c478bd9Sstevel@tonic-gate #ifndef _PATH_DEVNULL
3457c478bd9Sstevel@tonic-gate # define _PATH_DEVNULL "/dev/null"
3467c478bd9Sstevel@tonic-gate #endif
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate #ifndef MAIL_DIRECTORY
3497c478bd9Sstevel@tonic-gate # define MAIL_DIRECTORY "/var/spool/mail"
3507c478bd9Sstevel@tonic-gate #endif
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate #ifndef MAILDIR
3537c478bd9Sstevel@tonic-gate # define MAILDIR MAIL_DIRECTORY
3547c478bd9Sstevel@tonic-gate #endif
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
3577c478bd9Sstevel@tonic-gate # define _PATH_MAILDIR MAILDIR
3587c478bd9Sstevel@tonic-gate #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
3597c478bd9Sstevel@tonic-gate 
3607c478bd9Sstevel@tonic-gate #ifndef _PATH_RSH
3617c478bd9Sstevel@tonic-gate # ifdef RSH_PATH
3627c478bd9Sstevel@tonic-gate #  define _PATH_RSH RSH_PATH
3637c478bd9Sstevel@tonic-gate # else /* RSH_PATH */
3647c478bd9Sstevel@tonic-gate #  define _PATH_RSH "/usr/bin/rsh"
3657c478bd9Sstevel@tonic-gate # endif /* RSH_PATH */
3667c478bd9Sstevel@tonic-gate #endif /* _PATH_RSH */
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #ifndef _PATH_NOLOGIN
3697c478bd9Sstevel@tonic-gate # define _PATH_NOLOGIN "/etc/nologin"
3707c478bd9Sstevel@tonic-gate #endif
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate /* Define this to be the path of the xauth program. */
3737c478bd9Sstevel@tonic-gate #ifdef XAUTH_PATH
3747c478bd9Sstevel@tonic-gate #define _PATH_XAUTH XAUTH_PATH
3757c478bd9Sstevel@tonic-gate #endif /* XAUTH_PATH */
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate /* derived from XF4/xc/lib/dps/Xlibnet.h */
3787c478bd9Sstevel@tonic-gate #ifndef X_UNIX_PATH
3797c478bd9Sstevel@tonic-gate #  ifdef __hpux
3807c478bd9Sstevel@tonic-gate #    define X_UNIX_PATH "/var/spool/sockets/X11/%u"
3817c478bd9Sstevel@tonic-gate #  else
3827c478bd9Sstevel@tonic-gate #    define X_UNIX_PATH "/tmp/.X11-unix/X%u"
3837c478bd9Sstevel@tonic-gate #  endif
3847c478bd9Sstevel@tonic-gate #endif /* X_UNIX_PATH */
3857c478bd9Sstevel@tonic-gate #define _PATH_UNIX_X X_UNIX_PATH
3867c478bd9Sstevel@tonic-gate 
3877c478bd9Sstevel@tonic-gate #ifndef _PATH_TTY
3887c478bd9Sstevel@tonic-gate # define _PATH_TTY "/dev/tty"
3897c478bd9Sstevel@tonic-gate #endif
3907c478bd9Sstevel@tonic-gate 
3917c478bd9Sstevel@tonic-gate /* Macros */
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate #if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H)
3947c478bd9Sstevel@tonic-gate # define HAVE_LOGIN_CAP
3957c478bd9Sstevel@tonic-gate #endif
3967c478bd9Sstevel@tonic-gate 
3977c478bd9Sstevel@tonic-gate #ifndef MAX
3987c478bd9Sstevel@tonic-gate # define MAX(a,b) (((a)>(b))?(a):(b))
3997c478bd9Sstevel@tonic-gate # define MIN(a,b) (((a)<(b))?(a):(b))
4007c478bd9Sstevel@tonic-gate #endif
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate #ifndef roundup
4037c478bd9Sstevel@tonic-gate # define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
4047c478bd9Sstevel@tonic-gate #endif
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate #ifndef timersub
4077c478bd9Sstevel@tonic-gate #define timersub(a, b, result)					\
4087c478bd9Sstevel@tonic-gate    do {								\
4097c478bd9Sstevel@tonic-gate       (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;		\
4107c478bd9Sstevel@tonic-gate       (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;		\
4117c478bd9Sstevel@tonic-gate       if ((result)->tv_usec < 0) {				\
4127c478bd9Sstevel@tonic-gate 	 --(result)->tv_sec;					\
4137c478bd9Sstevel@tonic-gate 	 (result)->tv_usec += 1000000;				\
4147c478bd9Sstevel@tonic-gate       }								\
4157c478bd9Sstevel@tonic-gate    } while (0)
4167c478bd9Sstevel@tonic-gate #endif
4177c478bd9Sstevel@tonic-gate 
4187c478bd9Sstevel@tonic-gate #ifndef __P
4197c478bd9Sstevel@tonic-gate # define __P(x) x
4207c478bd9Sstevel@tonic-gate #endif
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate #if !defined(IN6_IS_ADDR_V4MAPPED)
4237c478bd9Sstevel@tonic-gate # define IN6_IS_ADDR_V4MAPPED(a) \
4247c478bd9Sstevel@tonic-gate 	((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
4257c478bd9Sstevel@tonic-gate 	 (((u_int32_t *) (a))[2] == htonl (0xffff)))
4267c478bd9Sstevel@tonic-gate #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate #if !defined(__GNUC__) || (__GNUC__ < 2)
4297c478bd9Sstevel@tonic-gate # define __attribute__(x)
4307c478bd9Sstevel@tonic-gate #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
4317c478bd9Sstevel@tonic-gate 
43290685d2cSjp161948 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
43390685d2cSjp161948 # define __bounded__(x, y, z)
43490685d2cSjp161948 #endif
43590685d2cSjp161948 
4367c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this macro in the system headers */
4377c478bd9Sstevel@tonic-gate #ifdef MISSING_HOWMANY
4387c478bd9Sstevel@tonic-gate # define howmany(x,y)	(((x)+((y)-1))/(y))
4397c478bd9Sstevel@tonic-gate #endif
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate #ifndef OSSH_ALIGNBYTES
4427c478bd9Sstevel@tonic-gate #define OSSH_ALIGNBYTES	(sizeof(int) - 1)
4437c478bd9Sstevel@tonic-gate #endif
4447c478bd9Sstevel@tonic-gate #ifndef __CMSG_ALIGN
4457c478bd9Sstevel@tonic-gate #define	__CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES)
4467c478bd9Sstevel@tonic-gate #endif
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate /* Length of the contents of a control message of length len */
4497c478bd9Sstevel@tonic-gate #ifndef CMSG_LEN
4507c478bd9Sstevel@tonic-gate #define	CMSG_LEN(len)	(__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
4517c478bd9Sstevel@tonic-gate #endif
4527c478bd9Sstevel@tonic-gate 
4537c478bd9Sstevel@tonic-gate /* Length of the space taken up by a padded control message of length len */
4547c478bd9Sstevel@tonic-gate #ifndef CMSG_SPACE
4557c478bd9Sstevel@tonic-gate #define	CMSG_SPACE(len)	(__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
4567c478bd9Sstevel@tonic-gate #endif
4577c478bd9Sstevel@tonic-gate 
4587c478bd9Sstevel@tonic-gate /* Function replacement / compatibility hacks */
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO))
4617c478bd9Sstevel@tonic-gate # define HAVE_GETADDRINFO
4627c478bd9Sstevel@tonic-gate #endif
4637c478bd9Sstevel@tonic-gate 
4647c478bd9Sstevel@tonic-gate #ifndef HAVE_GETOPT_OPTRESET
4657c478bd9Sstevel@tonic-gate # undef getopt
4667c478bd9Sstevel@tonic-gate # undef opterr
4677c478bd9Sstevel@tonic-gate # undef optind
4687c478bd9Sstevel@tonic-gate # undef optopt
4697c478bd9Sstevel@tonic-gate # undef optreset
4707c478bd9Sstevel@tonic-gate # undef optarg
4717c478bd9Sstevel@tonic-gate # define getopt(ac, av, o)  BSDgetopt(ac, av, o)
4727c478bd9Sstevel@tonic-gate # define opterr             BSDopterr
4737c478bd9Sstevel@tonic-gate # define optind             BSDoptind
4747c478bd9Sstevel@tonic-gate # define optopt             BSDoptopt
4757c478bd9Sstevel@tonic-gate # define optreset           BSDoptreset
4767c478bd9Sstevel@tonic-gate # define optarg             BSDoptarg
4777c478bd9Sstevel@tonic-gate #endif
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate /* In older versions of libpam, pam_strerror takes a single argument */
4807c478bd9Sstevel@tonic-gate #ifdef HAVE_OLD_PAM
4817c478bd9Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((b))
4827c478bd9Sstevel@tonic-gate #else
4837c478bd9Sstevel@tonic-gate # define PAM_STRERROR(a,b) pam_strerror((a),(b))
4847c478bd9Sstevel@tonic-gate #endif
4857c478bd9Sstevel@tonic-gate 
4867c478bd9Sstevel@tonic-gate #ifdef PAM_SUN_CODEBASE
4877c478bd9Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member)
4887c478bd9Sstevel@tonic-gate #else
4897c478bd9Sstevel@tonic-gate # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member)
4907c478bd9Sstevel@tonic-gate #endif
4917c478bd9Sstevel@tonic-gate 
4927c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
4937c478bd9Sstevel@tonic-gate # undef HAVE_GETADDRINFO
4947c478bd9Sstevel@tonic-gate #endif
4957c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO)
4967c478bd9Sstevel@tonic-gate # undef HAVE_FREEADDRINFO
4977c478bd9Sstevel@tonic-gate #endif
4987c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR)
4997c478bd9Sstevel@tonic-gate # undef HAVE_GAI_STRERROR
5007c478bd9Sstevel@tonic-gate #endif
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
5037c478bd9Sstevel@tonic-gate # define memmove(s1, s2, n) bcopy((s2), (s1), (n))
5047c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX)
5077c478bd9Sstevel@tonic-gate #  define USE_VHANGUP
5087c478bd9Sstevel@tonic-gate #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate #ifndef GETPGRP_VOID
5117c478bd9Sstevel@tonic-gate # define getpgrp() getpgrp(0)
5127c478bd9Sstevel@tonic-gate #endif
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate /* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */
5157c478bd9Sstevel@tonic-gate #if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f)
5167c478bd9Sstevel@tonic-gate # define OPENSSL_free(x) Free(x)
5177c478bd9Sstevel@tonic-gate #endif
5187c478bd9Sstevel@tonic-gate 
5197c478bd9Sstevel@tonic-gate #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
5207c478bd9Sstevel@tonic-gate #  define __func__ __FUNCTION__
5217c478bd9Sstevel@tonic-gate #elif !defined(HAVE___func__)
5227c478bd9Sstevel@tonic-gate #  define __func__ ""
5237c478bd9Sstevel@tonic-gate #endif
5247c478bd9Sstevel@tonic-gate 
5257c478bd9Sstevel@tonic-gate /*
5267c478bd9Sstevel@tonic-gate  * Define this to use pipes instead of socketpairs for communicating with the
5277c478bd9Sstevel@tonic-gate  * client program.  Socketpairs do not seem to work on all systems.
5287c478bd9Sstevel@tonic-gate  *
5297c478bd9Sstevel@tonic-gate  * configure.ac sets this for a few OS's which are known to have problems
5307c478bd9Sstevel@tonic-gate  * but you may need to set it yourself
5317c478bd9Sstevel@tonic-gate  */
5327c478bd9Sstevel@tonic-gate /* #define USE_PIPES 1 */
5337c478bd9Sstevel@tonic-gate 
5347c478bd9Sstevel@tonic-gate /**
5357c478bd9Sstevel@tonic-gate  ** login recorder definitions
5367c478bd9Sstevel@tonic-gate  **/
5377c478bd9Sstevel@tonic-gate 
5387c478bd9Sstevel@tonic-gate /* FIXME: put default paths back in */
5397c478bd9Sstevel@tonic-gate #ifndef UTMP_FILE
5407c478bd9Sstevel@tonic-gate #  ifdef _PATH_UTMP
5417c478bd9Sstevel@tonic-gate #    define UTMP_FILE _PATH_UTMP
5427c478bd9Sstevel@tonic-gate #  else
5437c478bd9Sstevel@tonic-gate #    ifdef CONF_UTMP_FILE
5447c478bd9Sstevel@tonic-gate #      define UTMP_FILE CONF_UTMP_FILE
5457c478bd9Sstevel@tonic-gate #    endif
5467c478bd9Sstevel@tonic-gate #  endif
5477c478bd9Sstevel@tonic-gate #endif
5487c478bd9Sstevel@tonic-gate #ifndef WTMP_FILE
5497c478bd9Sstevel@tonic-gate #  ifdef _PATH_WTMP
5507c478bd9Sstevel@tonic-gate #    define WTMP_FILE _PATH_WTMP
5517c478bd9Sstevel@tonic-gate #  else
5527c478bd9Sstevel@tonic-gate #    ifdef CONF_WTMP_FILE
5537c478bd9Sstevel@tonic-gate #      define WTMP_FILE CONF_WTMP_FILE
5547c478bd9Sstevel@tonic-gate #    endif
5557c478bd9Sstevel@tonic-gate #  endif
5567c478bd9Sstevel@tonic-gate #endif
5577c478bd9Sstevel@tonic-gate /* pick up the user's location for lastlog if given */
5587c478bd9Sstevel@tonic-gate #ifndef LASTLOG_FILE
5597c478bd9Sstevel@tonic-gate #  ifdef _PATH_LASTLOG
5607c478bd9Sstevel@tonic-gate #    define LASTLOG_FILE _PATH_LASTLOG
5617c478bd9Sstevel@tonic-gate #  else
5627c478bd9Sstevel@tonic-gate #    ifdef CONF_LASTLOG_FILE
5637c478bd9Sstevel@tonic-gate #      define LASTLOG_FILE CONF_LASTLOG_FILE
5647c478bd9Sstevel@tonic-gate #    endif
5657c478bd9Sstevel@tonic-gate #  endif
5667c478bd9Sstevel@tonic-gate #endif
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate 
5697c478bd9Sstevel@tonic-gate /* The login() library function in libutil is first choice */
5707c478bd9Sstevel@tonic-gate #if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN)
5717c478bd9Sstevel@tonic-gate #  define USE_LOGIN
5727c478bd9Sstevel@tonic-gate 
5737c478bd9Sstevel@tonic-gate #else
5747c478bd9Sstevel@tonic-gate /* Simply select your favourite login types. */
5757c478bd9Sstevel@tonic-gate /* Can't do if-else because some systems use several... <sigh> */
5767c478bd9Sstevel@tonic-gate #  if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX)
5777c478bd9Sstevel@tonic-gate #    define USE_UTMPX
5787c478bd9Sstevel@tonic-gate #  endif
5797c478bd9Sstevel@tonic-gate #  if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
5807c478bd9Sstevel@tonic-gate #    define USE_UTMP
5817c478bd9Sstevel@tonic-gate #  endif
5827c478bd9Sstevel@tonic-gate #  if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX)
5837c478bd9Sstevel@tonic-gate #    define USE_WTMPX
5847c478bd9Sstevel@tonic-gate #  endif
5857c478bd9Sstevel@tonic-gate #  if defined(WTMP_FILE) && !defined(DISABLE_WTMP)
5867c478bd9Sstevel@tonic-gate #    define USE_WTMP
5877c478bd9Sstevel@tonic-gate #  endif
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate #endif
5907c478bd9Sstevel@tonic-gate 
5917c478bd9Sstevel@tonic-gate /* I hope that the presence of LASTLOG_FILE is enough to detect this */
5927c478bd9Sstevel@tonic-gate #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
5937c478bd9Sstevel@tonic-gate #  define USE_LASTLOG
5947c478bd9Sstevel@tonic-gate #endif
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate /** end of login recorder definitions */
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate #ifdef __cplusplus
5997c478bd9Sstevel@tonic-gate }
6007c478bd9Sstevel@tonic-gate #endif
6017c478bd9Sstevel@tonic-gate 
6027c478bd9Sstevel@tonic-gate #endif /* _DEFINES_H */
603