mirror of
https://github.com/libuv/libuv
synced 2025-03-28 21:13:16 +00:00
build: GNU/kFreeBSD support
autotools support only, gvp does not support kfreebsd detection. PR-URL: https://github.com/libuv/libuv/pull/960 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
e5c93a1589
commit
0a4b51fcb4
@ -54,7 +54,7 @@ AM_CONDITIONAL([AIX], [AS_CASE([$host_os],[aix*], [true], [false])
|
||||
AM_CONDITIONAL([ANDROID], [AS_CASE([$host_os],[linux-android*],[true], [false])])
|
||||
AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os],[darwin*], [true], [false])])
|
||||
AM_CONDITIONAL([DRAGONFLY],[AS_CASE([$host_os],[dragonfly*], [true], [false])])
|
||||
AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[freebsd*], [true], [false])])
|
||||
AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os],[*freebsd*], [true], [false])])
|
||||
AM_CONDITIONAL([LINUX], [AS_CASE([$host_os],[linux*], [true], [false])])
|
||||
AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])])
|
||||
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
|
||||
|
@ -408,6 +408,7 @@
|
||||
#elif defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__)
|
||||
# define UV__EHOSTDOWN (-64)
|
||||
|
@ -50,9 +50,10 @@
|
||||
# include "uv-sunos.h"
|
||||
#elif defined(__APPLE__)
|
||||
# include "uv-darwin.h"
|
||||
#elif defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
#elif defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# include "uv-bsd.h"
|
||||
#endif
|
||||
|
@ -55,7 +55,9 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#if defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__)
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/filio.h>
|
||||
# include <sys/wait.h>
|
||||
|
@ -46,9 +46,10 @@
|
||||
#include <utime.h>
|
||||
#include <poll.h>
|
||||
|
||||
#if defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
#if defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel_) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# define HAVE_PREADV 1
|
||||
#else
|
||||
@ -193,6 +194,7 @@ skip:
|
||||
#elif defined(__APPLE__) \
|
||||
|| defined(__DragonFly__) \
|
||||
|| defined(__FreeBSD__) \
|
||||
|| defined(__FreeBSD_kernel__) \
|
||||
|| defined(__NetBSD__) \
|
||||
|| defined(__OpenBSD__) \
|
||||
|| defined(__sun)
|
||||
@ -595,7 +597,10 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
|
||||
#elif defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__)
|
||||
{
|
||||
off_t len;
|
||||
ssize_t r;
|
||||
@ -608,6 +613,15 @@ static ssize_t uv__fs_sendfile(uv_fs_t* req) {
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
len = 0;
|
||||
r = sendfile(in_fd, out_fd, req->off, req->bufsml[0].len, NULL, &len, 0);
|
||||
#elif defined(__FreeBSD_kernel__)
|
||||
len = 0;
|
||||
r = bsd_sendfile(in_fd,
|
||||
out_fd,
|
||||
req->off,
|
||||
req->bufsml[0].len,
|
||||
NULL,
|
||||
&len,
|
||||
0);
|
||||
#else
|
||||
/* The darwin sendfile takes len as an input for the length to send,
|
||||
* so make sure to initialize it with the caller's value. */
|
||||
|
@ -156,6 +156,7 @@ struct uv__stream_queued_fds_s {
|
||||
defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__linux__)
|
||||
#define uv__cloexec uv__cloexec_ioctl
|
||||
#define uv__nonblock uv__nonblock_ioctl
|
||||
|
@ -40,7 +40,7 @@
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__GLIBC__)
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
||||
|
@ -40,7 +40,7 @@ static uv_spinlock_t termios_spinlock = UV_SPINLOCK_INITIALIZER;
|
||||
|
||||
static int uv__tty_is_slave(const int fd) {
|
||||
int result;
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
int dummy;
|
||||
|
||||
result = ioctl(fd, TIOCGPTN, &dummy) != 0;
|
||||
|
@ -29,6 +29,7 @@
|
||||
# if defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# define HAVE_KQUEUE 1
|
||||
|
@ -29,6 +29,7 @@
|
||||
# if defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__OpenBSD__) || \
|
||||
defined(__NetBSD__)
|
||||
# define HAVE_KQUEUE 1
|
||||
|
@ -594,7 +594,7 @@ TEST_IMPL(poll_unidirectional) {
|
||||
*/
|
||||
TEST_IMPL(poll_bad_fdtype) {
|
||||
#if !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__sun) && \
|
||||
!defined(_AIX) && !defined(__MVS__)
|
||||
!defined(_AIX) && !defined(__MVS__) && !defined(__FreeBSD_kernel__)
|
||||
uv_poll_t poll_handle;
|
||||
int fd;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#else /* Unix */
|
||||
# include <fcntl.h>
|
||||
# include <unistd.h>
|
||||
# if defined(__linux__) && !defined(__ANDROID__)
|
||||
# if (defined(__linux__) || defined(__GLIBC__)) && !defined(__ANDROID__)
|
||||
# include <pty.h>
|
||||
# elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
|
||||
# include <util.h>
|
||||
@ -260,8 +260,14 @@ TEST_IMPL(tty_file) {
|
||||
}
|
||||
|
||||
TEST_IMPL(tty_pty) {
|
||||
# if defined(__linux__) && !defined(__ANDROID__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
|
||||
defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#if defined(__ANDROID__) || \
|
||||
defined(__APPLE__) || \
|
||||
defined(__DragonFly__) || \
|
||||
defined(__FreeBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || \
|
||||
defined(__linux__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__)
|
||||
int master_fd, slave_fd, r;
|
||||
struct winsize w;
|
||||
uv_loop_t loop;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
@ -47,7 +47,7 @@ static int send_cb_called;
|
||||
static int recv_cb_called;
|
||||
static int close_cb_called;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
static int can_ipv6_ipv4_dual() {
|
||||
int v6only;
|
||||
size_t size = sizeof(int);
|
||||
@ -166,7 +166,7 @@ TEST_IMPL(udp_dual_stack) {
|
||||
if (!can_ipv6())
|
||||
RETURN_SKIP("IPv6 not supported");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (!can_ipv6_ipv4_dual())
|
||||
RETURN_SKIP("IPv6-IPv4 dual stack not supported");
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ TEST_IMPL(udp_multicast_interface6) {
|
||||
r = uv_udp_bind(&server, (const struct sockaddr*)&baddr, 0);
|
||||
ASSERT(r == 0);
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
r = uv_udp_set_multicast_interface(&server, "::1%lo0");
|
||||
#else
|
||||
r = uv_udp_set_multicast_interface(&server, NULL);
|
||||
|
@ -119,7 +119,10 @@ TEST_IMPL(udp_multicast_join6) {
|
||||
ASSERT(r == 0);
|
||||
|
||||
/* join the multicast channel */
|
||||
#if defined(__APPLE__) || defined(_AIX) || defined(__MVS__)
|
||||
#if defined(__APPLE__) || \
|
||||
defined(_AIX) || \
|
||||
defined(__MVS__) || \
|
||||
defined(__FreeBSD_kernel__)
|
||||
r = uv_udp_set_membership(&client, "ff02::1", "::1%lo0", UV_JOIN_GROUP);
|
||||
#else
|
||||
r = uv_udp_set_membership(&client, "ff02::1", NULL, UV_JOIN_GROUP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user