1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
$NetBSD: patch-ab,v 1.2 2014/05/10 09:53:43 obache Exp $
--- include/netdb.h.orig Thu Feb 28 05:34:17 2008
+++ include/netdb.h
@@ -262,7 +262,7 @@ struct addrinfo {
#ifdef _REENTRANT
-#if defined (__hpux) || defined(__osf__) || defined(_AIX)
+#if defined (__hpux) || defined(__osf__) || defined(_AIX) || defined(__OpenBSD__)
#define _MAXALIASES 35
#define _MAXLINELEN 1024
#define _MAXADDRS 35
@@ -328,7 +328,14 @@ struct protoent_data {
#ifdef __hpux
char line[_MAXLINELEN+1];
#endif
+#ifdef __OpenBSD__
+ char **aliases;
+ int maxaliases;
+ int stayopen;
+ char* line;
+#else
char *proto_aliases[_MAXALIASES];
+#endif
#ifdef __osf__
int _proto_stayopen;
int svc_getprotoflag;
@@ -423,19 +430,31 @@ int innetgr __P((const char *, const char *, const ch
#endif
#ifdef _REENTRANT
-#if defined(__hpux) || defined(__osf__) || defined(_AIX)
+#if defined(__hpux) || defined(__osf__) || defined(_AIX) || defined(__OpenBSD__)
+#if defined(__OpenBSD__)
+struct hostent * gethostbyaddr_r __P((const char *, int, int, struct hostent *,
+ char *, int, int *));
+struct hostent * gethostbyname_r __P((const char *, struct hostent *,
+ char *, int, int *));
+struct hostent * gethostent_r __P((struct hostent *, char *, int, int *));
+#else
int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
struct hostent_data *));
int gethostbyname_r __P((const char *, struct hostent *,
struct hostent_data *));
int gethostent_r __P((struct hostent *, struct hostent_data *));
+#endif
#if defined(_AIX)
void sethostent_r __P((int, struct hostent_data *));
+#elif defined(__OpenBSD__)
+void sethostent_r __P((int));
#else
int sethostent_r __P((int, struct hostent_data *));
#endif
#if defined(__hpux)
int endhostent_r __P((struct hostent_data *));
+#elif defined(__OpenBSD__)
+void endhostent_r __P((void));
#else
void endhostent_r __P((struct hostent_data *));
#endif
@@ -443,16 +462,28 @@ void endhostent_r __P((struct hostent_data *));
#if defined(__hpux) || defined(__osf__)
int getnetbyaddr_r __P((int, int,
struct netent *, struct netent_data *));
+#elif defined(__OpenBSD__)
+struct netent * getnetbyaddr_r __P((long, int,
+ struct netent *, char *, int));
#else
int getnetbyaddr_r __P((long, int,
struct netent *, struct netent_data *));
#endif
+#if defined(__OpenBSD__)
+struct netent * getnetbyname_r __P((const char *,
+ struct netent *, char *, int));
+struct netent * getnetent_r __P((struct netent *, char *, int));
+void setnetent_r __P((int));
+#else
int getnetbyname_r __P((const char *,
struct netent *, struct netent_data *));
int getnetent_r __P((struct netent *, struct netent_data *));
int setnetent_r __P((int, struct netent_data *));
+#endif
#ifdef __hpux
int endnetent_r __P((struct netent_data *buffer));
+#elif defined(__OpenBSD__)
+void endnetent_r __P((void));
#else
void endnetent_r __P((struct netent_data *buffer));
#endif
@@ -462,7 +493,11 @@ int getprotobyname_r __P((const char *,
int getprotobynumber_r __P((int,
struct protoent *, struct protoent_data *));
int getprotoent_r __P((struct protoent *, struct protoent_data *));
+#ifdef __OpenBSD__
+void setprotoent_r __P((int, struct protoent_data *));
+#else
int setprotoent_r __P((int, struct protoent_data *));
+#endif
#ifdef __hpux
int endprotoent_r __P((struct protoent_data *));
#else
@@ -492,7 +527,7 @@ int innetgr_r __P((const char *, const char *, const
#endif
#else
/* defined(sun) || defined(bsdi) */
-#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
+#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103) || defined(__DragonFly__)
int gethostbyaddr_r __P((const char *, int, int, struct hostent *,
char *, size_t, struct hostent **, int *));
int gethostbyname_r __P((const char *, struct hostent *,
@@ -509,7 +544,7 @@ struct hostent *gethostent_r __P((struct hostent *, ch
void sethostent_r __P((int));
void endhostent_r __P((void));
-#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
+#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103) || defined(__DragonFly__)
int getnetbyname_r __P((const char *, struct netent *,
char *, size_t, struct netent **, int*));
int getnetbyaddr_r __P((unsigned long int, int, struct netent *,
@@ -525,7 +560,7 @@ struct netent *getnetent_r __P((struct netent *, char
void setnetent_r __P((int));
void endnetent_r __P((void));
-#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
+#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103) || defined(__DragonFly__)
int getprotobyname_r __P((const char *, struct protoent *, char *,
size_t, struct protoent **));
int getprotobynumber_r __P((int, struct protoent *, char *, size_t,
@@ -541,7 +576,7 @@ struct protoent *getprotoent_r __P((struct protoent *,
void setprotoent_r __P((int));
void endprotoent_r __P((void));
-#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103)
+#if defined(__GLIBC__) || defined(__FreeBSD__) && (__FreeBSD_version + 0 >= 601103) || defined(__DragonFly__)
int getservbyname_r __P((const char *name, const char *,
struct servent *, char *, size_t, struct servent **));
int getservbyport_r __P((int port, const char *,
|