defines.h revision 137015
1124208Sdes/* 2124208Sdes * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 3124208Sdes * 4124208Sdes * Redistribution and use in source and binary forms, with or without 5124208Sdes * modification, are permitted provided that the following conditions 6124208Sdes * are met: 7124208Sdes * 1. Redistributions of source code must retain the above copyright 8124208Sdes * notice, this list of conditions and the following disclaimer. 9124208Sdes * 2. Redistributions in binary form must reproduce the above copyright 10124208Sdes * notice, this list of conditions and the following disclaimer in the 11124208Sdes * documentation and/or other materials provided with the distribution. 12124208Sdes * 13124208Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14124208Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15124208Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16124208Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17124208Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18124208Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19124208Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20124208Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21124208Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22124208Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23124208Sdes */ 24124208Sdes 2598937Sdes#ifndef _DEFINES_H 2698937Sdes#define _DEFINES_H 2798937Sdes 28137015Sdes/* $Id: defines.h,v 1.117 2004/06/22 03:27:16 dtucker Exp $ */ 2998937Sdes 3098937Sdes 3198937Sdes/* Constants */ 3298937Sdes 3398937Sdes#ifndef SHUT_RDWR 3498937Sdesenum 3598937Sdes{ 3698937Sdes SHUT_RD = 0, /* No more receptions. */ 3798937Sdes SHUT_WR, /* No more transmissions. */ 3898937Sdes SHUT_RDWR /* No more receptions or transmissions. */ 3998937Sdes}; 4098937Sdes# define SHUT_RD SHUT_RD 4198937Sdes# define SHUT_WR SHUT_WR 4298937Sdes# define SHUT_RDWR SHUT_RDWR 4398937Sdes#endif 4498937Sdes 4598937Sdes#ifndef IPTOS_LOWDELAY 4698937Sdes# define IPTOS_LOWDELAY 0x10 4798937Sdes# define IPTOS_THROUGHPUT 0x08 4898937Sdes# define IPTOS_RELIABILITY 0x04 4998937Sdes# define IPTOS_LOWCOST 0x02 5098937Sdes# define IPTOS_MINCOST IPTOS_LOWCOST 5198937Sdes#endif /* IPTOS_LOWDELAY */ 5298937Sdes 5398937Sdes#ifndef MAXPATHLEN 5498937Sdes# ifdef PATH_MAX 5598937Sdes# define MAXPATHLEN PATH_MAX 5698937Sdes# else /* PATH_MAX */ 5798937Sdes# define MAXPATHLEN 64 /* Should be safe */ 5898937Sdes# endif /* PATH_MAX */ 5998937Sdes#endif /* MAXPATHLEN */ 6098937Sdes 6198937Sdes#ifndef STDIN_FILENO 6298937Sdes# define STDIN_FILENO 0 6398937Sdes#endif 6498937Sdes#ifndef STDOUT_FILENO 6598937Sdes# define STDOUT_FILENO 1 6698937Sdes#endif 6798937Sdes#ifndef STDERR_FILENO 6898937Sdes# define STDERR_FILENO 2 6998937Sdes#endif 7098937Sdes 7198937Sdes#ifndef NGROUPS_MAX /* Disable groupaccess if NGROUP_MAX is not set */ 7298937Sdes#ifdef NGROUPS 7398937Sdes#define NGROUPS_MAX NGROUPS 7498937Sdes#else 7598937Sdes#define NGROUPS_MAX 0 7698937Sdes#endif 7798937Sdes#endif 7898937Sdes 7998937Sdes#ifndef O_NONBLOCK /* Non Blocking Open */ 8098937Sdes# define O_NONBLOCK 00004 8198937Sdes#endif 8298937Sdes 8398937Sdes#ifndef S_ISDIR 8498937Sdes# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR)) 8598937Sdes#endif /* S_ISDIR */ 8698937Sdes 87126274Sdes#ifndef S_ISREG 8898937Sdes# define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG)) 8998937Sdes#endif /* S_ISREG */ 9098937Sdes 9198937Sdes#ifndef S_ISLNK 9298937Sdes# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) 9398937Sdes#endif /* S_ISLNK */ 9498937Sdes 9598937Sdes#ifndef S_IXUSR 9698937Sdes# define S_IXUSR 0000100 /* execute/search permission, */ 9798937Sdes# define S_IXGRP 0000010 /* execute/search permission, */ 9898937Sdes# define S_IXOTH 0000001 /* execute/search permission, */ 9998937Sdes# define _S_IWUSR 0000200 /* write permission, */ 10098937Sdes# define S_IWUSR _S_IWUSR /* write permission, owner */ 10198937Sdes# define S_IWGRP 0000020 /* write permission, group */ 10298937Sdes# define S_IWOTH 0000002 /* write permission, other */ 10398937Sdes# define S_IRUSR 0000400 /* read permission, owner */ 10498937Sdes# define S_IRGRP 0000040 /* read permission, group */ 10598937Sdes# define S_IROTH 0000004 /* read permission, other */ 10698937Sdes# define S_IRWXU 0000700 /* read, write, execute */ 10798937Sdes# define S_IRWXG 0000070 /* read, write, execute */ 10898937Sdes# define S_IRWXO 0000007 /* read, write, execute */ 10998937Sdes#endif /* S_IXUSR */ 11098937Sdes 11198937Sdes#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) 11298937Sdes#define MAP_ANON MAP_ANONYMOUS 11398937Sdes#endif 11498937Sdes 11598937Sdes#ifndef MAP_FAILED 11698937Sdes# define MAP_FAILED ((void *)-1) 11798937Sdes#endif 11898937Sdes 11998937Sdes/* *-*-nto-qnx doesn't define this constant in the system headers */ 12098937Sdes#ifdef MISSING_NFDBITS 12198937Sdes# define NFDBITS (8 * sizeof(unsigned long)) 12298937Sdes#endif 12398937Sdes 12498937Sdes/* 12598937SdesSCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but 12698937Sdesincluding rpc/rpc.h breaks Solaris 6 12798937Sdes*/ 12898937Sdes#ifndef INADDR_LOOPBACK 129106121Sdes#define INADDR_LOOPBACK ((u_long)0x7f000001) 13098937Sdes#endif 13198937Sdes 132126274Sdes#ifndef __unused 133126274Sdes#define __unused 134126274Sdes#endif 135126274Sdes 13698937Sdes/* Types */ 13798937Sdes 13898937Sdes/* If sys/types.h does not supply intXX_t, supply them ourselves */ 13998937Sdes/* (or die trying) */ 14098937Sdes 14198937Sdes 14298937Sdes#ifndef HAVE_U_INT 14398937Sdestypedef unsigned int u_int; 14498937Sdes#endif 14598937Sdes 14698937Sdes#ifndef HAVE_INTXX_T 14798937Sdes# if (SIZEOF_CHAR == 1) 14898937Sdestypedef char int8_t; 14998937Sdes# else 15098937Sdes# error "8 bit int type not found." 15198937Sdes# endif 15298937Sdes# if (SIZEOF_SHORT_INT == 2) 15398937Sdestypedef short int int16_t; 15498937Sdes# else 155106121Sdes# ifdef _UNICOS 15698937Sdes# if (SIZEOF_SHORT_INT == 4) 15798937Sdestypedef short int16_t; 15898937Sdes# else 15998937Sdestypedef long int16_t; 16098937Sdes# endif 16198937Sdes# else 16298937Sdes# error "16 bit int type not found." 163106121Sdes# endif /* _UNICOS */ 16498937Sdes# endif 16598937Sdes# if (SIZEOF_INT == 4) 16698937Sdestypedef int int32_t; 16798937Sdes# else 168106121Sdes# ifdef _UNICOS 16998937Sdestypedef long int32_t; 17098937Sdes# else 17198937Sdes# error "32 bit int type not found." 172106121Sdes# endif /* _UNICOS */ 17398937Sdes# endif 17498937Sdes#endif 17598937Sdes 17698937Sdes/* If sys/types.h does not supply u_intXX_t, supply them ourselves */ 17798937Sdes#ifndef HAVE_U_INTXX_T 17898937Sdes# ifdef HAVE_UINTXX_T 17998937Sdestypedef uint8_t u_int8_t; 18098937Sdestypedef uint16_t u_int16_t; 18198937Sdestypedef uint32_t u_int32_t; 18298937Sdes# define HAVE_U_INTXX_T 1 18398937Sdes# else 18498937Sdes# if (SIZEOF_CHAR == 1) 18598937Sdestypedef unsigned char u_int8_t; 18698937Sdes# else 18798937Sdes# error "8 bit int type not found." 18898937Sdes# endif 18998937Sdes# if (SIZEOF_SHORT_INT == 2) 19098937Sdestypedef unsigned short int u_int16_t; 19198937Sdes# else 192106121Sdes# ifdef _UNICOS 19398937Sdes# if (SIZEOF_SHORT_INT == 4) 19498937Sdestypedef unsigned short u_int16_t; 19598937Sdes# else 19698937Sdestypedef unsigned long u_int16_t; 19798937Sdes# endif 19898937Sdes# else 19998937Sdes# error "16 bit int type not found." 20098937Sdes# endif 20198937Sdes# endif 20298937Sdes# if (SIZEOF_INT == 4) 20398937Sdestypedef unsigned int u_int32_t; 20498937Sdes# else 205106121Sdes# ifdef _UNICOS 20698937Sdestypedef unsigned long u_int32_t; 20798937Sdes# else 20898937Sdes# error "32 bit int type not found." 20998937Sdes# endif 21098937Sdes# endif 21198937Sdes# endif 21298937Sdes#define __BIT_TYPES_DEFINED__ 21398937Sdes#endif 21498937Sdes 21598937Sdes/* 64-bit types */ 21698937Sdes#ifndef HAVE_INT64_T 21798937Sdes# if (SIZEOF_LONG_INT == 8) 21898937Sdestypedef long int int64_t; 21998937Sdes# else 22098937Sdes# if (SIZEOF_LONG_LONG_INT == 8) 22198937Sdestypedef long long int int64_t; 22298937Sdes# endif 22398937Sdes# endif 22498937Sdes#endif 22598937Sdes#ifndef HAVE_U_INT64_T 22698937Sdes# if (SIZEOF_LONG_INT == 8) 22798937Sdestypedef unsigned long int u_int64_t; 22898937Sdes# else 22998937Sdes# if (SIZEOF_LONG_LONG_INT == 8) 23098937Sdestypedef unsigned long long int u_int64_t; 23198937Sdes# endif 23298937Sdes# endif 23398937Sdes#endif 23498937Sdes 23598937Sdes#ifndef HAVE_U_CHAR 23698937Sdestypedef unsigned char u_char; 23798937Sdes# define HAVE_U_CHAR 23898937Sdes#endif /* HAVE_U_CHAR */ 23998937Sdes 240106121Sdes#ifndef SIZE_T_MAX 241106121Sdes#define SIZE_T_MAX ULONG_MAX 242106121Sdes#endif /* SIZE_T_MAX */ 243106121Sdes 24498937Sdes#ifndef HAVE_SIZE_T 24598937Sdestypedef unsigned int size_t; 24698937Sdes# define HAVE_SIZE_T 247126274Sdes# define SIZE_T_MAX UINT_MAX 24898937Sdes#endif /* HAVE_SIZE_T */ 24998937Sdes 25098937Sdes#ifndef HAVE_SSIZE_T 25198937Sdestypedef int ssize_t; 25298937Sdes# define HAVE_SSIZE_T 25398937Sdes#endif /* HAVE_SSIZE_T */ 25498937Sdes 25598937Sdes#ifndef HAVE_CLOCK_T 25698937Sdestypedef long clock_t; 25798937Sdes# define HAVE_CLOCK_T 25898937Sdes#endif /* HAVE_CLOCK_T */ 25998937Sdes 26098937Sdes#ifndef HAVE_SA_FAMILY_T 26198937Sdestypedef int sa_family_t; 26298937Sdes# define HAVE_SA_FAMILY_T 26398937Sdes#endif /* HAVE_SA_FAMILY_T */ 26498937Sdes 26598937Sdes#ifndef HAVE_PID_T 26698937Sdestypedef int pid_t; 26798937Sdes# define HAVE_PID_T 26898937Sdes#endif /* HAVE_PID_T */ 26998937Sdes 27098937Sdes#ifndef HAVE_SIG_ATOMIC_T 27198937Sdestypedef int sig_atomic_t; 27298937Sdes# define HAVE_SIG_ATOMIC_T 27398937Sdes#endif /* HAVE_SIG_ATOMIC_T */ 27498937Sdes 27598937Sdes#ifndef HAVE_MODE_T 27698937Sdestypedef int mode_t; 27798937Sdes# define HAVE_MODE_T 27898937Sdes#endif /* HAVE_MODE_T */ 27998937Sdes 28098937Sdes#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) 28198937Sdes# define ss_family __ss_family 28298937Sdes#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */ 28398937Sdes 28498937Sdes#ifndef HAVE_SYS_UN_H 28598937Sdesstruct sockaddr_un { 28698937Sdes short sun_family; /* AF_UNIX */ 28798937Sdes char sun_path[108]; /* path name (gag) */ 28898937Sdes}; 28998937Sdes#endif /* HAVE_SYS_UN_H */ 29098937Sdes 29198937Sdes#if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE) 29298937Sdes#define _STRUCT_WINSIZE 29398937Sdesstruct winsize { 29498937Sdes unsigned short ws_row; /* rows, in characters */ 29598937Sdes unsigned short ws_col; /* columns, in character */ 29698937Sdes unsigned short ws_xpixel; /* horizontal size, pixels */ 29798937Sdes unsigned short ws_ypixel; /* vertical size, pixels */ 29898937Sdes}; 29998937Sdes#endif 30098937Sdes 30198937Sdes/* *-*-nto-qnx does not define this type in the system headers */ 30298937Sdes#ifdef MISSING_FD_MASK 30398937Sdes typedef unsigned long int fd_mask; 30498937Sdes#endif 30598937Sdes 30698937Sdes/* Paths */ 30798937Sdes 30898937Sdes#ifndef _PATH_BSHELL 30998937Sdes# define _PATH_BSHELL "/bin/sh" 31098937Sdes#endif 31198937Sdes#ifndef _PATH_CSHELL 31298937Sdes# define _PATH_CSHELL "/bin/csh" 31398937Sdes#endif 31498937Sdes#ifndef _PATH_SHELLS 31598937Sdes# define _PATH_SHELLS "/etc/shells" 31698937Sdes#endif 31798937Sdes 31898937Sdes#ifdef USER_PATH 31998937Sdes# ifdef _PATH_STDPATH 32098937Sdes# undef _PATH_STDPATH 32198937Sdes# endif 32298937Sdes# define _PATH_STDPATH USER_PATH 32398937Sdes#endif 32498937Sdes 32598937Sdes#ifndef _PATH_STDPATH 32698937Sdes# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" 32798937Sdes#endif 32898937Sdes 329124208Sdes#ifndef SUPERUSER_PATH 330124208Sdes# define SUPERUSER_PATH _PATH_STDPATH 331124208Sdes#endif 332124208Sdes 33398937Sdes#ifndef _PATH_DEVNULL 33498937Sdes# define _PATH_DEVNULL "/dev/null" 33598937Sdes#endif 33698937Sdes 33798937Sdes#ifndef MAIL_DIRECTORY 33898937Sdes# define MAIL_DIRECTORY "/var/spool/mail" 33998937Sdes#endif 34098937Sdes 34198937Sdes#ifndef MAILDIR 34298937Sdes# define MAILDIR MAIL_DIRECTORY 34398937Sdes#endif 34498937Sdes 34598937Sdes#if !defined(_PATH_MAILDIR) && defined(MAILDIR) 34698937Sdes# define _PATH_MAILDIR MAILDIR 34798937Sdes#endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ 34898937Sdes 34998937Sdes#ifndef _PATH_NOLOGIN 35098937Sdes# define _PATH_NOLOGIN "/etc/nologin" 35198937Sdes#endif 35298937Sdes 35398937Sdes/* Define this to be the path of the xauth program. */ 35498937Sdes#ifdef XAUTH_PATH 35598937Sdes#define _PATH_XAUTH XAUTH_PATH 35698937Sdes#endif /* XAUTH_PATH */ 35798937Sdes 35898937Sdes/* derived from XF4/xc/lib/dps/Xlibnet.h */ 35998937Sdes#ifndef X_UNIX_PATH 36098937Sdes# ifdef __hpux 36198937Sdes# define X_UNIX_PATH "/var/spool/sockets/X11/%u" 36298937Sdes# else 36398937Sdes# define X_UNIX_PATH "/tmp/.X11-unix/X%u" 36498937Sdes# endif 36598937Sdes#endif /* X_UNIX_PATH */ 36698937Sdes#define _PATH_UNIX_X X_UNIX_PATH 36798937Sdes 36898937Sdes#ifndef _PATH_TTY 36998937Sdes# define _PATH_TTY "/dev/tty" 37098937Sdes#endif 37198937Sdes 37298937Sdes/* Macros */ 37398937Sdes 37498937Sdes#if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H) 37598937Sdes# define HAVE_LOGIN_CAP 37698937Sdes#endif 37798937Sdes 37898937Sdes#ifndef MAX 37998937Sdes# define MAX(a,b) (((a)>(b))?(a):(b)) 38098937Sdes# define MIN(a,b) (((a)<(b))?(a):(b)) 38198937Sdes#endif 38298937Sdes 38398937Sdes#ifndef roundup 38498937Sdes# define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 38598937Sdes#endif 38698937Sdes 38798937Sdes#ifndef timersub 38898937Sdes#define timersub(a, b, result) \ 38998937Sdes do { \ 39098937Sdes (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 39198937Sdes (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 39298937Sdes if ((result)->tv_usec < 0) { \ 39398937Sdes --(result)->tv_sec; \ 39498937Sdes (result)->tv_usec += 1000000; \ 39598937Sdes } \ 39698937Sdes } while (0) 39798937Sdes#endif 39898937Sdes 399113908Sdes#ifndef TIMEVAL_TO_TIMESPEC 400113908Sdes#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ 401113908Sdes (ts)->tv_sec = (tv)->tv_sec; \ 402113908Sdes (ts)->tv_nsec = (tv)->tv_usec * 1000; \ 403113908Sdes} 404113908Sdes#endif 405113908Sdes 406113908Sdes#ifndef TIMESPEC_TO_TIMEVAL 407113908Sdes#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ 408113908Sdes (tv)->tv_sec = (ts)->tv_sec; \ 409113908Sdes (tv)->tv_usec = (ts)->tv_nsec / 1000; \ 410113908Sdes} 411113908Sdes#endif 412113908Sdes 41398937Sdes#ifndef __P 41498937Sdes# define __P(x) x 41598937Sdes#endif 41698937Sdes 41798937Sdes#if !defined(IN6_IS_ADDR_V4MAPPED) 41898937Sdes# define IN6_IS_ADDR_V4MAPPED(a) \ 41998937Sdes ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ 42098937Sdes (((u_int32_t *) (a))[2] == htonl (0xffff))) 42198937Sdes#endif /* !defined(IN6_IS_ADDR_V4MAPPED) */ 42298937Sdes 42398937Sdes#if !defined(__GNUC__) || (__GNUC__ < 2) 42498937Sdes# define __attribute__(x) 42598937Sdes#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ 42698937Sdes 427137015Sdes#ifndef __dead 428137015Sdes# define __dead __attribute__((noreturn)) 429137015Sdes#endif 430137015Sdes 43198937Sdes/* *-*-nto-qnx doesn't define this macro in the system headers */ 43298937Sdes#ifdef MISSING_HOWMANY 43398937Sdes# define howmany(x,y) (((x)+((y)-1))/(y)) 43498937Sdes#endif 43598937Sdes 43698937Sdes#ifndef OSSH_ALIGNBYTES 43798937Sdes#define OSSH_ALIGNBYTES (sizeof(int) - 1) 43898937Sdes#endif 43998937Sdes#ifndef __CMSG_ALIGN 44098937Sdes#define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES) 44198937Sdes#endif 44298937Sdes 44398937Sdes/* Length of the contents of a control message of length len */ 44498937Sdes#ifndef CMSG_LEN 44598937Sdes#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 44698937Sdes#endif 44798937Sdes 44898937Sdes/* Length of the space taken up by a padded control message of length len */ 44998937Sdes#ifndef CMSG_SPACE 45098937Sdes#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) 45198937Sdes#endif 45298937Sdes 453124208Sdes/* given pointer to struct cmsghdr, return pointer to data */ 454124208Sdes#ifndef CMSG_DATA 455124208Sdes#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr))) 456124208Sdes#endif /* CMSG_DATA */ 457124208Sdes 458124208Sdes/* 459124208Sdes * RFC 2292 requires to check msg_controllen, in case that the kernel returns 460124208Sdes * an empty list for some reasons. 461124208Sdes */ 462124208Sdes#ifndef CMSG_FIRSTHDR 463124208Sdes#define CMSG_FIRSTHDR(mhdr) \ 464124208Sdes ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ 465124208Sdes (struct cmsghdr *)(mhdr)->msg_control : \ 466124208Sdes (struct cmsghdr *)NULL) 467124208Sdes#endif /* CMSG_FIRSTHDR */ 468124208Sdes 469137015Sdes#ifndef offsetof 470137015Sdes# define offsetof(type, member) ((size_t) &((type *)0)->member) 471137015Sdes#endif 472124208Sdes 47398937Sdes/* Function replacement / compatibility hacks */ 47498937Sdes 47598937Sdes#if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO)) 47698937Sdes# define HAVE_GETADDRINFO 47798937Sdes#endif 47898937Sdes 47998937Sdes#ifndef HAVE_GETOPT_OPTRESET 48099060Sdes# undef getopt 48199060Sdes# undef opterr 48299060Sdes# undef optind 48399060Sdes# undef optopt 48499060Sdes# undef optreset 48599060Sdes# undef optarg 48699060Sdes# define getopt(ac, av, o) BSDgetopt(ac, av, o) 48799060Sdes# define opterr BSDopterr 48899060Sdes# define optind BSDoptind 48999060Sdes# define optopt BSDoptopt 49099060Sdes# define optreset BSDoptreset 49199060Sdes# define optarg BSDoptarg 49298937Sdes#endif 49398937Sdes 49498937Sdes/* In older versions of libpam, pam_strerror takes a single argument */ 49598937Sdes#ifdef HAVE_OLD_PAM 49698937Sdes# define PAM_STRERROR(a,b) pam_strerror((b)) 49798937Sdes#else 49898937Sdes# define PAM_STRERROR(a,b) pam_strerror((a),(b)) 49998937Sdes#endif 50098937Sdes 50198937Sdes#ifdef PAM_SUN_CODEBASE 50298937Sdes# define PAM_MSG_MEMBER(msg, n, member) ((*(msg))[(n)].member) 50398937Sdes#else 50498937Sdes# define PAM_MSG_MEMBER(msg, n, member) ((msg)[(n)]->member) 50598937Sdes#endif 50698937Sdes 50798937Sdes#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) 50898937Sdes# undef HAVE_GETADDRINFO 50998937Sdes#endif 51098937Sdes#if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO) 51198937Sdes# undef HAVE_FREEADDRINFO 51298937Sdes#endif 51398937Sdes#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR) 51498937Sdes# undef HAVE_GAI_STRERROR 51598937Sdes#endif 51698937Sdes 517128456Sdes#if defined(BROKEN_UPDWTMPX) && defined(HAVE_UPDWTMPX) 518128456Sdes# undef HAVE_UPDWTMPX 519128456Sdes#endif 520128456Sdes 52198937Sdes#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) 52298937Sdes# define memmove(s1, s2, n) bcopy((s2), (s1), (n)) 52398937Sdes#endif /* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */ 52498937Sdes 52598937Sdes#if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) 52698937Sdes# define USE_VHANGUP 52798937Sdes#endif /* defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) */ 52898937Sdes 52998937Sdes#ifndef GETPGRP_VOID 53098937Sdes# define getpgrp() getpgrp(0) 53198937Sdes#endif 53298937Sdes 53398937Sdes/* OPENSSL_free() is Free() in versions before OpenSSL 0.9.6 */ 53498937Sdes#if !defined(OPENSSL_VERSION_NUMBER) || (OPENSSL_VERSION_NUMBER < 0x0090600f) 53598937Sdes# define OPENSSL_free(x) Free(x) 53698937Sdes#endif 53798937Sdes 53898937Sdes#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__) 53998937Sdes# define __func__ __FUNCTION__ 54098937Sdes#elif !defined(HAVE___func__) 54198937Sdes# define __func__ "" 54298937Sdes#endif 54398937Sdes 544124208Sdes#if defined(KRB5) && !defined(HEIMDAL) 545124208Sdes# define krb5_get_err_text(context,code) error_message(code) 546124208Sdes#endif 547124208Sdes 548128456Sdes#if defined(SKEYCHALLENGE_4ARG) 549128456Sdes# define _compat_skeychallenge(a,b,c,d) skeychallenge(a,b,c,d) 550128456Sdes#else 551128456Sdes# define _compat_skeychallenge(a,b,c,d) skeychallenge(a,b,c) 552128456Sdes#endif 553128456Sdes 554126274Sdes/* Maximum number of file descriptors available */ 555126274Sdes#ifdef HAVE_SYSCONF 556126274Sdes# define SSH_SYSFDMAX sysconf(_SC_OPEN_MAX) 557126274Sdes#else 558126274Sdes# define SSH_SYSFDMAX 10000 559126274Sdes#endif 560126274Sdes 561126274Sdes 56298937Sdes/* 56398937Sdes * Define this to use pipes instead of socketpairs for communicating with the 56498937Sdes * client program. Socketpairs do not seem to work on all systems. 56598937Sdes * 56698937Sdes * configure.ac sets this for a few OS's which are known to have problems 56798937Sdes * but you may need to set it yourself 56898937Sdes */ 56998937Sdes/* #define USE_PIPES 1 */ 57098937Sdes 57198937Sdes/** 57298937Sdes ** login recorder definitions 57398937Sdes **/ 57498937Sdes 57598937Sdes/* FIXME: put default paths back in */ 57698937Sdes#ifndef UTMP_FILE 57798937Sdes# ifdef _PATH_UTMP 57898937Sdes# define UTMP_FILE _PATH_UTMP 57998937Sdes# else 58098937Sdes# ifdef CONF_UTMP_FILE 58198937Sdes# define UTMP_FILE CONF_UTMP_FILE 58298937Sdes# endif 58398937Sdes# endif 58498937Sdes#endif 58598937Sdes#ifndef WTMP_FILE 58698937Sdes# ifdef _PATH_WTMP 58798937Sdes# define WTMP_FILE _PATH_WTMP 58898937Sdes# else 58998937Sdes# ifdef CONF_WTMP_FILE 59098937Sdes# define WTMP_FILE CONF_WTMP_FILE 59198937Sdes# endif 59298937Sdes# endif 59398937Sdes#endif 59498937Sdes/* pick up the user's location for lastlog if given */ 59598937Sdes#ifndef LASTLOG_FILE 59698937Sdes# ifdef _PATH_LASTLOG 59798937Sdes# define LASTLOG_FILE _PATH_LASTLOG 59898937Sdes# else 59998937Sdes# ifdef CONF_LASTLOG_FILE 60098937Sdes# define LASTLOG_FILE CONF_LASTLOG_FILE 60198937Sdes# endif 60298937Sdes# endif 60398937Sdes#endif 60498937Sdes 605126274Sdes#if defined(HAVE_SHADOW_H) && !defined(DISABLE_SHADOW) 606126274Sdes# define USE_SHADOW 607126274Sdes#endif 60898937Sdes 60998937Sdes/* The login() library function in libutil is first choice */ 61098937Sdes#if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN) 61198937Sdes# define USE_LOGIN 61298937Sdes 61398937Sdes#else 61498937Sdes/* Simply select your favourite login types. */ 61598937Sdes/* Can't do if-else because some systems use several... <sigh> */ 61698937Sdes# if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX) 61798937Sdes# define USE_UTMPX 61898937Sdes# endif 61998937Sdes# if defined(UTMP_FILE) && !defined(DISABLE_UTMP) 62098937Sdes# define USE_UTMP 62198937Sdes# endif 62298937Sdes# if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX) 62398937Sdes# define USE_WTMPX 62498937Sdes# endif 62598937Sdes# if defined(WTMP_FILE) && !defined(DISABLE_WTMP) 62698937Sdes# define USE_WTMP 62798937Sdes# endif 62898937Sdes 62998937Sdes#endif 63098937Sdes 631128456Sdes#ifndef UT_LINESIZE 632128456Sdes# define UT_LINESIZE 8 633128456Sdes#endif 634128456Sdes 63598937Sdes/* I hope that the presence of LASTLOG_FILE is enough to detect this */ 63698937Sdes#if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG) 63798937Sdes# define USE_LASTLOG 63898937Sdes#endif 63998937Sdes 640128456Sdes#ifdef HAVE_OSF_SIA 641128456Sdes# ifdef USE_SHADOW 642128456Sdes# undef USE_SHADOW 643128456Sdes# endif 644128456Sdes# define CUSTOM_SYS_AUTH_PASSWD 1 645128456Sdes#endif 646128456Sdes 64798937Sdes/** end of login recorder definitions */ 64898937Sdes 64998937Sdes#endif /* _DEFINES_H */ 650