1 #ifdef TIME_WITH_SYS_TIME
2 /* Time with sys/time test */
19 #ifdef HAVE_O_NONBLOCK
21 #include <sys/types.h>
28 /* try to compile O_NONBLOCK */
30 #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
31 # if defined(__SVR4) || defined(__srv4__)
32 # define PLATFORM_SOLARIS
34 # define PLATFORM_SUNOS4
37 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
38 # define PLATFORM_AIX_V3
41 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || (defined(__BEOS__) && !defined(__HAIKU__))
42 #error "O_NONBLOCK does not work on this platform"
45 int flags
= fcntl(socket
, F_SETFL
, flags
| O_NONBLOCK
);
50 #ifdef HAVE_GETHOSTBYADDR_R_5
51 #include <sys/types.h>
61 struct hostent_data hdata
;
63 #ifndef gethostbyaddr_r
64 (void)gethostbyaddr_r
;
66 rc
= gethostbyaddr_r(address
, length
, type
, &h
, &hdata
);
71 #ifdef HAVE_GETHOSTBYADDR_R_5_REENTRANT
73 #include <sys/types.h>
83 struct hostent_data hdata
;
85 #ifndef gethostbyaddr_r
86 (void)gethostbyaddr_r
;
88 rc
= gethostbyaddr_r(address
, length
, type
, &h
, &hdata
);
93 #ifdef HAVE_GETHOSTBYADDR_R_7
94 #include <sys/types.h>
108 #ifndef gethostbyaddr_r
109 (void)gethostbyaddr_r
;
111 hp
= gethostbyaddr_r(address
, length
, type
, &h
,
112 buffer
, 8192, &h_errnop
);
117 #ifdef HAVE_GETHOSTBYADDR_R_7_REENTRANT
119 #include <sys/types.h>
133 #ifndef gethostbyaddr_r
134 (void)gethostbyaddr_r
;
136 hp
= gethostbyaddr_r(address
, length
, type
, &h
,
137 buffer
, 8192, &h_errnop
);
142 #ifdef HAVE_GETHOSTBYADDR_R_8
143 #include <sys/types.h>
158 #ifndef gethostbyaddr_r
159 (void)gethostbyaddr_r
;
161 rc
= gethostbyaddr_r(address
, length
, type
, &h
,
162 buffer
, 8192, &hp
, &h_errnop
);
167 #ifdef HAVE_GETHOSTBYADDR_R_8_REENTRANT
169 #include <sys/types.h>
184 #ifndef gethostbyaddr_r
185 (void)gethostbyaddr_r
;
187 rc
= gethostbyaddr_r(address
, length
, type
, &h
,
188 buffer
, 8192, &hp
, &h_errnop
);
193 #ifdef HAVE_GETHOSTBYNAME_R_3
195 #include <sys/types.h>
198 #define NULL (void *)0
204 struct hostent_data data
;
205 #ifndef gethostbyname_r
206 (void)gethostbyname_r
;
208 gethostbyname_r(NULL
, NULL
, NULL
);
213 #ifdef HAVE_GETHOSTBYNAME_R_3_REENTRANT
216 #include <sys/types.h>
219 #define NULL (void *)0
225 struct hostent_data data
;
226 #ifndef gethostbyname_r
227 (void)gethostbyname_r
;
229 gethostbyname_r(NULL
, NULL
, NULL
);
234 #ifdef HAVE_GETHOSTBYNAME_R_5
235 #include <sys/types.h>
236 #include <netinet/in.h>
239 #define NULL (void *)0
244 #ifndef gethostbyname_r
245 (void)gethostbyname_r
;
247 gethostbyname_r(NULL
, NULL
, NULL
, 0, NULL
);
252 #ifdef HAVE_GETHOSTBYNAME_R_5_REENTRANT
254 #include <sys/types.h>
257 #define NULL (void *)0
263 #ifndef gethostbyname_r
264 (void)gethostbyname_r
;
266 gethostbyname_r(NULL
, NULL
, NULL
, 0, NULL
);
271 #ifdef HAVE_GETHOSTBYNAME_R_6
272 #include <sys/types.h>
275 #define NULL (void *)0
281 #ifndef gethostbyname_r
282 (void)gethostbyname_r
;
284 gethostbyname_r(NULL
, NULL
, NULL
, 0, NULL
, NULL
);
289 #ifdef HAVE_GETHOSTBYNAME_R_6_REENTRANT
291 #include <sys/types.h>
294 #define NULL (void *)0
300 #ifndef gethostbyname_r
301 (void)gethostbyname_r
;
303 gethostbyname_r(NULL
, NULL
, NULL
, 0, NULL
, NULL
);
308 #ifdef HAVE_SOCKLEN_T
310 #include <ws2tcpip.h>
312 #include <sys/types.h>
313 #include <sys/socket.h>
320 if (sizeof (socklen_t
))
326 #ifdef HAVE_IN_ADDR_T
327 #include <sys/types.h>
328 #include <sys/socket.h>
329 #include <arpa/inet.h>
336 if (sizeof (in_addr_t
))
347 int main() { return 0; }
349 #ifdef RETSIGTYPE_TEST
350 #include <sys/types.h>
356 extern "C" void (*signal (int, void (*)(int)))(int);
358 void (*signal ()) ();
367 #ifdef HAVE_INET_NTOA_R_DECL
368 #include <arpa/inet.h>
370 typedef void (*func_type
)();
376 func
= (func_type
)inet_ntoa_r
;
381 #ifdef HAVE_INET_NTOA_R_DECL_REENTRANT
383 #include <arpa/inet.h>
385 typedef void (*func_type
)();
391 func
= (func_type
)&inet_ntoa_r
;
396 #ifdef HAVE_GETADDRINFO
398 #include <sys/types.h>
399 #include <sys/socket.h>
402 struct addrinfo hints
, *ai
;
405 memset(&hints
, 0, sizeof(hints
));
406 hints
.ai_family
= AF_UNSPEC
;
407 hints
.ai_socktype
= SOCK_STREAM
;
411 error
= getaddrinfo("127.0.0.1", "8080", &hints
, &ai
);
418 #ifdef HAVE_FILE_OFFSET_BITS
419 #ifdef _FILE_OFFSET_BITS
420 #undef _FILE_OFFSET_BITS
422 #define _FILE_OFFSET_BITS 64
423 #include <sys/types.h>
424 /* Check that off_t can represent 2**63 - 1 correctly.
425 We can't simply define LARGE_OFF_T to be 9223372036854775807,
426 since some C++ compilers masquerading as C compilers
427 incorrectly reject 9223372036854775807. */
428 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
429 int off_t_is_large
[(LARGE_OFF_T
% 2147483629 == 721
430 && LARGE_OFF_T
% 2147483647 == 1)
432 int main () { ; return 0; }
434 #ifdef HAVE_IOCTLSOCKET
441 /* ioctlsocket source code */
443 unsigned long flags
= ioctlsocket(socket
, FIONBIO
, &flags
);
450 #ifdef HAVE_IOCTLSOCKET_CASE
457 /* IoctlSocket source code */
459 int flags
= IoctlSocket(socket
, FIONBIO
, (long)1);
466 /* headers for FIONBIO test */
474 /* FIONBIO source test (old-style unix) */
476 int flags
= ioctl(socket
, FIONBIO
, &flags
);
482 #ifdef HAVE_SO_NONBLOCK
484 /* headers for SO_NONBLOCK test (BeOS) */
485 #include <sys/types.h>
491 /* SO_NONBLOCK source code */
494 int flags
= setsockopt(socket
, SOL_SOCKET
, SO_NONBLOCK
, &b
, sizeof(b
));
498 #ifdef HAVE_GLIBC_STRERROR_R
503 char buffer
[1024]; /* big enough to play with */
505 strerror_r(EACCES
, buffer
, sizeof(buffer
));
506 /* this should've returned a string */
507 if(!string
|| !string
[0])
512 #ifdef HAVE_POSIX_STRERROR_R
517 char buffer
[1024]; /* big enough to play with */
519 strerror_r(EACCES
, buffer
, sizeof(buffer
));
520 /* This should've returned zero, and written an error string in the
522 if(!buffer
[0] || error
)