]> andersk Git - openssh.git/blame - defines.h
- Doc updates
[openssh.git] / defines.h
CommitLineData
76a8e733 1#ifndef _DEFINES_H
2#define _DEFINES_H
3
ea1970a3 4/* Necessary headers */
5
5cdfe03f 6#include <sys/types.h>
cb807f40 7#include <sys/socket.h> /* For SHUT_XXXX */
8
5cdfe03f 9#ifdef HAVE_SYS_BITYPES_H
10# include <sys/bitypes.h> /* For u_intXX_t */
11#endif
12
cb807f40 13#ifdef HAVE_PATHS_H
14# include <paths.h> /* For _PATH_XXX */
15#endif
16
17#ifdef HAVE_UTMP_H
18# include <utmp.h> /* For _PATH_XXX */
19#endif
20
21#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
22# include <utmpx.h> /* For _PATH_XXX */
23#endif
24
25#ifdef HAVE_SYS_TIME_H
26# include <sys/time.h> /* For timersub */
27#endif
28
29#ifdef HAVE_MAILLOCK_H
d94aa2ae 30# include <maillock.h> /* For _PATH_MAILDIR */
cb807f40 31#endif
32
d94aa2ae 33#ifdef HAVE_SYS_CDEFS_H
34# include <sys/cdefs.h> /* For __P() */
35#endif
36
ea1970a3 37/* Constants */
38
cb807f40 39#ifndef SHUT_RDWR
40enum
41{
42 SHUT_RD = 0, /* No more receptions. */
43 SHUT_WR, /* No more transmissions. */
44 SHUT_RDWR /* No more receptions or transmissions. */
45};
46# define SHUT_RD SHUT_RD
47# define SHUT_WR SHUT_WR
48# define SHUT_RDWR SHUT_RDWR
49#endif
50
ea1970a3 51/* Types */
52
cb807f40 53/* If sys/types.h does not supply intXX_t, supply them ourselves */
54/* (or die trying) */
55#ifndef HAVE_INTXX_T
976f7e19 56# if (SIZEOF_CHAR == 1)
57typedef char int8_t;
58# else
59# error "8 bit int type not found."
60# endif
cb807f40 61# if (SIZEOF_SHORT_INT == 2)
ea1970a3 62typedef short int int16_t;
cb807f40 63# else
64# error "16 bit int type not found."
65# endif
66# if (SIZEOF_INT == 4)
ea1970a3 67typedef int int32_t;
cb807f40 68# else
69# error "32 bit int type not found."
70# endif
71# if (SIZEOF_LONG_INT == 8)
ea1970a3 72typedef long int int64_t;
cb807f40 73# else
74# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 75typedef long long int int64_t;
76a8e733 76# define HAVE_INTXX_T 1
cb807f40 77# else
78# error "64 bit int type not found."
79# endif
80# endif
81#endif
82
83/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
84#ifndef HAVE_U_INTXX_T
85# ifdef HAVE_UINTXX_T
976f7e19 86typedef uint8_t u_int8_t;
ea1970a3 87typedef uint16_t u_int16_t;
88typedef uint32_t u_int32_t;
89typedef uint64_t u_int64_t;
76a8e733 90# define HAVE_U_INTXX_T 1
cb807f40 91# else
976f7e19 92# if (SIZEOF_CHAR == 1)
93typedef unsigned char u_int8_t;
94# else
95# error "8 bit int type not found."
96# endif
cb807f40 97# if (SIZEOF_SHORT_INT == 2)
ea1970a3 98typedef unsigned short int u_int16_t;
cb807f40 99# else
100# error "16 bit int type not found."
101# endif
102# if (SIZEOF_INT == 4)
ea1970a3 103typedef unsigned int u_int32_t;
cb807f40 104# else
105# error "32 bit int type not found."
106# endif
107# if (SIZEOF_LONG_INT == 8)
ea1970a3 108typedef unsigned long int u_int64_t;
cb807f40 109# else
110# if (SIZEOF_LONG_LONG_INT == 8)
ea1970a3 111typedef unsigned long long int u_int64_t;
76a8e733 112# define HAVE_U_INTXX_T 1
cb807f40 113# else
114# error "64 bit int type not found."
115# endif
116# endif
117# endif
118#endif
119
ea1970a3 120#ifndef HAVE_SOCKLEN_T
121typedef unsigned int socklen_t;
a6ddc88b 122# define HAVE_SOCKLEN_T
ea1970a3 123#endif /* HAVE_SOCKLEN_T */
124
e3a93db0 125#ifndef HAVE_SIZE_T
126typedef unsigned int size_t;
a6ddc88b 127# define HAVE_SIZE_T
e3a93db0 128#endif /* HAVE_SIZE_T */
129
48e671d5 130#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
131# define ss_family __ss_family
132#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
133
ea1970a3 134/* Paths */
135
cb807f40 136/* If _PATH_LASTLOG is not defined by system headers, set it to the */
137/* lastlog file detected by autoconf */
138#ifndef _PATH_LASTLOG
139# ifdef LASTLOG_LOCATION
140# define _PATH_LASTLOG LASTLOG_LOCATION
141# endif
142#endif
143
144#ifndef _PATH_UTMP
145# ifdef UTMP_FILE
146# define _PATH_UTMP UTMP_FILE
147# else
148# define _PATH_UTMP "/var/adm/utmp"
149# endif
150#endif
151
152#ifndef _PATH_WTMP
153# ifdef WTMP_FILE
154# define _PATH_WTMP WTMP_FILE
155# else
156# define _PATH_WTMP "/var/adm/wtmp"
157# endif
158#endif
159
160#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
161# ifndef _PATH_UTMPX
162# ifdef UTMPX_FILE
163# define _PATH_UTMPX UTMPX_FILE
164# else
165# define _PATH_UTMPX "/var/adm/utmpx"
166# endif
167# endif
168# ifndef _PATH_WTMPX
169# ifdef WTMPX_FILE
170# define _PATH_WTMPX WTMPX_FILE
171# else
172# define _PATH_WTMPX "/var/adm/wtmp"
173# endif
174# endif
175#endif
176
177#ifndef _PATH_BSHELL
178# define _PATH_BSHELL "/bin/sh"
179#endif
180
181#ifdef USER_PATH
182# ifdef _PATH_STDPATH
183# undef _PATH_STDPATH
184# endif
185# define _PATH_STDPATH USER_PATH
186#endif
187
188#ifndef _PATH_STDPATH
189# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
190#endif
191
192#ifndef _PATH_DEVNULL
193# define _PATH_DEVNULL "/dev/null"
194#endif
195
196#ifndef MAILDIR
197# define MAILDIR MAIL_DIRECTORY
198#endif
199
200#if !defined(_PATH_MAILDIR) && defined(MAILDIR)
201# define _PATH_MAILDIR MAILDIR
202#endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
203
ea1970a3 204#ifndef _PATH_RSH
205# ifdef RSH_PATH
206# define _PATH_RSH RSH_PATH
207# endif /* RSH_PATH */
208#endif /* _PATH_RSH */
209
210/* Macros */
211
cb807f40 212#ifndef MAX
213# define MAX(a,b) (((a)>(b))?(a):(b))
214# define MIN(a,b) (((a)<(b))?(a):(b))
215#endif
216
217#ifndef timersub
218#define timersub(a, b, result) \
219 do { \
220 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
221 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
222 if ((result)->tv_usec < 0) { \
223 --(result)->tv_sec; \
224 (result)->tv_usec += 1000000; \
225 } \
226 } while (0)
227#endif
228
cb807f40 229#ifndef __P
230# define __P(x) x
231#endif
232
233#if !defined(__GNUC__) || (__GNUC__ < 2)
976f7e19 234# define __attribute__(x)
cb807f40 235#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
236
ea1970a3 237#if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
238# define USE_PAM
239#endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
240
241/* Function replacement / compatibility hacks */
242
243/* In older versions of libpam, pam_strerror takes a single argument */
244#ifdef HAVE_OLD_PAM
245# define PAM_STRERROR(a,b) pam_strerror((b))
246#else
247# define PAM_STRERROR(a,b) pam_strerror((a),(b))
248#endif
249
4c8ef3fb 250#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
251# undef HAVE_GETADDRINFO
252#endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
253
76a8e733 254#endif /* _DEFINES_H */
This page took 0.096536 seconds and 5 git commands to generate.