Skip to content

Commit

Permalink
Fix build on FreeBSD
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
lpereira committed Jun 19, 2024
1 parent 205fddc commit f2c6abc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/lib/lwan-io-wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ int lwan_sendfile_fd(struct lwan_request *request,
}
}
#elif defined(__FreeBSD__) || defined(__APPLE__)
int lwan_sendfile(struct lwan_request *request,
int out_fd,
int in_fd,
off_t offset,
size_t count,
const char *header,
size_t header_len)
int lwan_sendfile_fd(struct lwan_request *request,
int out_fd,
int in_fd,
off_t offset,
size_t count,
const char *header,
size_t header_len)
{
struct sf_hdtr headers = {.headers =
(struct iovec[]){{.iov_base = (void *)header,
Expand Down
1 change: 1 addition & 0 deletions src/lib/lwan-io-wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#pragma once

#include <errno.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <unistd.h>

Expand Down
3 changes: 1 addition & 2 deletions src/lib/lwan-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,14 @@ static int set_socket_options(const struct lwan *l, int fd)
SET_SOCKET_OPTION(SOL_SOCKET, SO_LINGER,
(&(struct linger){.l_onoff = 1, .l_linger = 1}));

SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1});

#ifdef __linux__

#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23
#endif

SET_SOCKET_OPTION_MAY_FAIL(SOL_SOCKET, SO_REUSEADDR, (int[]){1});
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_NODELAY, (int[]){1});
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_FASTOPEN, (int[]){5});
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_QUICKACK, (int[]){0});
SET_SOCKET_OPTION_MAY_FAIL(SOL_TCP, TCP_DEFER_ACCEPT,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/missing/sys/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#define MSG_MORE 0
#endif

#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif

#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0
#endif
Expand Down

0 comments on commit f2c6abc

Please sign in to comment.