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