diff options
Diffstat (limited to 'defines.h')
-rw-r--r-- | defines.h | 74 |
1 files changed, 45 insertions, 29 deletions
@@ -1,3 +1,5 @@ | |||
1 | /* Necessary headers */ | ||
2 | |||
1 | #include <sys/types.h> /* For u_intXX_t */ | 3 | #include <sys/types.h> /* For u_intXX_t */ |
2 | #include <sys/socket.h> /* For SHUT_XXXX */ | 4 | #include <sys/socket.h> /* For SHUT_XXXX */ |
3 | 5 | ||
@@ -25,6 +27,8 @@ | |||
25 | # include <sys/cdefs.h> /* For __P() */ | 27 | # include <sys/cdefs.h> /* For __P() */ |
26 | #endif | 28 | #endif |
27 | 29 | ||
30 | /* Constants */ | ||
31 | |||
28 | #ifndef SHUT_RDWR | 32 | #ifndef SHUT_RDWR |
29 | enum | 33 | enum |
30 | { | 34 | { |
@@ -37,24 +41,26 @@ enum | |||
37 | # define SHUT_RDWR SHUT_RDWR | 41 | # define SHUT_RDWR SHUT_RDWR |
38 | #endif | 42 | #endif |
39 | 43 | ||
44 | /* Types */ | ||
45 | |||
40 | /* If sys/types.h does not supply intXX_t, supply them ourselves */ | 46 | /* If sys/types.h does not supply intXX_t, supply them ourselves */ |
41 | /* (or die trying) */ | 47 | /* (or die trying) */ |
42 | #ifndef HAVE_INTXX_T | 48 | #ifndef HAVE_INTXX_T |
43 | # if (SIZEOF_SHORT_INT == 2) | 49 | # if (SIZEOF_SHORT_INT == 2) |
44 | # define int16_t short int | 50 | typedef short int int16_t; |
45 | # else | 51 | # else |
46 | # error "16 bit int type not found." | 52 | # error "16 bit int type not found." |
47 | # endif | 53 | # endif |
48 | # if (SIZEOF_INT == 4) | 54 | # if (SIZEOF_INT == 4) |
49 | # define int32_t int | 55 | typedef int int32_t; |
50 | # else | 56 | # else |
51 | # error "32 bit int type not found." | 57 | # error "32 bit int type not found." |
52 | # endif | 58 | # endif |
53 | # if (SIZEOF_LONG_INT == 8) | 59 | # if (SIZEOF_LONG_INT == 8) |
54 | # define int64_t long int | 60 | typedef long int int64_t; |
55 | # else | 61 | # else |
56 | # if (SIZEOF_LONG_LONG_INT == 8) | 62 | # if (SIZEOF_LONG_LONG_INT == 8) |
57 | # define int64_t long long int | 63 | typedef long long int int64_t; |
58 | # else | 64 | # else |
59 | # error "64 bit int type not found." | 65 | # error "64 bit int type not found." |
60 | # endif | 66 | # endif |
@@ -64,25 +70,25 @@ enum | |||
64 | /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ | 70 | /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ |
65 | #ifndef HAVE_U_INTXX_T | 71 | #ifndef HAVE_U_INTXX_T |
66 | # ifdef HAVE_UINTXX_T | 72 | # ifdef HAVE_UINTXX_T |
67 | # define u_int16_t uint16_t | 73 | typedef uint16_t u_int16_t; |
68 | # define u_int32_t uint32_t | 74 | typedef uint32_t u_int32_t; |
69 | # define u_int64_t uint64_t | 75 | typedef uint64_t u_int64_t; |
70 | # else | 76 | # else |
71 | # if (SIZEOF_SHORT_INT == 2) | 77 | # if (SIZEOF_SHORT_INT == 2) |
72 | # define u_int16_t unsigned short int | 78 | typedef unsigned short int u_int16_t; |
73 | # else | 79 | # else |
74 | # error "16 bit int type not found." | 80 | # error "16 bit int type not found." |
75 | # endif | 81 | # endif |
76 | # if (SIZEOF_INT == 4) | 82 | # if (SIZEOF_INT == 4) |
77 | # define u_int32_t unsigned int | 83 | typedef unsigned int u_int32_t; |
78 | # else | 84 | # else |
79 | # error "32 bit int type not found." | 85 | # error "32 bit int type not found." |
80 | # endif | 86 | # endif |
81 | # if (SIZEOF_LONG_INT == 8) | 87 | # if (SIZEOF_LONG_INT == 8) |
82 | # define u_int64_t unsigned long int | 88 | typedef unsigned long int u_int64_t; |
83 | # else | 89 | # else |
84 | # if (SIZEOF_LONG_LONG_INT == 8) | 90 | # if (SIZEOF_LONG_LONG_INT == 8) |
85 | # define u_int64_t unsigned long long int | 91 | typedef unsigned long long int u_int64_t; |
86 | # else | 92 | # else |
87 | # error "64 bit int type not found." | 93 | # error "64 bit int type not found." |
88 | # endif | 94 | # endif |
@@ -93,9 +99,15 @@ enum | |||
93 | /* If quad_t is not supplied, then supply it now. We can rely on int64_t */ | 99 | /* If quad_t is not supplied, then supply it now. We can rely on int64_t */ |
94 | /* being defined by the above */ | 100 | /* being defined by the above */ |
95 | #ifndef HAVE_QUAD_T | 101 | #ifndef HAVE_QUAD_T |
96 | # define quad_t int64_t | 102 | typedef int64_t quad_t; |
97 | #endif | 103 | #endif |
98 | 104 | ||
105 | #ifndef HAVE_SOCKLEN_T | ||
106 | typedef unsigned int socklen_t; | ||
107 | #endif /* HAVE_SOCKLEN_T */ | ||
108 | |||
109 | /* Paths */ | ||
110 | |||
99 | /* If _PATH_LASTLOG is not defined by system headers, set it to the */ | 111 | /* If _PATH_LASTLOG is not defined by system headers, set it to the */ |
100 | /* lastlog file detected by autoconf */ | 112 | /* lastlog file detected by autoconf */ |
101 | #ifndef _PATH_LASTLOG | 113 | #ifndef _PATH_LASTLOG |
@@ -164,6 +176,14 @@ enum | |||
164 | # define _PATH_MAILDIR MAILDIR | 176 | # define _PATH_MAILDIR MAILDIR |
165 | #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ | 177 | #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ |
166 | 178 | ||
179 | #ifndef _PATH_RSH | ||
180 | # ifdef RSH_PATH | ||
181 | # define _PATH_RSH RSH_PATH | ||
182 | # endif /* RSH_PATH */ | ||
183 | #endif /* _PATH_RSH */ | ||
184 | |||
185 | /* Macros */ | ||
186 | |||
167 | #ifndef MAX | 187 | #ifndef MAX |
168 | # define MAX(a,b) (((a)>(b))?(a):(b)) | 188 | # define MAX(a,b) (((a)>(b))?(a):(b)) |
169 | # define MIN(a,b) (((a)<(b))?(a):(b)) | 189 | # define MIN(a,b) (((a)<(b))?(a):(b)) |
@@ -181,13 +201,6 @@ enum | |||
181 | } while (0) | 201 | } while (0) |
182 | #endif | 202 | #endif |
183 | 203 | ||
184 | /* In older versions of libpam, pam_strerror takes a single argument */ | ||
185 | #ifdef HAVE_OLD_PAM | ||
186 | # define PAM_STRERROR(a,b) pam_strerror((b)) | ||
187 | #else | ||
188 | # define PAM_STRERROR(a,b) pam_strerror((a),(b)) | ||
189 | #endif | ||
190 | |||
191 | #ifndef __P | 204 | #ifndef __P |
192 | # define __P(x) x | 205 | # define __P(x) x |
193 | #endif | 206 | #endif |
@@ -196,6 +209,19 @@ enum | |||
196 | # define __attribute__(x) | 209 | # define __attribute__(x) |
197 | #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ | 210 | #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ |
198 | 211 | ||
212 | #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) | ||
213 | # define USE_PAM | ||
214 | #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */ | ||
215 | |||
216 | /* Function replacement / compatibility hacks */ | ||
217 | |||
218 | /* In older versions of libpam, pam_strerror takes a single argument */ | ||
219 | #ifdef HAVE_OLD_PAM | ||
220 | # define PAM_STRERROR(a,b) pam_strerror((b)) | ||
221 | #else | ||
222 | # define PAM_STRERROR(a,b) pam_strerror((a),(b)) | ||
223 | #endif | ||
224 | |||
199 | #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) | 225 | #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) |
200 | # define seteuid(a) setreuid(-1,a) | 226 | # define seteuid(a) setreuid(-1,a) |
201 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ | 227 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ |
@@ -204,13 +230,3 @@ enum | |||
204 | # define innetgr(a,b,c,d) (0) | 230 | # define innetgr(a,b,c,d) (0) |
205 | #endif /* HAVE_INNETGR */ | 231 | #endif /* HAVE_INNETGR */ |
206 | 232 | ||
207 | #ifndef _PATH_RSH | ||
208 | # ifdef RSH_PATH | ||
209 | # define _PATH_RSH RSH_PATH | ||
210 | # endif /* RSH_PATH */ | ||
211 | #endif /* _PATH_RSH */ | ||
212 | |||
213 | #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) | ||
214 | # define USE_PAM | ||
215 | #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */ | ||
216 | |||