unix: fix {Net,Open}BSD build

Mainly disabling source membership for udp feature, unsupported.

PR-URL: https://github.com/libuv/libuv/pull/2458
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
This commit is contained in:
David Carlier 2019-09-07 19:10:22 +01:00 committed by Saúl Ibarra Corretgé
parent 501304225e
commit 59146f2f4b
4 changed files with 14 additions and 6 deletions

View File

@ -66,7 +66,8 @@ extern char** environ;
#if defined(__DragonFly__) || \
defined(__FreeBSD__) || \
defined(__FreeBSD_kernel__) || \
defined(__NetBSD__)
defined(__NetBSD__) || \
defined(__OpenBSD__)
# include <sys/sysctl.h>
# include <sys/filio.h>
# include <sys/wait.h>
@ -76,7 +77,8 @@ extern char** environ;
# if defined(__NetBSD__)
# define uv__accept4(a, b, c, d) paccept((a), (b), (c), NULL, (d))
# endif
# if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__)
# if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || \
defined(__NetBSD__) || defined(__OpenBSD__)
# define UV__SOCK_NONBLOCK SOCK_NONBLOCK
# define UV__SOCK_CLOEXEC SOCK_CLOEXEC
# endif

View File

@ -78,7 +78,7 @@
defined(__NetBSD__)
# include <sys/param.h>
# include <sys/mount.h>
#elif defined(__sun) || defined(__MVS__)
#elif defined(__sun) || defined(__MVS__) || defined(__NetBSD__)
# include <sys/statvfs.h>
#else
# include <sys/statfs.h>
@ -532,7 +532,7 @@ static int uv__fs_closedir(uv_fs_t* req) {
static int uv__fs_statfs(uv_fs_t* req) {
uv_statfs_t* stat_fs;
#if defined(__sun) || defined(__MVS__)
#if defined(__sun) || defined(__MVS__) || defined(__NetBSD__)
struct statvfs buf;
if (0 != statvfs(req->path, &buf))
@ -549,7 +549,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
return -1;
}
#if defined(__sun) || defined(__MVS__)
#if defined(__sun) || defined(__MVS__) || defined(__OpenBSD__) || defined(__NetBSD__)
stat_fs->f_type = 0; /* f_type is not supported. */
#else
stat_fs->f_type = buf.f_type;

View File

@ -186,7 +186,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
int numcpus = 1;
int which[] = {CTL_HW,HW_MODEL,0};
size_t size;
int i;
int i, j;
uv_cpu_info_t* cpu_info;
size = sizeof(model);

View File

@ -659,6 +659,7 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
}
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
static int uv__udp_set_source_membership4(uv_udp_t* handle,
const struct sockaddr_in* multicast_addr,
const char* interface_addr,
@ -749,6 +750,7 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle,
return 0;
}
#endif
int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) {
@ -846,6 +848,7 @@ int uv_udp_set_source_membership(uv_udp_t* handle,
const char* interface_addr,
const char* source_addr,
uv_membership membership) {
#if !defined(__OpenBSD__) && !defined(__NetBSD__)
int err;
struct sockaddr_storage mcast_addr;
struct sockaddr_in* mcast_addr4;
@ -882,6 +885,9 @@ int uv_udp_set_source_membership(uv_udp_t* handle,
interface_addr,
src_addr4,
membership);
#else
return UV_ENOSYS;
#endif
}