Commit bf43a647 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Split waiter stuff into private and public headers

parent 3864e664
......@@ -102,7 +102,8 @@ noinst_HEADERS = \
mgt/mgt_param.h \
storage/storage.h \
storage/storage_persistent.h \
waiter/waiter.h
waiter/waiter.h \
waiter/waiter_priv.h
# Headers for use with vmods
nobase_pkginclude_HEADERS = \
......
......@@ -38,14 +38,7 @@
#include "cache/cache.h"
#include "waiter/waiter.h"
struct waiter {
unsigned magic;
#define WAITER_MAGIC 0x17c399db
const struct waiter_impl *impl;
void *priv;
int pfd;
};
#include "waiter/waiter_priv.h"
const char *
WAIT_GetName(void)
......
......@@ -42,6 +42,7 @@
#include "cache/cache.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "vtim.h"
#include "vfil.h"
......
......@@ -44,6 +44,7 @@
#include "cache/cache.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "vtim.h"
#include "vfil.h"
......
......@@ -37,6 +37,7 @@
#include "cache/cache.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "vtim.h"
#include "vfil.h"
......
......@@ -43,6 +43,7 @@
#include "cache/cache.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "vtim.h"
#define MAX_EVENTS 256
......
......@@ -36,6 +36,7 @@
#include "common/common.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
static const struct waiter_impl *const waiter_impls[] = {
#if defined(HAVE_KQUEUE)
......
......@@ -38,6 +38,8 @@
* - kqueue on FreeBSD
* - epoll on Linux
* - ports on Solaris
*
* Public interfaces
*/
struct waited;
......@@ -49,17 +51,9 @@ enum wait_event {
WAITER_ACTION
};
typedef void waiter_handle_f(struct waited *, enum wait_event, double now);
typedef void* waiter_init_f(waiter_handle_f *, int *, volatile double *);
typedef int waiter_pass_f(void *priv, struct waited *);
#define WAITER_DEFAULT "platform dependent"
struct waiter_impl {
const char *name;
waiter_init_f *init;
waiter_pass_f *pass;
};
typedef void waiter_handle_f(struct waited *, enum wait_event, double now);
/* cache_waiter.c */
int WAIT_Enter(const struct waiter *, struct waited *);
......@@ -67,19 +61,4 @@ struct waiter *WAIT_Init(waiter_handle_f *, volatile double *timeout);
const char *WAIT_GetName(void);
/* mgt_waiter.c */
extern struct waiter_impl const * waiter;
int WAIT_tweak_waiter(struct vsb *vsb, const char *arg);
#if defined(HAVE_EPOLL_CTL)
extern const struct waiter_impl waiter_epoll;
#endif
#if defined(HAVE_KQUEUE)
extern const struct waiter_impl waiter_kqueue;
#endif
#if defined(HAVE_PORT_CREATE)
extern const struct waiter_impl waiter_ports;
#endif
extern const struct waiter_impl waiter_poll;
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Private interfaces
*/
struct waited;
struct waiter {
unsigned magic;
#define WAITER_MAGIC 0x17c399db
const struct waiter_impl *impl;
void *priv;
int pfd;
};
typedef void* waiter_init_f(waiter_handle_f *, int *, volatile double *);
typedef int waiter_pass_f(void *priv, struct waited *);
struct waiter_impl {
const char *name;
waiter_init_f *init;
waiter_pass_f *pass;
};
/* mgt_waiter.c */
extern struct waiter_impl const * waiter;
#if defined(HAVE_EPOLL_CTL)
extern const struct waiter_impl waiter_epoll;
#endif
#if defined(HAVE_KQUEUE)
extern const struct waiter_impl waiter_kqueue;
#endif
#if defined(HAVE_PORT_CREATE)
extern const struct waiter_impl waiter_ports;
#endif
extern const struct waiter_impl waiter_poll;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment