1 |
ab11 |
1.1 |
#ifdef HAVE_BUILTIN_H |
2 |
|
|
# include <builtin.h> |
3 |
|
|
#endif |
4 |
|
|
|
5 |
|
|
EXTERN_C_BEGIN |
6 |
|
|
#ifdef HAVE_STRING_H |
7 |
|
|
# include <string.h> |
8 |
|
|
#else |
9 |
|
|
# ifdef HAVE_MEMORY_H |
10 |
|
|
# include <memory.h> |
11 |
|
|
# endif |
12 |
|
|
#endif |
13 |
|
|
|
14 |
|
|
#ifdef _ALL_SOURCE |
15 |
|
|
# define _BSD 44 // AIX |
16 |
|
|
# include <sys/select.h> |
17 |
|
|
# ifndef _POSIX_SOURCE |
18 |
|
|
# define _POSIX_SOURCE |
19 |
|
|
# endif |
20 |
|
|
# undef _ALL_SOURCE |
21 |
|
|
#endif |
22 |
|
|
|
23 |
|
|
#include <sys/types.h> |
24 |
|
|
#ifdef HAVE_SYS_WAIT |
25 |
|
|
# include <sys/wait.h> |
26 |
|
|
#endif |
27 |
|
|
#include <sys/signal.h> |
28 |
|
|
#include <netinet/in.h> |
29 |
|
|
|
30 |
|
|
#ifndef SA_RESTART |
31 |
|
|
# define SA_RESTART 0 |
32 |
|
|
#endif |
33 |
|
|
|
34 |
|
|
EXTERN_C_END |
35 |
|
|
|
36 |
|
|
#if defined (__sun__) && !defined (__svr4__) && defined (_S_LIBGXX) |
37 |
|
|
// libg++-2.6.x has stopped providing prototypes for the following |
38 |
|
|
// for sunos 4.1.x |
39 |
|
|
|
40 |
|
|
extern "C" { |
41 |
|
|
int socketpair (int domain, int typ, int protocol, int* sockpair); |
42 |
|
|
int socket (int domain, int typ, int protocol); |
43 |
|
|
int bind (int sock, void* addr, int addrlen); |
44 |
|
|
int connect (int sock, void* addr, int addrlen); |
45 |
|
|
int listen (int sock, int num); |
46 |
|
|
int accept (int sock, void* addr, int* addrlen); |
47 |
|
|
|
48 |
|
|
int recv (int sock, void* buf, int buflen, int msgflag); |
49 |
|
|
int recvfrom (int sock, void* buf, int buflen, int msgflag, |
50 |
|
|
void* addr, int* addrlen); |
51 |
|
|
int send (int sock, void* buf, int buflen, int msgflag); |
52 |
|
|
int sendto (int sock, void* buf, int buflen, int msgflag, |
53 |
|
|
void* addr, int addrlen); |
54 |
|
|
|
55 |
|
|
int recvmsg (int sock, struct msghdr* msg, int msgflag); |
56 |
|
|
int sendmsg (int sock, struct msghdr* msg, int msgflag); |
57 |
|
|
|
58 |
|
|
int select (int sock, void* rd, void* wr, void* ex, struct timeval* tv); |
59 |
|
|
|
60 |
|
|
int getsockopt (int sock, int level, int option, void* val, int* vallen); |
61 |
|
|
int setsockopt (int sock, int level, int option, void* val, int vallen); |
62 |
|
|
|
63 |
|
|
int getsockname (int sock, void* addr, int* addrlen); |
64 |
|
|
int getpeername (int sock, void* addr, int* addrlen); |
65 |
|
|
} |
66 |
|
|
#endif |
67 |
|
|
|
68 |
|
|
extern "C" int shutdown (int, int); // they have forgotten this |
69 |
|
|
|
70 |
|
|
// <arpa/inet.h> does not have a prototype for inet_addr () and gethostname() |
71 |
|
|
extern "C" unsigned long inet_addr (const char*); |
72 |
|
|
|
73 |
|
|
// arpa/in.h does not provide a protype for the following |
74 |
|
|
extern "C" char* inet_ntoa (in_addr ina); |
75 |
|
|
|
76 |
|
|
#if !defined (__linux__) |
77 |
|
|
extern "C" int gethostname (char* hostname, int len); |
78 |
|
|
extern char* SYS_SIGLIST []; |
79 |
|
|
#endif |
80 |
|
|
|
81 |
|
|
#ifdef __osf__ |
82 |
|
|
extern "C" { |
83 |
|
|
int select (int, fd_set*, fd_set*, fd_set*, timeval*); |
84 |
|
|
unsigned short ntohs (unsigned short); |
85 |
|
|
unsigned short htons (unsigned short); |
86 |
|
|
unsigned long ntohl (unsigned long); |
87 |
|
|
unsigned long htonl (unsigned long); |
88 |
|
|
} |
89 |
|
|
#endif |
90 |
|
|
|
91 |
|
|
typedef RETSIGTYPE (*funcptr) (...); |