Use kqueue in librumpclient for FreeBSD too

This commit is contained in:
justin 2014-12-08 01:10:07 +00:00
parent a25ec9451f
commit 7e80a07c88
1 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpclient.c,v 1.62 2014/04/25 12:20:12 pooka Exp $ */
/* $NetBSD: rumpclient.c,v 1.63 2014/12/08 01:10:07 justin Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@ -32,7 +32,7 @@
#include <rump/rumpuser_port.h>
/*
* We use kqueue on NetBSD, poll elsewhere. Theoretically we could
* We use kqueue on NetBSD and FreeBSD, poll elsewhere. We could
* use kqueue on other BSD's too, but I haven't tested those. We
* want to use kqueue because it will give us the ability to get signal
* notifications but defer their handling to a stage where we do not
@ -43,14 +43,14 @@
* response from the server.
*/
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define USE_KQUEUE
#endif
#if defined(__linux__) && !defined(__ANDROID__)
#define USE_SIGNALFD
#endif
__RCSID("$NetBSD: rumpclient.c,v 1.62 2014/04/25 12:20:12 pooka Exp $");
__RCSID("$NetBSD: rumpclient.c,v 1.63 2014/12/08 01:10:07 justin Exp $");
#include <sys/param.h>
#include <sys/mman.h>
@ -102,8 +102,13 @@ int (*host_dup)(int);
#ifdef USE_KQUEUE
int (*host_kqueue)(void);
#ifdef __NetBSD__
int (*host_kevent)(int, const struct kevent *, size_t,
struct kevent *, size_t, const struct timespec *);
#else
int (*host_kevent)(int, const struct kevent *, int,
struct kevent *, int, const struct timespec *);
#endif
#endif
#ifdef USE_SIGNALFD
@ -925,11 +930,15 @@ rumpclient_init(void)
#ifdef USE_KQUEUE
FINDSYM(kqueue)
#ifdef __NetBSD__
#if !__NetBSD_Prereq__(5,99,7)
FINDSYM(kevent)
#else
FINDSYM2(kevent,_sys___kevent50)
#endif
#else
FINDSYM(kevent)
#endif
#endif /* USE_KQUEUE */
#ifdef USE_SIGNALFD