Check-in [d02d27b490]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:haiku tweaks in libwebsockets
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d02d27b4909cae83d2b213625a8c8c6d34338659
User & Date: chw 2019-09-12 05:49:48
Context
2019-09-12
05:51
support --enable-video-jsmpeg in SDL2 on haiku check-in: 7aceb25c1b user: chw tags: trunk
05:49
haiku tweaks in libwebsockets check-in: d02d27b490 user: chw tags: trunk
2019-09-11
16:13
add tcl upstream changes check-in: 30c24a65a0 user: chw tags: trunk
Changes

Changes to undroid/libwebsockets/lib/getifaddrs.c.

56
57
58
59
60
61
62



63
64
65
66
67
68
69
...
106
107
108
109
110
111
112

113

114
115
116
117
118
119
120
...
175
176
177
178
179
180
181


182
183
184
185
186
187
188
...
255
256
257
258
259
260
261


262

263
264
265
266

267
268
269
270
271
272

#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif

#include "getifaddrs.h"




static int
getifaddrs2(struct ifaddrs **ifap, int af, int siocgifconf, int siocgifflags,
	    size_t ifreq_sz)
{
	int ret;
	int fd;
	size_t buf_size;
................................................................................

		if (ifconf.ifc_len < (int)buf_size)
			break;
		lws_free(buf);
		buf_size *= 2;
	}


	for (p = ifconf.ifc_buf; p < ifconf.ifc_buf + ifconf.ifc_len; p += sz) {

		struct ifreq ifreq;
		struct sockaddr *sa;
		size_t salen;

		ifr = (struct ifreq *)p;
		sa  = &ifr->ifr_addr;

................................................................................
error_out:
	close(fd);
	lws_free(buf);
	errno = ret;

	return -1;
}



int
getifaddrs(struct ifaddrs **ifap)
{
	int ret = -1;
	errno = ENXIO;
#if defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)
................................................................................
		printf("  %p\n", p->ifa_data);
	}
}

int
main()
{


	struct ifaddrs *a = NULL, *b;

	getifaddrs2(&a, AF_INET, SIOCGIFCONF, SIOCGIFFLAGS,
		    sizeof(struct ifreq));
	print_ifaddrs(a);
	printf("---\n");

	getifaddrs(&b);
	print_ifaddrs(b);
	return 0;
}
#endif
#endif







>
>
>







 







>
|
>







 







>
>







 







>
>
|
>




>






56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif

#include "getifaddrs.h"

#if (defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)) || \
    (defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS))

static int
getifaddrs2(struct ifaddrs **ifap, int af, int siocgifconf, int siocgifflags,
	    size_t ifreq_sz)
{
	int ret;
	int fd;
	size_t buf_size;
................................................................................

		if (ifconf.ifc_len < (int)buf_size)
			break;
		lws_free(buf);
		buf_size *= 2;
	}

	for (p = ifconf.ifc_buf;
	     p < (char *) ifconf.ifc_buf + ifconf.ifc_len;
	     p += sz) {
		struct ifreq ifreq;
		struct sockaddr *sa;
		size_t salen;

		ifr = (struct ifreq *)p;
		sa  = &ifr->ifr_addr;

................................................................................
error_out:
	close(fd);
	lws_free(buf);
	errno = ret;

	return -1;
}

#endif

int
getifaddrs(struct ifaddrs **ifap)
{
	int ret = -1;
	errno = ENXIO;
#if defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)
................................................................................
		printf("  %p\n", p->ifa_data);
	}
}

int
main()
{
	struct *b;
#if defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS)
	struct ifaddrs *a = NULL;

	getifaddrs2(&a, AF_INET, SIOCGIFCONF, SIOCGIFFLAGS,
		    sizeof(struct ifreq));
	print_ifaddrs(a);
	printf("---\n");
#endif
	getifaddrs(&b);
	print_ifaddrs(b);
	return 0;
}
#endif
#endif

Changes to undroid/libwebsockets/lib/lws-plat-unix.c.

225
226
227
228
229
230
231

232
233
234
235
236
237

238
239
240
241
242

243
244
245
246

247
248
249
250
251
252
253
254
255



256
257
258
259
260
261
262
        defined(__CYGWIN__) || defined(__OpenBSD__)

		/*
		 * didn't find a way to set these per-socket, need to
		 * tune kernel systemwide values
		 */
#else

		/* set the keepalive conditions we want on it too */
		optval = vhost->ka_time;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
			       (const void *)&optval, optlen) < 0)
			return 1;


		optval = vhost->ka_interval;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,
			       (const void *)&optval, optlen) < 0)
			return 1;


		optval = vhost->ka_probes;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT,
			       (const void *)&optval, optlen) < 0)
			return 1;

#endif
	}

	/* Disable Nagle */
	optval = 1;
#if !defined(__APPLE__) && \
    !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
    !defined(__NetBSD__) && \
    !defined(__OpenBSD__)



	if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
		return 1;
#else
	tcp_proto = getprotobyname("TCP");
	if (setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, &optval, optlen) < 0)
		return 1;
#endif







>





|
>




|
>




>









>
>
>







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
        defined(__CYGWIN__) || defined(__OpenBSD__)

		/*
		 * didn't find a way to set these per-socket, need to
		 * tune kernel systemwide values
		 */
#else
#ifdef TCP_KEEPIDLE
		/* set the keepalive conditions we want on it too */
		optval = vhost->ka_time;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,
			       (const void *)&optval, optlen) < 0)
			return 1;
#endif
#ifdef TCP_KEEPINTVL
		optval = vhost->ka_interval;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL,
			       (const void *)&optval, optlen) < 0)
			return 1;
#endif
#ifdef TCP_KEEPCNT
		optval = vhost->ka_probes;
		if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT,
			       (const void *)&optval, optlen) < 0)
			return 1;
#endif
#endif
	}

	/* Disable Nagle */
	optval = 1;
#if !defined(__APPLE__) && \
    !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
    !defined(__NetBSD__) && \
    !defined(__OpenBSD__)
#ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP
#endif
	if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
		return 1;
#else
	tcp_proto = getprotobyname("TCP");
	if (setsockopt(fd, tcp_proto->p_proto, TCP_NODELAY, &optval, optlen) < 0)
		return 1;
#endif

Changes to undroid/libwebsockets/lib/private-libwebsockets.h.

123
124
125
126
127
128
129
130



131

132
133
134
135
136
137
138
 #include <getifaddrs.h>
#else
 #include <ifaddrs.h>
#endif
#if defined (__ANDROID__)
#include <syslog.h>
#include <sys/resource.h>
#else



#include <sys/syslog.h>

#endif
#include <sys/un.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>








>
>
>

>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
 #include <getifaddrs.h>
#else
 #include <ifaddrs.h>
#endif
#if defined (__ANDROID__)
#include <syslog.h>
#include <sys/resource.h>
#else
#if defined (__HAIKU__)
#include <syslog.h>
#else
#include <sys/syslog.h>
#endif
#endif
#include <sys/un.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>