File:  [DragonFly] / src / crypto / openssh / Attic / defines.h
Revision 1.2: download - view: text, annotated - select for diffs
Fri Nov 14 03:54:29 2003 UTC (11 years, 1 month ago) by dillon
Branches: MAIN
CVS tags: HEAD, DragonFly_1_0_REL, DragonFly_1_0_RC1, DragonFly_1_0A_REL
__P removal.

Submitted-by: Craig Dooley <craig@xlnx-x.net>

    1: #ifndef _DEFINES_H
    2: #define _DEFINES_H
    3: 
    4: /* $Id: defines.h,v 1.96 2002/09/26 00:38:48 tim Exp $ */
    5: /* $DragonFly: src/crypto/openssh/defines.h,v 1.2 2003/11/14 03:54:29 dillon Exp $ */
    6: 
    7: 
    8: /* Constants */
    9: 
   10: #ifndef SHUT_RDWR
   11: enum
   12: {
   13:   SHUT_RD = 0,		/* No more receptions.  */
   14:   SHUT_WR,			/* No more transmissions.  */
   15:   SHUT_RDWR			/* No more receptions or transmissions.  */
   16: };
   17: # define SHUT_RD   SHUT_RD
   18: # define SHUT_WR   SHUT_WR
   19: # define SHUT_RDWR SHUT_RDWR
   20: #endif
   21: 
   22: #ifndef IPTOS_LOWDELAY
   23: # define IPTOS_LOWDELAY          0x10
   24: # define IPTOS_THROUGHPUT        0x08
   25: # define IPTOS_RELIABILITY       0x04
   26: # define IPTOS_LOWCOST           0x02
   27: # define IPTOS_MINCOST           IPTOS_LOWCOST
   28: #endif /* IPTOS_LOWDELAY */
   29: 
   30: #ifndef MAXPATHLEN
   31: # ifdef PATH_MAX
   32: #  define MAXPATHLEN PATH_MAX
   33: # else /* PATH_MAX */
   34: #  define MAXPATHLEN 64 /* Should be safe */
   35: # endif /* PATH_MAX */
   36: #endif /* MAXPATHLEN */
   37: 
   38: #ifndef STDIN_FILENO
   39: # define STDIN_FILENO    0
   40: #endif
   41: #ifndef STDOUT_FILENO
   42: # define STDOUT_FILENO   1
   43: #endif
   44: #ifndef STDERR_FILENO
   45: # define STDERR_FILENO   2
   46: #endif
   47: 
   48: #ifndef NGROUPS_MAX	/* Disable groupaccess if NGROUP_MAX is not set */
   49: #ifdef NGROUPS
   50: #define NGROUPS_MAX NGROUPS
   51: #else
   52: #define NGROUPS_MAX 0
   53: #endif
   54: #endif
   55: 
   56: #ifndef O_NONBLOCK	/* Non Blocking Open */
   57: # define O_NONBLOCK      00004
   58: #endif
   59: 
   60: #ifndef S_ISDIR
   61: # define S_ISDIR(mode)	(((mode) & (_S_IFMT)) == (_S_IFDIR))
   62: #endif /* S_ISDIR */
   63: 
   64: #ifndef S_ISREG 
   65: # define S_ISREG(mode)	(((mode) & (_S_IFMT)) == (_S_IFREG))
   66: #endif /* S_ISREG */
   67: 
   68: #ifndef S_ISLNK
   69: # define S_ISLNK(mode)	(((mode) & S_IFMT) == S_IFLNK)
   70: #endif /* S_ISLNK */
   71: 
   72: #ifndef S_IXUSR
   73: # define S_IXUSR			0000100	/* execute/search permission, */
   74: # define S_IXGRP			0000010	/* execute/search permission, */
   75: # define S_IXOTH			0000001	/* execute/search permission, */
   76: # define _S_IWUSR			0000200	/* write permission, */
   77: # define S_IWUSR			_S_IWUSR	/* write permission, owner */
   78: # define S_IWGRP			0000020	/* write permission, group */
   79: # define S_IWOTH			0000002	/* write permission, other */
   80: # define S_IRUSR			0000400	/* read permission, owner */
   81: # define S_IRGRP			0000040	/* read permission, group */
   82: # define S_IROTH			0000004	/* read permission, other */
   83: # define S_IRWXU			0000700	/* read, write, execute */
   84: # define S_IRWXG			0000070	/* read, write, execute */
   85: # define S_IRWXO			0000007	/* read, write, execute */
   86: #endif /* S_IXUSR */
   87: 
   88: #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
   89: #define MAP_ANON MAP_ANONYMOUS
   90: #endif
   91: 
   92: #ifndef MAP_FAILED
   93: # define MAP_FAILED ((void *)-1)
   94: #endif
   95: 
   96: /* *-*-nto-qnx doesn't define this constant in the system headers */
   97: #ifdef MISSING_NFDBITS
   98: # define	NFDBITS (8 * sizeof(unsigned long))
   99: #endif
  100: 
  101: /*
  102: SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but
  103: including rpc/rpc.h breaks Solaris 6
  104: */
  105: #ifndef INADDR_LOOPBACK
  106: #define INADDR_LOOPBACK ((u_long)0x7f000001)
  107: #endif
  108: 
  109: /* Types */
  110: 
  111: /* If sys/types.h does not supply intXX_t, supply them ourselves */
  112: /* (or die trying) */
  113: 
  114: 
  115: #ifndef HAVE_U_INT
  116: typedef unsigned int u_int;
  117: #endif
  118: 
  119: #ifndef HAVE_INTXX_T
  120: # if (SIZEOF_CHAR == 1)
  121: typedef char int8_t;
  122: # else
  123: #  error "8 bit int type not found."
  124: # endif
  125: # if (SIZEOF_SHORT_INT == 2)
  126: typedef short int int16_t;
  127: # else
  128: #  ifdef _UNICOS
  129: #   if (SIZEOF_SHORT_INT == 4)
  130: typedef short int16_t;
  131: #   else
  132: typedef long  int16_t;
  133: #   endif
  134: #  else
  135: #   error "16 bit int type not found."
  136: #  endif /* _UNICOS */
  137: # endif
  138: # if (SIZEOF_INT == 4)
  139: typedef int int32_t;
  140: # else
  141: #  ifdef _UNICOS
  142: typedef long  int32_t;
  143: #  else
  144: #   error "32 bit int type not found."
  145: #  endif /* _UNICOS */
  146: # endif
  147: #endif
  148: 
  149: /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
  150: #ifndef HAVE_U_INTXX_T
  151: # ifdef HAVE_UINTXX_T
  152: typedef uint8_t u_int8_t;
  153: typedef uint16_t u_int16_t;
  154: typedef uint32_t u_int32_t;
  155: # define HAVE_U_INTXX_T 1
  156: # else
  157: #  if (SIZEOF_CHAR == 1)
  158: typedef unsigned char u_int8_t;
  159: #  else
  160: #   error "8 bit int type not found."
  161: #  endif
  162: #  if (SIZEOF_SHORT_INT == 2)
  163: typedef unsigned short int u_int16_t;
  164: #  else
  165: #   ifdef _UNICOS
  166: #    if (SIZEOF_SHORT_INT == 4)
  167: typedef unsigned short u_int16_t;
  168: #    else
  169: typedef unsigned long  u_int16_t;
  170: #    endif
  171: #   else
  172: #    error "16 bit int type not found."
  173: #   endif
  174: #  endif
  175: #  if (SIZEOF_INT == 4)
  176: typedef unsigned int u_int32_t;
  177: #  else
  178: #   ifdef _UNICOS
  179: typedef unsigned long  u_int32_t;
  180: #   else
  181: #    error "32 bit int type not found."
  182: #   endif
  183: #  endif
  184: # endif
  185: #define __BIT_TYPES_DEFINED__
  186: #endif
  187: 
  188: /* 64-bit types */
  189: #ifndef HAVE_INT64_T
  190: # if (SIZEOF_LONG_INT == 8)
  191: typedef long int int64_t;
  192: #   define HAVE_INT64_T 1
  193: # else
  194: #  if (SIZEOF_LONG_LONG_INT == 8)
  195: typedef long long int int64_t;
  196: #   define HAVE_INT64_T 1
  197: #  endif
  198: # endif
  199: #endif
  200: #ifndef HAVE_U_INT64_T
  201: # if (SIZEOF_LONG_INT == 8)
  202: typedef unsigned long int u_int64_t;
  203: #   define HAVE_U_INT64_T 1
  204: # else
  205: #  if (SIZEOF_LONG_LONG_INT == 8)
  206: typedef unsigned long long int u_int64_t;
  207: #   define HAVE_U_INT64_T 1
  208: #  endif
  209: # endif
  210: #endif
  211: #if !defined(HAVE_LONG_LONG_INT) && (SIZEOF_LONG_LONG_INT == 8)
  212: # define HAVE_LONG_LONG_INT 1
  213: #endif
  214: 
  215: #ifndef HAVE_U_CHAR
  216: typedef unsigned char u_char;
  217: # define HAVE_U_CHAR
  218: #endif /* HAVE_U_CHAR */
  219: 
  220: #ifndef SIZE_T_MAX
  221: #define SIZE_T_MAX ULONG_MAX
  222: #endif /* SIZE_T_MAX */
  223: 
  224: #ifndef HAVE_SIZE_T
  225: typedef unsigned int size_t;
  226: # define HAVE_SIZE_T
  227: #endif /* HAVE_SIZE_T */
  228: 
  229: #ifndef HAVE_SSIZE_T
  230: typedef int ssize_t;
  231: # define HAVE_SSIZE_T
  232: #endif /* HAVE_SSIZE_T */
  233: 
  234: #ifndef HAVE_CLOCK_T
  235: typedef long clock_t;
  236: # define HAVE_CLOCK_T
  237: #endif /* HAVE_CLOCK_T */
  238: 
  239: #ifndef HAVE_SA_FAMILY_T
  240: typedef int sa_family_t;
  241: # define HAVE_SA_FAMILY_T
  242: #endif /* HAVE_SA_FAMILY_T */
  243: 
  244: #ifndef HAVE_PID_T
  245: typedef int pid_t;
  246: # define HAVE_PID_T
  247: #endif /* HAVE_PID_T */
  248: 
  249: #ifndef HAVE_SIG_ATOMIC_T
  250: typedef int sig_atomic_t;
  251: # define HAVE_SIG_ATOMIC_T
  252: #endif /* HAVE_SIG_ATOMIC_T */
  253: 
  254: #ifndef HAVE_MODE_T
  255: typedef int mode_t;
  256: # define HAVE_MODE_T
  257: #endif /* HAVE_MODE_T */
  258: 
  259: #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
  260: # define ss_family __ss_family
  261: #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
  262: 
  263: #ifndef HAVE_SYS_UN_H
  264: struct	sockaddr_un {
  265: 	short	sun_family;		/* AF_UNIX */
  266: 	char	sun_path[108];		/* path name (gag) */
  267: };
  268: #endif /* HAVE_SYS_UN_H */
  269: 
  270: #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
  271: #define _STRUCT_WINSIZE
  272: struct winsize {
  273:       unsigned short ws_row;          /* rows, in characters */
  274:       unsigned short ws_col;          /* columns, in character */
  275:       unsigned short ws_xpixel;       /* horizontal size, pixels */
  276:       unsigned short ws_ypixel;       /* vertical size, pixels */
  277: };
  278: #endif
  279: 
  280: /* *-*-nto-qnx does not define this type in the system headers */
  281: #ifdef MISSING_FD_MASK
  282:  typedef unsigned long int	fd_mask;
  283: #endif
  284: 
  285: /* Paths */
  286: 
  287: #ifndef _PATH_BSHELL
  288: # define _PATH_BSHELL "/bin/sh"
  289: #endif
  290: #ifndef _PATH_CSHELL
  291: # define _PATH_CSHELL "/bin/csh"
  292: #endif
  293: #ifndef _PATH_SHELLS
  294: # define _PATH_SHELLS "/etc/shells"
  295: #endif
  296: 
  297: #ifdef USER_PATH
  298: # ifdef _PATH_STDPATH
  299: #  undef _PATH_STDPATH
  300: # endif
  301: # define _PATH_STDPATH USER_PATH
  302: #endif
  303: 
  304: #ifndef _PATH_STDPATH
  305: # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
  306: #endif
  307: 
  308: #ifndef _PATH_DEVNULL
  309: # define _PATH_DEVNULL "/dev/null"
  310: #endif
  311: 
  312: #ifndef MAIL_DIRECTORY
  313: # define MAIL_DIRECTORY "/var/spool/mail"
  314: #endif
  315: 
  316: #ifndef MAILDIR
  317: # define MAILDIR MAIL_DIRECTORY
  318: #endif
  319: 
  320: #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
  321: # define _PATH_MAILDIR MAILDIR
  322: #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
  323: 
  324: #ifndef _PATH_NOLOGIN
  325: # define _PATH_NOLOGIN "/etc/nologin"
  326: #endif
  327: 
  328: /* Define this to be the path of the xauth program. */
  329: #ifdef XAUTH_PATH
  330: #define _PATH_XAUTH XAUTH_PATH
  331: #endif /* XAUTH_PATH */
  332: 
  333: /* derived from XF4/xc/lib/dps/Xlibnet.h */
  334: #ifndef X_UNIX_PATH
  335: #  ifdef __hpux
  336: #    define X_UNIX_PATH "/var/spool/sockets/X11/%u"
  337: #  else
  338: #    define X_UNIX_PATH "/tmp/.X11-unix/X%u"
  339: #  endif
  340: #endif /* X_UNIX_PATH */
  341: #define _PATH_UNIX_X X_UNIX_PATH
  342: 
  343: #ifndef _PATH_TTY
  344: # define _PATH_TTY "/dev/tty"
  345: #endif
  346: 
  347: /* Macros */
  348: 
  349: #if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H)
  350: # define HAVE_LOGIN_CAP
  351: #endif
  352: 
  353: #ifndef MAX
  354: # define MAX(a,b) (((a)>(b))?(a):(b))
  355: # define MIN(a,b) (((a)<(b))?(a):(b))
  356: #endif
  357: 
  358: #ifndef roundup
  359: # define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
  360: #endif
  361: 
  362: #ifndef timersub
  363: #define timersub(a, b, result)					\
  364:    do {								\
  365:       (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;		\
  366:       (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;		\
  367:       if ((result)->tv_usec < 0) {				\
  368: 	 --(result)->tv_sec;					\
  369: 	 (result)->tv_usec += 1000000;				\
  370:       }								\
  371:    } while (0)
  372: #endif
  373: 
  374: #if !defined(IN6_IS_ADDR_V4MAPPED)
  375: # define IN6_IS_ADDR_V4MAPPED(a) \
  376: 	((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
  377: 	 (((u_int32_t *) (a))[2] == htonl (0xffff)))
  378: #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
  379: 
  380: #if !defined(__GNUC__) || (__GNUC__ < 2)
  381: # define __attribute__(x)
  382: #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
  383: 
  384: /* *-*-nto-qnx doesn't define this macro in the system headers */
  385: #ifdef MISSING_HOWMANY
  386: # define howmany(x,y)	(((x)+((y)-1))/(y))
  387: #endif
  388: 
  389: #ifndef OSSH_ALIGNBYTES
  390: #define OSSH_ALIGNBYTES	(sizeof(int) - 1)
  391: #endif
  392: #ifndef __CMSG_ALIGN
  393: #define	__CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES)
  394: #endif
  395: 
  396: /* Length of the contents of a control message of length len */
  397: #ifndef CMSG_LEN
  398: #define	CMSG_LEN(len)	(__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
  399: #endif
  400: 
  401: /* Length of the space taken up by a padded control message of length len */
  402: #ifndef CMSG_SPACE
  403: #define	CMSG_SPACE(len)	(__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
  404: #endif
  405: 
  406: /* Function replacement / compatibility hacks */
  407: 
  408: #if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO))
  409: # define HAVE_GETADDRINFO
  410: #endif
  411: 
  412: #ifndef HAVE_GETOPT_OPTRESET
  413: # undef getopt
  414: # undef opterr
  415: # undef optind
  416: # undef optopt
  417: # undef optreset
  418: # undef optarg
  419: # define getopt(ac, av, o)  BSDgetopt(ac, av, o)
  420: # define opterr             BSDopterr
  421: # define optind             BSDoptind
  422: # define optopt             BSDoptopt
  423: # define optreset           BSDoptreset
  424: # define optarg             BSDoptarg
  425: #endif
  426: 
  427: /* In older versions of libpam, pam_strerror takes a single argument */
  428: #ifdef HAVE_OLD_PAM
  429: # define PAM_STRERROR(a,b) pam_strerror((b))
  430: #else
  431: # define PAM_STRERROR(a,b) pam_strerror((a),(b))
  432: #endif
  433: 
  434: #ifdef PAM_SUN_CODEBASE
  435: # define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member)
  436: #else
  437: # define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member)
  438: #endif
  439: 
  440: #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
  441: # undef HAVE_GETADDRINFO
  442: #endif
  443: #if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO)
  444: # undef HAVE_FREEADDRINFO
  445: #endif
  446: #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR)
  447: # undef HAVE_GAI_STRERROR
  448: #endif
  449: 
  450: #if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
  451: # define memmove(s1, s2, n) bcopy((s2), (s1), (n))
  452: #endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
  453: 
  454: #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX)
  455: #  define USE_VHANGUP
  456: #endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */
  457: 
  458: #ifndef GETPGRP_VOID
  459: # define getpgrp() getpgrp(0)
  460: #endif
  461: 
  462: /* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */
  463: #if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f)
  464: # define OPENSSL_free(x) Free(x)
  465: #endif
  466: 
  467: #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
  468: #  define __func__ __FUNCTION__
  469: #elif !defined(HAVE___func__)
  470: #  define __func__ ""
  471: #endif
  472: 
  473: /*
  474:  * Define this to use pipes instead of socketpairs for communicating with the
  475:  * client program.  Socketpairs do not seem to work on all systems.
  476:  *
  477:  * configure.ac sets this for a few OS's which are known to have problems
  478:  * but you may need to set it yourself
  479:  */
  480: /* #define USE_PIPES 1 */
  481: 
  482: /**
  483:  ** login recorder definitions
  484:  **/
  485: 
  486: /* FIXME: put default paths back in */
  487: #ifndef UTMP_FILE
  488: #  ifdef _PATH_UTMP
  489: #    define UTMP_FILE _PATH_UTMP
  490: #  else
  491: #    ifdef CONF_UTMP_FILE
  492: #      define UTMP_FILE CONF_UTMP_FILE
  493: #    endif
  494: #  endif
  495: #endif
  496: #ifndef WTMP_FILE
  497: #  ifdef _PATH_WTMP
  498: #    define WTMP_FILE _PATH_WTMP
  499: #  else
  500: #    ifdef CONF_WTMP_FILE
  501: #      define WTMP_FILE CONF_WTMP_FILE
  502: #    endif
  503: #  endif
  504: #endif
  505: /* pick up the user's location for lastlog if given */
  506: #ifndef LASTLOG_FILE
  507: #  ifdef _PATH_LASTLOG
  508: #    define LASTLOG_FILE _PATH_LASTLOG
  509: #  else
  510: #    ifdef CONF_LASTLOG_FILE
  511: #      define LASTLOG_FILE CONF_LASTLOG_FILE
  512: #    endif
  513: #  endif
  514: #endif
  515: 
  516: 
  517: /* The login() library function in libutil is first choice */
  518: #if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN)
  519: #  define USE_LOGIN
  520: 
  521: #else
  522: /* Simply select your favourite login types. */
  523: /* Can't do if-else because some systems use several... <sigh> */
  524: #  if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX)
  525: #    define USE_UTMPX
  526: #  endif
  527: #  if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
  528: #    define USE_UTMP
  529: #  endif
  530: #  if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX)
  531: #    define USE_WTMPX
  532: #  endif
  533: #  if defined(WTMP_FILE) && !defined(DISABLE_WTMP)
  534: #    define USE_WTMP
  535: #  endif
  536: 
  537: #endif
  538: 
  539: /* I hope that the presence of LASTLOG_FILE is enough to detect this */
  540: #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
  541: #  define USE_LASTLOG
  542: #endif
  543: 
  544: /** end of login recorder definitions */
  545: 
  546: #endif /* _DEFINES_H */