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