xref: /titanic_50/usr/src/cmd/ssh/include/defines.h (revision fbaf5b3e92ba3bfee8b866a9e1f3cf089e58b2ab)
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 /*
25*fbaf5b3eSJan Pechanec  * Copyright 2010 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 #ifdef __cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /* $Id: defines.h,v 1.96 2002/09/26 00:38:48 tim Exp $ */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /* Constants */
407c478bd9Sstevel@tonic-gate #ifndef SHUT_RDWR
417c478bd9Sstevel@tonic-gate enum
427c478bd9Sstevel@tonic-gate {
437c478bd9Sstevel@tonic-gate 	SHUT_RD = 0,	/* No more receptions.  */
447c478bd9Sstevel@tonic-gate 	SHUT_WR,	/* No more transmissions.  */
457c478bd9Sstevel@tonic-gate 	SHUT_RDWR	/* No more receptions or transmissions. */
467c478bd9Sstevel@tonic-gate };
477c478bd9Sstevel@tonic-gate #define	SHUT_RD   SHUT_RD
487c478bd9Sstevel@tonic-gate #define	SHUT_WR   SHUT_WR
497c478bd9Sstevel@tonic-gate #define	SHUT_RDWR SHUT_RDWR
507c478bd9Sstevel@tonic-gate #endif
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate #ifndef IPTOS_LOWDELAY
537c478bd9Sstevel@tonic-gate #define	IPTOS_LOWDELAY		0x10
547c478bd9Sstevel@tonic-gate #define	IPTOS_THROUGHPUT	0x08
557c478bd9Sstevel@tonic-gate #define	IPTOS_RELIABILITY	0x04
567c478bd9Sstevel@tonic-gate #define	IPTOS_LOWCOST		0x02
577c478bd9Sstevel@tonic-gate #define	IPTOS_MINCOST		IPTOS_LOWCOST
587c478bd9Sstevel@tonic-gate #endif /* IPTOS_LOWDELAY */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #ifndef MAXPATHLEN
617c478bd9Sstevel@tonic-gate #ifdef PATH_MAX
627c478bd9Sstevel@tonic-gate #define	MAXPATHLEN PATH_MAX
637c478bd9Sstevel@tonic-gate #else /* PATH_MAX */
647c478bd9Sstevel@tonic-gate #define	MAXPATHLEN 64 /* Should be safe */
657c478bd9Sstevel@tonic-gate #endif /* PATH_MAX */
667c478bd9Sstevel@tonic-gate #endif /* MAXPATHLEN */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate #ifndef STDIN_FILENO
697c478bd9Sstevel@tonic-gate #define	STDIN_FILENO    0
707c478bd9Sstevel@tonic-gate #endif
716b82a780Sjp161948 
727c478bd9Sstevel@tonic-gate #ifndef STDOUT_FILENO
737c478bd9Sstevel@tonic-gate #define	STDOUT_FILENO   1
747c478bd9Sstevel@tonic-gate #endif
756b82a780Sjp161948 
767c478bd9Sstevel@tonic-gate #ifndef STDERR_FILENO
777c478bd9Sstevel@tonic-gate #define	STDERR_FILENO   2
787c478bd9Sstevel@tonic-gate #endif
797c478bd9Sstevel@tonic-gate 
80743541abSjp161948 /* Disable groupaccess if NGROUPS_UMAX, NGROUPS_MAX and NGROUPS are not set */
81743541abSjp161948 #ifndef NGROUPS_UMAX
82743541abSjp161948 #ifdef NGROUPS_MAX
83743541abSjp161948 #define	NGROUPS_UMAX NGROUPS_MAX
84743541abSjp161948 #elif defined(NGROUPS)
85743541abSjp161948 #define	NGROUPS_UMAX NGROUPS
867c478bd9Sstevel@tonic-gate #else
87743541abSjp161948 #define	NGROUPS_UMAX 0
887c478bd9Sstevel@tonic-gate #endif
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #ifndef O_NONBLOCK	/* Non Blocking Open */
927c478bd9Sstevel@tonic-gate #define	O_NONBLOCK	00004
937c478bd9Sstevel@tonic-gate #endif
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #ifndef S_ISDIR
967c478bd9Sstevel@tonic-gate #define	S_ISDIR(mode)	(((mode) & (_S_IFMT)) == (_S_IFDIR))
977c478bd9Sstevel@tonic-gate #endif /* S_ISDIR */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #ifndef S_ISREG
1007c478bd9Sstevel@tonic-gate #define	S_ISREG(mode)	(((mode) & (_S_IFMT)) == (_S_IFREG))
1017c478bd9Sstevel@tonic-gate #endif /* S_ISREG */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifndef S_ISLNK
1047c478bd9Sstevel@tonic-gate #define	S_ISLNK(mode)	(((mode) & S_IFMT) == S_IFLNK)
1057c478bd9Sstevel@tonic-gate #endif /* S_ISLNK */
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #ifndef S_IXUSR
1087c478bd9Sstevel@tonic-gate #define	S_IXUSR			0000100	/* execute/search permission, */
1097c478bd9Sstevel@tonic-gate #define	S_IXGRP			0000010	/* execute/search permission, */
1107c478bd9Sstevel@tonic-gate #define	S_IXOTH			0000001	/* execute/search permission, */
1117c478bd9Sstevel@tonic-gate #define	_S_IWUSR		0000200	/* write permission, */
1127c478bd9Sstevel@tonic-gate #define	S_IWUSR			_S_IWUSR /* write permission, owner */
1137c478bd9Sstevel@tonic-gate #define	S_IWGRP			0000020	/* write permission, group */
1147c478bd9Sstevel@tonic-gate #define	S_IWOTH			0000002	/* write permission, other */
1157c478bd9Sstevel@tonic-gate #define	S_IRUSR			0000400	/* read permission, owner */
1167c478bd9Sstevel@tonic-gate #define	S_IRGRP			0000040	/* read permission, group */
1177c478bd9Sstevel@tonic-gate #define	S_IROTH			0000004	/* read permission, other */
1187c478bd9Sstevel@tonic-gate #define	S_IRWXU			0000700	/* read, write, execute */
1197c478bd9Sstevel@tonic-gate #define	S_IRWXG			0000070	/* read, write, execute */
1207c478bd9Sstevel@tonic-gate #define	S_IRWXO			0000007	/* read, write, execute */
1217c478bd9Sstevel@tonic-gate #endif /* S_IXUSR */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
1247c478bd9Sstevel@tonic-gate #define	MAP_ANON MAP_ANONYMOUS
1257c478bd9Sstevel@tonic-gate #endif
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifndef MAP_FAILED
1287c478bd9Sstevel@tonic-gate #define	MAP_FAILED ((void *)-1)
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this constant in the system headers */
1327c478bd9Sstevel@tonic-gate #ifdef MISSING_NFDBITS
1337c478bd9Sstevel@tonic-gate #define	NFDBITS (8 * sizeof (unsigned long))
1347c478bd9Sstevel@tonic-gate #endif
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /*
1376b82a780Sjp161948  * SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but including
1386b82a780Sjp161948  * rpc/rpc.h breaks Solaris 6
1397c478bd9Sstevel@tonic-gate  */
1407c478bd9Sstevel@tonic-gate #ifndef INADDR_LOOPBACK
1416b82a780Sjp161948 #define	INADDR_LOOPBACK ((ulong_t)0x7f000001)
1427c478bd9Sstevel@tonic-gate #endif
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate /* Types */
1457c478bd9Sstevel@tonic-gate 
1466b82a780Sjp161948 /*
1476b82a780Sjp161948  * If sys/types.h does not supply intXX_t, supply them ourselves (or die trying)
1486b82a780Sjp161948  */
1497c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT
1506b82a780Sjp161948 /* for now, we can't remove u_int without changing almost all other files */
1516b82a780Sjp161948 /* CSTYLED */
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
2366b82a780Sjp161948 
2377c478bd9Sstevel@tonic-gate #ifndef HAVE_U_INT64_T
2387c478bd9Sstevel@tonic-gate #if (SIZEOF_LONG_INT == 8)
2397c478bd9Sstevel@tonic-gate typedef unsigned long int u_int64_t;
2407c478bd9Sstevel@tonic-gate #define	HAVE_U_INT64_T 1
2417c478bd9Sstevel@tonic-gate #else
2427c478bd9Sstevel@tonic-gate #if (SIZEOF_LONG_LONG_INT == 8)
2437c478bd9Sstevel@tonic-gate typedef unsigned long long int u_int64_t;
2447c478bd9Sstevel@tonic-gate #define	HAVE_U_INT64_T 1
2457c478bd9Sstevel@tonic-gate #endif
2467c478bd9Sstevel@tonic-gate #endif
2477c478bd9Sstevel@tonic-gate #endif
2486b82a780Sjp161948 
2497c478bd9Sstevel@tonic-gate #if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8)
2507c478bd9Sstevel@tonic-gate #define	HAVE_LONG_LONG_INT 1
2517c478bd9Sstevel@tonic-gate #endif
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate #ifndef HAVE_U_CHAR
2546b82a780Sjp161948 /* for now, we can't remove u_char without changing almost all other files */
2556b82a780Sjp161948 /* CSTYLED */
2567c478bd9Sstevel@tonic-gate typedef unsigned char u_char;
2577c478bd9Sstevel@tonic-gate #define	HAVE_U_CHAR
2587c478bd9Sstevel@tonic-gate #endif /* HAVE_U_CHAR */
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate #ifndef SIZE_T_MAX
2617c478bd9Sstevel@tonic-gate #define	SIZE_T_MAX ULONG_MAX
2627c478bd9Sstevel@tonic-gate #endif /* SIZE_T_MAX */
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate #ifndef HAVE_SIZE_T
2657c478bd9Sstevel@tonic-gate typedef unsigned int size_t;
2667c478bd9Sstevel@tonic-gate #define	HAVE_SIZE_T
2677c478bd9Sstevel@tonic-gate #endif /* HAVE_SIZE_T */
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #ifndef HAVE_SSIZE_T
2707c478bd9Sstevel@tonic-gate typedef int ssize_t;
2717c478bd9Sstevel@tonic-gate #define	HAVE_SSIZE_T
2727c478bd9Sstevel@tonic-gate #endif /* HAVE_SSIZE_T */
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate #ifndef HAVE_CLOCK_T
2757c478bd9Sstevel@tonic-gate typedef long clock_t;
2767c478bd9Sstevel@tonic-gate #define	HAVE_CLOCK_T
2777c478bd9Sstevel@tonic-gate #endif /* HAVE_CLOCK_T */
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate #ifndef HAVE_SA_FAMILY_T
2807c478bd9Sstevel@tonic-gate typedef int sa_family_t;
2817c478bd9Sstevel@tonic-gate #define	HAVE_SA_FAMILY_T
2827c478bd9Sstevel@tonic-gate #endif /* HAVE_SA_FAMILY_T */
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate #ifndef HAVE_PID_T
2857c478bd9Sstevel@tonic-gate typedef int pid_t;
2867c478bd9Sstevel@tonic-gate #define	HAVE_PID_T
2877c478bd9Sstevel@tonic-gate #endif /* HAVE_PID_T */
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate #ifndef HAVE_SIG_ATOMIC_T
2907c478bd9Sstevel@tonic-gate typedef int sig_atomic_t;
2917c478bd9Sstevel@tonic-gate #define	HAVE_SIG_ATOMIC_T
2927c478bd9Sstevel@tonic-gate #endif /* HAVE_SIG_ATOMIC_T */
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate #ifndef HAVE_MODE_T
2957c478bd9Sstevel@tonic-gate typedef int mode_t;
2967c478bd9Sstevel@tonic-gate #define	HAVE_MODE_T
2977c478bd9Sstevel@tonic-gate #endif /* HAVE_MODE_T */
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
3007c478bd9Sstevel@tonic-gate #define	ss_family __ss_family
3017c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate #ifndef HAVE_SYS_UN_H
3047c478bd9Sstevel@tonic-gate struct	sockaddr_un {
3057c478bd9Sstevel@tonic-gate 	short	sun_family;		/* AF_UNIX */
3067c478bd9Sstevel@tonic-gate 	char	sun_path[108];		/* path name (gag) */
3077c478bd9Sstevel@tonic-gate };
3087c478bd9Sstevel@tonic-gate #endif /* HAVE_SYS_UN_H */
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
3117c478bd9Sstevel@tonic-gate #define	_STRUCT_WINSIZE
3127c478bd9Sstevel@tonic-gate struct winsize {
3137c478bd9Sstevel@tonic-gate 	unsigned short ws_row;		/* rows, in characters */
3147c478bd9Sstevel@tonic-gate 	unsigned short ws_col;		/* columns, in character */
3157c478bd9Sstevel@tonic-gate 	unsigned short ws_xpixel;	/* horizontal size, pixels */
3167c478bd9Sstevel@tonic-gate 	unsigned short ws_ypixel;	/* vertical size, pixels */
3177c478bd9Sstevel@tonic-gate };
3187c478bd9Sstevel@tonic-gate #endif
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate /* *-*-nto-qnx does not define this type in the system headers */
3217c478bd9Sstevel@tonic-gate #ifdef MISSING_FD_MASK
3227c478bd9Sstevel@tonic-gate typedef unsigned long int fd_mask;
3237c478bd9Sstevel@tonic-gate #endif
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate /* Paths */
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate #ifndef _PATH_BSHELL
3287c478bd9Sstevel@tonic-gate #define	_PATH_BSHELL "/bin/sh"
3297c478bd9Sstevel@tonic-gate #endif
3306b82a780Sjp161948 
3317c478bd9Sstevel@tonic-gate #ifndef _PATH_CSHELL
3327c478bd9Sstevel@tonic-gate #define	_PATH_CSHELL "/bin/csh"
3337c478bd9Sstevel@tonic-gate #endif
3346b82a780Sjp161948 
3357c478bd9Sstevel@tonic-gate #ifndef _PATH_SHELLS
3367c478bd9Sstevel@tonic-gate #define	_PATH_SHELLS "/etc/shells"
3377c478bd9Sstevel@tonic-gate #endif
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate #ifdef USER_PATH
3407c478bd9Sstevel@tonic-gate #ifdef _PATH_STDPATH
3417c478bd9Sstevel@tonic-gate #undef _PATH_STDPATH
3427c478bd9Sstevel@tonic-gate #endif
3437c478bd9Sstevel@tonic-gate #define	_PATH_STDPATH USER_PATH
3447c478bd9Sstevel@tonic-gate #endif
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate #ifndef _PATH_STDPATH
3477c478bd9Sstevel@tonic-gate #define	_PATH_STDPATH "/usr/bin"
3487c478bd9Sstevel@tonic-gate #endif
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate #ifndef _PATH_DEVNULL
3517c478bd9Sstevel@tonic-gate #define	_PATH_DEVNULL "/dev/null"
3527c478bd9Sstevel@tonic-gate #endif
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate #ifndef MAIL_DIRECTORY
3557c478bd9Sstevel@tonic-gate #define	MAIL_DIRECTORY "/var/spool/mail"
3567c478bd9Sstevel@tonic-gate #endif
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate #ifndef MAILDIR
3597c478bd9Sstevel@tonic-gate #define	MAILDIR MAIL_DIRECTORY
3607c478bd9Sstevel@tonic-gate #endif
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
3637c478bd9Sstevel@tonic-gate #define	_PATH_MAILDIR MAILDIR
3647c478bd9Sstevel@tonic-gate #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate #ifndef _PATH_RSH
3677c478bd9Sstevel@tonic-gate #ifdef RSH_PATH
3687c478bd9Sstevel@tonic-gate #define	_PATH_RSH RSH_PATH
3697c478bd9Sstevel@tonic-gate #else /* RSH_PATH */
3707c478bd9Sstevel@tonic-gate #define	_PATH_RSH "/usr/bin/rsh"
3717c478bd9Sstevel@tonic-gate #endif /* RSH_PATH */
3727c478bd9Sstevel@tonic-gate #endif /* _PATH_RSH */
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate #ifndef _PATH_NOLOGIN
3757c478bd9Sstevel@tonic-gate #define	_PATH_NOLOGIN "/etc/nologin"
3767c478bd9Sstevel@tonic-gate #endif
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate /* Define this to be the path of the xauth program. */
3797c478bd9Sstevel@tonic-gate #ifdef XAUTH_PATH
3807c478bd9Sstevel@tonic-gate #define	_PATH_XAUTH XAUTH_PATH
3817c478bd9Sstevel@tonic-gate #endif /* XAUTH_PATH */
3827c478bd9Sstevel@tonic-gate 
3837c478bd9Sstevel@tonic-gate /* derived from XF4/xc/lib/dps/Xlibnet.h */
3847c478bd9Sstevel@tonic-gate #ifndef X_UNIX_PATH
3857c478bd9Sstevel@tonic-gate #ifdef __hpux
3867c478bd9Sstevel@tonic-gate #define	X_UNIX_PATH "/var/spool/sockets/X11/%u"
3877c478bd9Sstevel@tonic-gate #else
3887c478bd9Sstevel@tonic-gate #define	X_UNIX_PATH "/tmp/.X11-unix/X%u"
3897c478bd9Sstevel@tonic-gate #endif
3907c478bd9Sstevel@tonic-gate #endif /* X_UNIX_PATH */
3916b82a780Sjp161948 
3927c478bd9Sstevel@tonic-gate #define	_PATH_UNIX_X X_UNIX_PATH
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate #ifndef _PATH_TTY
3957c478bd9Sstevel@tonic-gate #define	_PATH_TTY "/dev/tty"
3967c478bd9Sstevel@tonic-gate #endif
3977c478bd9Sstevel@tonic-gate 
3987c478bd9Sstevel@tonic-gate /* Macros */
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate #ifndef MAX
4017c478bd9Sstevel@tonic-gate #define	MAX(a, b) (((a) > (b)) ? (a) : (b))
4027c478bd9Sstevel@tonic-gate #define	MIN(a, b) (((a) < (b)) ? (a) : (b))
4037c478bd9Sstevel@tonic-gate #endif
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate #ifndef roundup
4067c478bd9Sstevel@tonic-gate #define	roundup(x, y)   ((((x) + ((y) - 1)) / (y)) * (y))
4077c478bd9Sstevel@tonic-gate #endif
4087c478bd9Sstevel@tonic-gate 
4097c478bd9Sstevel@tonic-gate #ifndef timersub
4107c478bd9Sstevel@tonic-gate #define	timersub(a, b, result)						\
4117c478bd9Sstevel@tonic-gate 	do {								\
4127c478bd9Sstevel@tonic-gate 		(result)->tv_sec = (a)->tv_sec - (b)->tv_sec;		\
4137c478bd9Sstevel@tonic-gate 		(result)->tv_usec = (a)->tv_usec - (b)->tv_usec;	\
4147c478bd9Sstevel@tonic-gate 		if ((result)->tv_usec < 0) {				\
4157c478bd9Sstevel@tonic-gate 			--(result)->tv_sec;				\
4167c478bd9Sstevel@tonic-gate 			(result)->tv_usec += 1000000;			\
4177c478bd9Sstevel@tonic-gate 		}							\
4187c478bd9Sstevel@tonic-gate 	} while (0)
4197c478bd9Sstevel@tonic-gate #endif
4207c478bd9Sstevel@tonic-gate 
4217c478bd9Sstevel@tonic-gate #ifndef __P
4227c478bd9Sstevel@tonic-gate #define	__P(x) x
4237c478bd9Sstevel@tonic-gate #endif
4247c478bd9Sstevel@tonic-gate 
4257c478bd9Sstevel@tonic-gate #if !defined(IN6_IS_ADDR_V4MAPPED)
4267c478bd9Sstevel@tonic-gate #define	IN6_IS_ADDR_V4MAPPED(a) \
4277c478bd9Sstevel@tonic-gate 	((((u_int32_t *)(a))[0] == 0) && (((u_int32_t *)(a))[1] == 0) && \
4287c478bd9Sstevel@tonic-gate 	(((u_int32_t *)(a))[2] == htonl(0xffff)))
4297c478bd9Sstevel@tonic-gate #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate #if !defined(__GNUC__) || (__GNUC__ < 2)
4327c478bd9Sstevel@tonic-gate #define	__attribute__(x)
4337c478bd9Sstevel@tonic-gate #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
4347c478bd9Sstevel@tonic-gate 
43590685d2cSjp161948 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
43690685d2cSjp161948 #define	__bounded__(x, y, z)
43790685d2cSjp161948 #endif
43890685d2cSjp161948 
4397c478bd9Sstevel@tonic-gate /* *-*-nto-qnx doesn't define this macro in the system headers */
4407c478bd9Sstevel@tonic-gate #ifdef MISSING_HOWMANY
4417c478bd9Sstevel@tonic-gate #define	howmany(x, y)	(((x) + ((y) - 1)) / (y))
4427c478bd9Sstevel@tonic-gate #endif
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate #ifndef OSSH_ALIGNBYTES
4457c478bd9Sstevel@tonic-gate #define	OSSH_ALIGNBYTES	(sizeof (int) - 1)
4467c478bd9Sstevel@tonic-gate #endif
4476b82a780Sjp161948 
4487c478bd9Sstevel@tonic-gate #ifndef __CMSG_ALIGN
4496b82a780Sjp161948 #define	__CMSG_ALIGN(p) (((uint_t)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES)
4507c478bd9Sstevel@tonic-gate #endif
4517c478bd9Sstevel@tonic-gate 
4527c478bd9Sstevel@tonic-gate /* Length of the contents of a control message of length len */
4537c478bd9Sstevel@tonic-gate #ifndef CMSG_LEN
4547c478bd9Sstevel@tonic-gate #define	CMSG_LEN(len)	(__CMSG_ALIGN(sizeof (struct cmsghdr)) + (len))
4557c478bd9Sstevel@tonic-gate #endif
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate /* Length of the space taken up by a padded control message of length len */
4587c478bd9Sstevel@tonic-gate #ifndef CMSG_SPACE
4596b82a780Sjp161948 #define	CMSG_SPACE(len)	\
4606b82a780Sjp161948 	(__CMSG_ALIGN(sizeof (struct cmsghdr)) + __CMSG_ALIGN(len))
4617c478bd9Sstevel@tonic-gate #endif
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate /* Function replacement / compatibility hacks */
4647c478bd9Sstevel@tonic-gate 
4656b82a780Sjp161948 #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || \
4666b82a780Sjp161948 	defined(HAVE_NGETADDRINFO))
4677c478bd9Sstevel@tonic-gate #define	HAVE_GETADDRINFO
4687c478bd9Sstevel@tonic-gate #endif
4697c478bd9Sstevel@tonic-gate 
4707c478bd9Sstevel@tonic-gate #ifndef HAVE_GETOPT_OPTRESET
4717c478bd9Sstevel@tonic-gate #undef getopt
4727c478bd9Sstevel@tonic-gate #undef opterr
4737c478bd9Sstevel@tonic-gate #undef optind
4747c478bd9Sstevel@tonic-gate #undef optopt
4757c478bd9Sstevel@tonic-gate #undef optreset
4767c478bd9Sstevel@tonic-gate #undef optarg
4777c478bd9Sstevel@tonic-gate #define	getopt(ac, av, o)	BSDgetopt(ac, av, o)
4787c478bd9Sstevel@tonic-gate #define	opterr			BSDopterr
4797c478bd9Sstevel@tonic-gate #define	optind			BSDoptind
4807c478bd9Sstevel@tonic-gate #define	optopt			BSDoptopt
4817c478bd9Sstevel@tonic-gate #define	optreset		BSDoptreset
4827c478bd9Sstevel@tonic-gate #define	optarg			BSDoptarg
4837c478bd9Sstevel@tonic-gate #endif
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate /* In older versions of libpam, pam_strerror takes a single argument */
4867c478bd9Sstevel@tonic-gate #ifdef HAVE_OLD_PAM
4877c478bd9Sstevel@tonic-gate #define	PAM_STRERROR(a, b) pam_strerror((b))
4887c478bd9Sstevel@tonic-gate #else
4897c478bd9Sstevel@tonic-gate #define	PAM_STRERROR(a, b) pam_strerror((a), (b))
4907c478bd9Sstevel@tonic-gate #endif
4917c478bd9Sstevel@tonic-gate 
4927c478bd9Sstevel@tonic-gate #ifdef PAM_SUN_CODEBASE
4937c478bd9Sstevel@tonic-gate #define	PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member)
4947c478bd9Sstevel@tonic-gate #else
4957c478bd9Sstevel@tonic-gate #define	PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member)
4967c478bd9Sstevel@tonic-gate #endif
4977c478bd9Sstevel@tonic-gate 
4987c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
4997c478bd9Sstevel@tonic-gate #undef HAVE_GETADDRINFO
5007c478bd9Sstevel@tonic-gate #endif
5016b82a780Sjp161948 
5027c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO)
5037c478bd9Sstevel@tonic-gate #undef HAVE_FREEADDRINFO
5047c478bd9Sstevel@tonic-gate #endif
5056b82a780Sjp161948 
5067c478bd9Sstevel@tonic-gate #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR)
5077c478bd9Sstevel@tonic-gate #undef HAVE_GAI_STRERROR
5087c478bd9Sstevel@tonic-gate #endif
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
5117c478bd9Sstevel@tonic-gate #define	memmove(s1, s2, n) bcopy((s2), (s1), (n))
5127c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX)
5157c478bd9Sstevel@tonic-gate #define	USE_VHANGUP
5167c478bd9Sstevel@tonic-gate #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */
5177c478bd9Sstevel@tonic-gate 
5187c478bd9Sstevel@tonic-gate #ifndef GETPGRP_VOID
5197c478bd9Sstevel@tonic-gate #define	getpgrp() getpgrp(0)
5207c478bd9Sstevel@tonic-gate #endif
5217c478bd9Sstevel@tonic-gate 
5227c478bd9Sstevel@tonic-gate /* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */
5237c478bd9Sstevel@tonic-gate #if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f)
5247c478bd9Sstevel@tonic-gate #define	OPENSSL_free(x) Free(x)
5257c478bd9Sstevel@tonic-gate #endif
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
5287c478bd9Sstevel@tonic-gate #define	__func__ __FUNCTION__
5297c478bd9Sstevel@tonic-gate #elif !defined(HAVE___func__)
5307c478bd9Sstevel@tonic-gate #define	__func__ ""
5317c478bd9Sstevel@tonic-gate #endif
5327c478bd9Sstevel@tonic-gate 
5337c478bd9Sstevel@tonic-gate /*
5346b82a780Sjp161948  * login recorder definitions
5356b82a780Sjp161948  */
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate /* FIXME: put default paths back in */
5387c478bd9Sstevel@tonic-gate #ifndef UTMP_FILE
5397c478bd9Sstevel@tonic-gate #ifdef _PATH_UTMP
5407c478bd9Sstevel@tonic-gate #define	UTMP_FILE _PATH_UTMP
5417c478bd9Sstevel@tonic-gate #else
5427c478bd9Sstevel@tonic-gate #ifdef CONF_UTMP_FILE
5437c478bd9Sstevel@tonic-gate #define	UTMP_FILE CONF_UTMP_FILE
5447c478bd9Sstevel@tonic-gate #endif
5457c478bd9Sstevel@tonic-gate #endif
5467c478bd9Sstevel@tonic-gate #endif
5476b82a780Sjp161948 
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
5576b82a780Sjp161948 
5587c478bd9Sstevel@tonic-gate /* pick up the user's location for lastlog if given */
5597c478bd9Sstevel@tonic-gate #ifndef LASTLOG_FILE
5607c478bd9Sstevel@tonic-gate #ifdef _PATH_LASTLOG
5617c478bd9Sstevel@tonic-gate #define	LASTLOG_FILE _PATH_LASTLOG
5627c478bd9Sstevel@tonic-gate #else
5637c478bd9Sstevel@tonic-gate #ifdef CONF_LASTLOG_FILE
5647c478bd9Sstevel@tonic-gate #define	LASTLOG_FILE CONF_LASTLOG_FILE
5657c478bd9Sstevel@tonic-gate #endif
5667c478bd9Sstevel@tonic-gate #endif
5677c478bd9Sstevel@tonic-gate #endif
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 #else
5737c478bd9Sstevel@tonic-gate /* Simply select your favourite login types. */
5747c478bd9Sstevel@tonic-gate /* Can't do if-else because some systems use several... <sigh> */
5757c478bd9Sstevel@tonic-gate #if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX)
5767c478bd9Sstevel@tonic-gate #define	USE_UTMPX
5777c478bd9Sstevel@tonic-gate #endif
5787c478bd9Sstevel@tonic-gate #if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
5797c478bd9Sstevel@tonic-gate #define	USE_UTMP
5807c478bd9Sstevel@tonic-gate #endif
5817c478bd9Sstevel@tonic-gate #if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX)
5827c478bd9Sstevel@tonic-gate #define	USE_WTMPX
5837c478bd9Sstevel@tonic-gate #endif
5847c478bd9Sstevel@tonic-gate #if defined(WTMP_FILE) && !defined(DISABLE_WTMP)
5857c478bd9Sstevel@tonic-gate #define	USE_WTMP
5867c478bd9Sstevel@tonic-gate #endif
5877c478bd9Sstevel@tonic-gate #endif
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate /* I hope that the presence of LASTLOG_FILE is enough to detect this */
5907c478bd9Sstevel@tonic-gate #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
5917c478bd9Sstevel@tonic-gate #define	USE_LASTLOG
5927c478bd9Sstevel@tonic-gate #endif
5937c478bd9Sstevel@tonic-gate 
5946b82a780Sjp161948 /* end of login recorder definitions */
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate #ifdef __cplusplus
5977c478bd9Sstevel@tonic-gate }
5987c478bd9Sstevel@tonic-gate #endif
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate #endif /* _DEFINES_H */
601