Skip to content

Commit f2c6abc

Browse files
committed
Fix build on FreeBSD
Still don't know if it works; there are lots of warnings when building with Clang, so gotta look at that later. But it's good to have a FreeBSD buildbot worker I can SSH into again!
1 parent 205fddc commit f2c6abc

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/lib/lwan-io-wrappers.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,13 @@ int lwan_sendfile_fd(struct lwan_request *request,
270270
}
271271
}
272272
#elif defined(__FreeBSD__) || defined(__APPLE__)
273-
int lwan_sendfile(struct lwan_request *request,
274-
int out_fd,
275-
int in_fd,
276-
off_t offset,
277-
size_t count,
278-
const char *header,
279-
size_t header_len)
273+
int lwan_sendfile_fd(struct lwan_request *request,
274+
int out_fd,
275+
int in_fd,
276+
off_t offset,
277+
size_t count,
278+
const char *header,
279+
size_t header_len)
280280
{
281281
struct sf_hdtr headers = {.headers =
282282
(struct iovec[]){{.iov_base = (void *)header,

src/lib/lwan-io-wrappers.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#pragma once
2222

2323
#include <errno.h>
24+
#include <sys/socket.h>
2425
#include <sys/uio.h>
2526
#include <unistd.h>
2627

src/lib/lwan-socket.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,14 @@ static int set_socket_options(const struct lwan *l, int fd)
245245
SET_SOCKET_OPTION(SOL_SOCKET, SO_LINGER,
246246
(&(struct linger){.l_onoff = 1, .l_linger = 1}));
247247

248-
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1});
249-
250248
#ifdef __linux__
251249

252250
#ifndef TCP_FASTOPEN
253251
#define TCP_FASTOPEN 23
254252
#endif
255253

256254
SET_SOCKET_OPTION_MAY_FAIL(SOL_SOCKET, SO_REUSEADDR, (int[]){1});
255+
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1});
257256
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_FASTOPEN, (int[]){5});
258257
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_QUICKACK, (int[]){0});
259258
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_DEFER_ACCEPT,

src/lib/missing/sys/socket.h

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#define MSG_MORE 0
2828
#endif
2929

30+
#ifndef MSG_NOSIGNAL
31+
#define MSG_NOSIGNAL 0
32+
#endif
33+
3034
#ifndef SOCK_CLOEXEC
3135
#define SOCK_CLOEXEC 0
3236
#endif

0 commit comments

Comments
 (0)