4 /* Necessary headers */
6 #include <sys/types.h> /* For [u]intxx_t */
8 #include <sys/socket.h> /* For SHUT_XXXX */
10 # include <netinet/in_systm.h> /* For typedefs */
11 #include <netinet/in.h> /* For IPv6 macros */
12 #include <netinet/ip.h> /* For IPTOS macros */
14 #ifdef HAVE_SYS_BITYPES_H
15 # include <sys/bitypes.h> /* For u_intXX_t */
19 # include <paths.h> /* For _PATH_XXX */
23 # include <utmp.h> /* For _PATH_XXX */
26 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
27 # include <utmpx.h> /* For _PATH_XXX */
30 #ifdef HAVE_SYS_TIME_H
31 # include <sys/time.h> /* For timersub */
34 #ifdef HAVE_MAILLOCK_H
35 # include <maillock.h> /* For _PATH_MAILDIR */
38 #ifdef HAVE_SYS_CDEFS_H
39 # include <sys/cdefs.h> /* For __P() */
42 #ifdef HAVE_SYS_SYSMACROS_H
43 # include <sys/sysmacros.h> /* For MIN, MAX, etc */
51 SHUT_RD = 0, /* No more receptions. */
52 SHUT_WR, /* No more transmissions. */
53 SHUT_RDWR /* No more receptions or transmissions. */
55 # define SHUT_RD SHUT_RD
56 # define SHUT_WR SHUT_WR
57 # define SHUT_RDWR SHUT_RDWR
60 #ifndef IPTOS_LOWDELAY
61 # define IPTOS_LOWDELAY 0x10
62 # define IPTOS_THROUGHPUT 0x08
63 # define IPTOS_RELIABILITY 0x04
64 # define IPTOS_LOWCOST 0x02
65 # define IPTOS_MINCOST IPTOS_LOWCOST
66 #endif /* IPTOS_LOWDELAY */
70 /* If sys/types.h does not supply intXX_t, supply them ourselves */
73 # if (SIZEOF_CHAR == 1)
76 # error "8 bit int type not found."
78 # if (SIZEOF_SHORT_INT == 2)
79 typedef short int int16_t;
81 # error "16 bit int type not found."
83 # if (SIZEOF_INT == 4)
86 # error "32 bit int type not found."
89 # if (SIZEOF_LONG_INT == 8)
90 typedef long int int64_t;
92 # if (SIZEOF_LONG_LONG_INT == 8)
93 typedef long long int int64_t;
94 # define HAVE_INTXX_T 1
96 # error "64 bit int type not found."
102 /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
103 #ifndef HAVE_U_INTXX_T
104 # ifdef HAVE_UINTXX_T
105 typedef uint8_t u_int8_t;
106 typedef uint16_t u_int16_t;
107 typedef uint32_t u_int32_t;
109 typedef uint64_t u_int64_t;
111 # define HAVE_U_INTXX_T 1
113 # if (SIZEOF_CHAR == 1)
114 typedef unsigned char u_int8_t;
116 # error "8 bit int type not found."
118 # if (SIZEOF_SHORT_INT == 2)
119 typedef unsigned short int u_int16_t;
121 # error "16 bit int type not found."
123 # if (SIZEOF_INT == 4)
124 typedef unsigned int u_int32_t;
126 # error "32 bit int type not found."
129 # if (SIZEOF_LONG_INT == 8)
130 typedef unsigned long int u_int64_t;
132 # if (SIZEOF_LONG_LONG_INT == 8)
133 typedef unsigned long long int u_int64_t;
134 # define HAVE_U_INTXX_T 1
136 # error "64 bit int type not found."
143 #ifndef HAVE_SOCKLEN_T
144 typedef unsigned int socklen_t;
145 # define HAVE_SOCKLEN_T
146 #endif /* HAVE_SOCKLEN_T */
149 typedef unsigned int size_t;
151 #endif /* HAVE_SIZE_T */
153 #if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
154 # define ss_family __ss_family
155 #endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
159 /* If _PATH_LASTLOG is not defined by system headers, set it to the */
160 /* lastlog file detected by autoconf */
161 #ifndef _PATH_LASTLOG
162 # ifdef LASTLOG_LOCATION
163 # define _PATH_LASTLOG LASTLOG_LOCATION
169 # define _PATH_UTMP UTMP_FILE
171 # define _PATH_UTMP "/var/adm/utmp"
177 # define _PATH_WTMP WTMP_FILE
179 # define _PATH_WTMP "/var/adm/wtmp"
183 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
186 # define _PATH_UTMPX UTMPX_FILE
188 # define _PATH_UTMPX "/var/adm/utmpx"
193 # define _PATH_WTMPX WTMPX_FILE
195 # define _PATH_WTMPX "/var/adm/wtmp"
201 # define _PATH_BSHELL "/bin/sh"
205 # ifdef _PATH_STDPATH
206 # undef _PATH_STDPATH
208 # define _PATH_STDPATH USER_PATH
211 #ifndef _PATH_STDPATH
212 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
215 #ifndef _PATH_DEVNULL
216 # define _PATH_DEVNULL "/dev/null"
220 # define MAILDIR MAIL_DIRECTORY
223 #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
224 # define _PATH_MAILDIR MAILDIR
225 #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
229 # define _PATH_RSH RSH_PATH
230 # endif /* RSH_PATH */
231 #endif /* _PATH_RSH */
236 # define MAX(a,b) (((a)>(b))?(a):(b))
237 # define MIN(a,b) (((a)<(b))?(a):(b))
241 #define timersub(a, b, result) \
243 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
244 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
245 if ((result)->tv_usec < 0) { \
246 --(result)->tv_sec; \
247 (result)->tv_usec += 1000000; \
256 #if !defined(IN6_IS_ADDR_V4MAPPED)
257 # define IN6_IS_ADDR_V4MAPPED(a) \
258 ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
259 (((u_int32_t *) (a))[2] == htonl (0xffff)))
260 #endif /* !defined(IN6_IS_ADDR_V4MAPPED) */
262 #if !defined(__GNUC__) || (__GNUC__ < 2)
263 # define __attribute__(x)
264 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
266 #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
268 #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
270 /* Function replacement / compatibility hacks */
272 /* In older versions of libpam, pam_strerror takes a single argument */
274 # define PAM_STRERROR(a,b) pam_strerror((b))
276 # define PAM_STRERROR(a,b) pam_strerror((a),(b))
279 #if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
280 # undef HAVE_GETADDRINFO
281 #endif /* defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO) */
283 #endif /* _DEFINES_H */