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