Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
720d0d5a
Commit
720d0d5a
authored
May 26, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move waiter selection from param to command-line and pave the road
for them taking parameters.
parent
2c022ed3
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
93 additions
and
81 deletions
+93
-81
Makefile.am
bin/varnishd/Makefile.am
+1
-0
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+20
-1
mgt_param_tbl.c
bin/varnishd/mgt/mgt_param_tbl.c
+0
-6
mgt_param_tweak.c
bin/varnishd/mgt/mgt_param_tweak.c
+0
-12
cache_waiter.c
bin/varnishd/waiter/cache_waiter.c
+1
-0
cache_waiter_epoll.c
bin/varnishd/waiter/cache_waiter_epoll.c
+1
-0
cache_waiter_kqueue.c
bin/varnishd/waiter/cache_waiter_kqueue.c
+1
-0
cache_waiter_poll.c
bin/varnishd/waiter/cache_waiter_poll.c
+1
-0
cache_waiter_ports.c
bin/varnishd/waiter/cache_waiter_ports.c
+1
-0
mgt_waiter.c
bin/varnishd/waiter/mgt_waiter.c
+14
-38
mgt_waiter.h
bin/varnishd/waiter/mgt_waiter.h
+51
-0
waiter.h
bin/varnishd/waiter/waiter.h
+0
-3
waiter_priv.h
bin/varnishd/waiter/waiter_priv.h
+0
-17
b00008.vtc
bin/varnishtest/tests/b00008.vtc
+0
-2
b00009.vtc
bin/varnishtest/tests/b00009.vtc
+1
-1
b00048.vtc
bin/varnishtest/tests/b00048.vtc
+1
-1
No files found.
bin/varnishd/Makefile.am
View file @
720d0d5a
...
...
@@ -109,6 +109,7 @@ noinst_HEADERS = \
storage/storage_persistent.h
\
waiter/waiter.h
\
waiter/waiter_priv.h
waiter/mgt_waiter.h
# Headers for use with vmods
nobase_pkginclude_HEADERS
=
\
...
...
bin/varnishd/mgt/mgt_main.c
View file @
720d0d5a
...
...
@@ -57,6 +57,7 @@
#include "vrnd.h"
#include "vsha256.h"
#include "vtim.h"
#include "waiter/mgt_waiter.h"
#include "compat/daemon.h"
...
...
@@ -186,6 +187,18 @@ usage(void)
"Telnet listen address and port"
);
fprintf
(
stderr
,
FMT
,
"-t"
,
"Default TTL"
);
fprintf
(
stderr
,
FMT
,
"-V"
,
"version"
);
fprintf
(
stderr
,
FMT
,
"-W waiter"
,
"Waiter implementation"
);
#if defined(HAVE_KQUEUE)
fprintf
(
stderr
,
FMT
,
""
,
" -W kqueue"
);
#endif
#if defined(HAVE_EPOLL_CTL)
fprintf
(
stderr
,
FMT
,
""
,
" -W epoll"
);
#endif
#if defined(HAVE_PORT_CREATE)
fprintf
(
stderr
,
FMT
,
""
,
" -W ports"
);
#endif
fprintf
(
stderr
,
FMT
,
""
,
" -W poll"
);
#undef FMT
exit
(
1
);
}
...
...
@@ -438,6 +451,7 @@ main(int argc, char * const *argv)
const
char
*
P_arg
=
NULL
;
const
char
*
S_arg
=
NULL
;
const
char
*
s_arg
=
"malloc,100m"
;
const
char
*
W_arg
=
NULL
;
int
s_arg_given
=
0
;
const
char
*
T_arg
=
"localhost:0"
;
char
*
p
,
*
vcl
=
NULL
;
...
...
@@ -496,7 +510,7 @@ main(int argc, char * const *argv)
cli_check
(
cli
);
while
((
o
=
getopt
(
argc
,
argv
,
"a:b:Cdf:Fh:i:j:l:M:n:P:p:r:S:s:T:t:Vx:"
))
!=
-
1
)
{
"a:b:Cdf:Fh:i:j:l:M:n:P:p:r:S:s:T:t:V
W:
x:"
))
!=
-
1
)
{
/*
* -j must be the first argument if specified, because
* it (may) affect subsequent argument processing.
...
...
@@ -593,6 +607,9 @@ main(int argc, char * const *argv)
/* XXX: we should print the ident here */
VCS_Message
(
"varnishd"
);
exit
(
0
);
case
'W'
:
W_arg
=
optarg
;
break
;
case
'x'
:
if
(
!
strcmp
(
optarg
,
"dumprstparam"
))
{
MCF_DumpRstParam
();
...
...
@@ -708,6 +725,8 @@ main(int argc, char * const *argv)
HSH_config
(
h_arg
);
Wait_config
(
W_arg
);
mgt_SHM_Init
();
AZ
(
VSB_finish
(
vident
));
...
...
bin/varnishd/mgt/mgt_param_tbl.c
View file @
720d0d5a
...
...
@@ -35,7 +35,6 @@
#include "common/params.h"
#include "mgt/mgt_param.h"
#include "waiter/waiter.h"
#define MEMPOOL_TEXT \
...
...
@@ -370,11 +369,6 @@ struct parspec mgt_parspec[] = {
"more sessions take a detour around the waiter."
,
EXPERIMENTAL
,
"0.050"
,
"seconds"
},
{
"waiter"
,
tweak_waiter
,
NULL
,
NULL
,
NULL
,
"Select the waiter kernel interface."
,
WIZARD
|
MUST_RESTART
,
WAITER_DEFAULT
,
NULL
},
{
"ban_dups"
,
tweak_bool
,
&
mgt_param
.
ban_dups
,
NULL
,
NULL
,
"Eliminate older identical bans when new bans are created."
...
...
bin/varnishd/mgt/mgt_param_tweak.c
View file @
720d0d5a
...
...
@@ -43,7 +43,6 @@
#include "common/params.h"
#include "mgt/mgt_param.h"
#include "waiter/waiter.h"
#include "vav.h"
#include "vnum.h"
...
...
@@ -380,17 +379,6 @@ tweak_string(struct vsb *vsb, const struct parspec *par, const char *arg)
/*--------------------------------------------------------------------*/
int
tweak_waiter
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
/* XXX should have tweak_generic_string */
(
void
)
par
;
return
(
Wait_Argument
(
vsb
,
arg
));
}
/*--------------------------------------------------------------------*/
int
tweak_poolparam
(
struct
vsb
*
vsb
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
...
...
bin/varnishd/waiter/cache_waiter.c
View file @
720d0d5a
...
...
@@ -38,6 +38,7 @@
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "waiter/mgt_waiter.h"
int
Wait_Enter
(
const
struct
waiter
*
w
,
struct
waited
*
wp
)
...
...
bin/varnishd/waiter/cache_waiter_epoll.c
View file @
720d0d5a
...
...
@@ -43,6 +43,7 @@
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "waiter/mgt_waiter.h"
#include "vtim.h"
#include "vfil.h"
...
...
bin/varnishd/waiter/cache_waiter_kqueue.c
View file @
720d0d5a
...
...
@@ -42,6 +42,7 @@
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "waiter/mgt_waiter.h"
#include "vtim.h"
#define NKEV 256
...
...
bin/varnishd/waiter/cache_waiter_poll.c
View file @
720d0d5a
...
...
@@ -38,6 +38,7 @@
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "waiter/mgt_waiter.h"
#include "vtim.h"
struct
vwp
{
...
...
bin/varnishd/waiter/cache_waiter_ports.c
View file @
720d0d5a
...
...
@@ -45,6 +45,7 @@
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
#include "waiter/mgt_waiter.h"
#include "vtim.h"
#define MAX_EVENTS 256
...
...
bin/varnishd/waiter/mgt_waiter.c
View file @
720d0d5a
...
...
@@ -33,59 +33,35 @@
#include <unistd.h>
#include <string.h>
#include "common/common.h"
#include "mgt/mgt.h"
#include "waiter/mgt_waiter.h"
#include "waiter/waiter.h"
#include "waiter/waiter_priv.h"
static
const
struct
waiter_impl
*
const
waiter_impls
[]
=
{
static
const
struct
choice
waiter_choice
[]
=
{
#if defined(HAVE_KQUEUE)
&
waiter_kqueue
,
{
"kqueue"
,
&
waiter_kqueue
}
,
#endif
#if defined(HAVE_EPOLL_CTL)
&
waiter_epoll
,
{
"epoll"
,
&
waiter_epoll
}
,
#endif
#if 0
#if defined(HAVE_PORT_CREATE)
&waiter_ports
,
{ "ports", &waiter_ports }
,
#endif
#endif
&
waiter_poll
,
NULL
,
{
"poll"
,
&
waiter_poll
}
,
{
NULL
,
NULL
}
};
struct
waiter_impl
const
*
waiter
;
int
Wait_
Argument
(
struct
vsb
*
vsb
,
const
char
*
arg
)
void
Wait_
config
(
const
char
*
arg
)
{
int
i
;
ASSERT_MGT
();
if
(
arg
==
NULL
)
{
if
(
waiter
==
NULL
)
VSB_printf
(
vsb
,
"default"
);
else
VSB_printf
(
vsb
,
"%s"
,
waiter
->
name
);
VSB_printf
(
vsb
,
" (possible values: "
);
for
(
i
=
0
;
waiter_impls
[
i
]
!=
NULL
;
i
++
)
VSB_printf
(
vsb
,
"%s%s"
,
i
==
0
?
""
:
", "
,
waiter_impls
[
i
]
->
name
);
VSB_printf
(
vsb
,
")"
);
return
(
0
);
}
if
(
!
strcmp
(
arg
,
WAITER_DEFAULT
))
{
waiter
=
waiter_impls
[
0
];
return
(
0
);
}
for
(
i
=
0
;
waiter_impls
[
i
];
i
++
)
{
if
(
!
strcmp
(
arg
,
waiter_impls
[
i
]
->
name
))
{
waiter
=
waiter_impls
[
i
];
return
(
0
);
}
}
VSB_printf
(
vsb
,
"Unknown waiter"
);
return
(
-
1
);
if
(
arg
!=
NULL
)
waiter
=
pick
(
waiter_choice
,
arg
,
"waiter"
);
else
waiter
=
waiter_choice
[
0
].
ptr
;
}
bin/varnishd/waiter/mgt_waiter.h
0 → 100644
View file @
720d0d5a
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 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
waiter_impl
;
/* 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
;
void
Wait_config
(
const
char
*
arg
);
bin/varnishd/waiter/waiter.h
View file @
720d0d5a
...
...
@@ -61,6 +61,3 @@ int Wait_Enter(const struct waiter *, struct waited *);
struct
waiter
*
Waiter_New
(
waiter_handle_f
*
,
volatile
double
*
timeout
);
void
Waiter_Destroy
(
struct
waiter
**
);
const
char
*
Waiter_GetName
(
void
);
/* mgt_waiter.c */
int
Wait_Argument
(
struct
vsb
*
vsb
,
const
char
*
arg
);
bin/varnishd/waiter/waiter_priv.h
View file @
720d0d5a
...
...
@@ -63,20 +63,3 @@ struct waiter_impl {
waiter_inject_f
*
inject
;
size_t
size
;
};
/* 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
;
bin/varnishtest/tests/b00008.vtc
View file @
720d0d5a
...
...
@@ -24,8 +24,6 @@ varnish v1 -start
varnish v1 -cliok "help"
varnish v1 -cliok "param.set waiter poll"
varnish v1 -clierr 106 "param.set waiter HASH(0x8839c4c)"
varnish v1 -cliok "param.set cli_limit 128"
...
...
bin/varnishtest/tests/b00009.vtc
View file @
720d0d5a
...
...
@@ -5,7 +5,7 @@ server s1 {
txresp -hdr "Connection: close" -body "012345\n"
} -start
varnish v1 -arg "-
p waiter=
poll" -vcl+backend {} -start
varnish v1 -arg "-
W
poll" -vcl+backend {} -start
client c1 {
txreq -url "/"
...
...
bin/varnishtest/tests/b00048.vtc
View file @
720d0d5a
...
...
@@ -10,7 +10,7 @@ server s0 {
expect_close
} -dispatch
varnish v1 -arg "-
p waiter=
poll" -vcl+backend {
varnish v1 -arg "-
W
poll" -vcl+backend {
sub vcl_recv {
return (pass);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment