[master] 7dbee0473 Flexelint the new acceptor sources
Nils Goroll
nils.goroll at uplex.de
Mon Sep 30 20:27:05 UTC 2024
commit 7dbee04736000a085f124626170c776a0e5c48f2
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Sep 30 21:23:29 2024 +0200
Flexelint the new acceptor sources
diff --git a/bin/varnishd/acceptor/acceptor_priv.h b/bin/varnishd/acceptor/acceptor_priv.h
index 727e07d1b..4f18d23c5 100644
--- a/bin/varnishd/acceptor/acceptor_priv.h
+++ b/bin/varnishd/acceptor/acceptor_priv.h
@@ -61,3 +61,24 @@ struct conn_heritage {
void vca_pace_check(void);
void vca_pace_bad(void);
void vca_pace_good(void);
+
+
+union sock_arg {
+ struct linger lg;
+ struct timeval tv;
+ int i;
+};
+
+struct sock_opt {
+ int level;
+ int optname;
+ const char *strname;
+ unsigned mod;
+ socklen_t sz;
+ union sock_arg arg[1];
+};
+
+#define SOCK_OPT(lvl, nam, typ) { lvl, nam, #nam, 1, sizeof(typ) },
+
+// move to individual pools?
+extern unsigned pool_accepting; // cache_acceptor.c
diff --git a/bin/varnishd/acceptor/cache_acceptor.c b/bin/varnishd/acceptor/cache_acceptor.c
index 375edb074..ca08665c9 100644
--- a/bin/varnishd/acceptor/cache_acceptor.c
+++ b/bin/varnishd/acceptor/cache_acceptor.c
@@ -48,14 +48,13 @@
#include "common/heritage.h"
#include "vcli_serve.h"
-#include "vsa.h"
-#include "vtcp.h"
#include "vtim.h"
-static pthread_t VCA_thread;
-vtim_dur vca_pace = 0.0;
-struct lock pace_mtx;
unsigned pool_accepting;
+
+static pthread_t VCA_thread;
+static vtim_dur vca_pace = 0.0;
+static struct lock pace_mtx;
static pthread_mutex_t shut_mtx = PTHREAD_MUTEX_INITIALIZER;
/*--------------------------------------------------------------------
diff --git a/bin/varnishd/acceptor/cache_acceptor_tcp.c b/bin/varnishd/acceptor/cache_acceptor_tcp.c
index f33938405..66f15b8e7 100644
--- a/bin/varnishd/acceptor/cache_acceptor_tcp.c
+++ b/bin/varnishd/acceptor/cache_acceptor_tcp.c
@@ -51,31 +51,13 @@
#include "vtcp.h"
#include "vtim.h"
-extern vtim_dur vca_pace;
-extern struct lock pace_mtx;
-extern unsigned pool_accepting;
-
/*--------------------------------------------------------------------
* TCP options we want to control
*/
-union sock_arg {
- struct linger lg;
- struct timeval tv;
- int i;
-};
-
-static struct sock_opt {
- int level;
- int optname;
- const char *strname;
- unsigned mod;
- socklen_t sz;
- union sock_arg arg[1];
-} sock_opts[] = {
+static struct sock_opt sock_opts[] = {
/* Note: Setting the mod counter to something not-zero is needed
* to force the setsockopt() calls on startup */
-#define SOCK_OPT(lvl, nam, typ) { lvl, nam, #nam, 1, sizeof(typ) },
SOCK_OPT(SOL_SOCKET, SO_LINGER, struct linger)
SOCK_OPT(SOL_SOCKET, SO_KEEPALIVE, int)
@@ -332,6 +314,7 @@ vca_tcp_event(struct cli *cli, struct listen_sock *ls, enum vca_event event)
{
char h[VTCP_ADDRBUFSIZE], p[VTCP_PORTBUFSIZE];
+ (void) ls; // XXX const?
switch (event) {
case VCA_EVENT_LADDR:
VTCP_myname(ls->sock, h, sizeof h, p, sizeof p);
diff --git a/bin/varnishd/acceptor/cache_acceptor_uds.c b/bin/varnishd/acceptor/cache_acceptor_uds.c
index 95515fc43..513d5161e 100644
--- a/bin/varnishd/acceptor/cache_acceptor_uds.c
+++ b/bin/varnishd/acceptor/cache_acceptor_uds.c
@@ -51,10 +51,6 @@
#include "vtcp.h"
#include "vtim.h"
-extern vtim_dur vca_pace;
-extern struct lock pace_mtx;
-extern unsigned pool_accepting;
-
/*--------------------------------------------------------------------
* We want to get out of any kind of trouble-hit TCP connections as fast
* as absolutely possible, so we set them LINGER disabled, so that even if
@@ -75,23 +71,9 @@ static const unsigned enable_so_keepalive = 1;
* UDS options we want to control
*/
-union sock_arg {
- struct linger lg;
- struct timeval tv;
- int i;
-};
-
-static struct sock_opt {
- int level;
- int optname;
- const char *strname;
- unsigned mod;
- socklen_t sz;
- union sock_arg arg[1];
-} sock_opts[] = {
+static struct sock_opt sock_opts[] = {
/* Note: Setting the mod counter to something not-zero is needed
* to force the setsockopt() calls on startup */
-#define SOCK_OPT(lvl, nam, typ) { lvl, nam, #nam, 1, sizeof(typ) },
SOCK_OPT(SOL_SOCKET, SO_LINGER, struct linger)
SOCK_OPT(SOL_SOCKET, SO_KEEPALIVE, int)
@@ -299,6 +281,7 @@ static void
vca_uds_event(struct cli *cli, struct listen_sock *ls, enum vca_event event)
{
+ (void) ls; // XXX const?
switch (event) {
case VCA_EVENT_LADDR:
CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC);
diff --git a/bin/varnishd/acceptor/mgt_acceptor.c b/bin/varnishd/acceptor/mgt_acceptor.c
index 11414f1f7..6984dd7d6 100644
--- a/bin/varnishd/acceptor/mgt_acceptor.c
+++ b/bin/varnishd/acceptor/mgt_acceptor.c
@@ -48,10 +48,6 @@
#include "common/heritage.h"
#include "vav.h"
-#include "vcli_serve.h"
-#include "vsa.h"
-#include "vss.h"
-#include "vtcp.h"
#include "vus.h"
static VTAILQ_HEAD(,listen_arg) listen_args =
diff --git a/bin/varnishd/acceptor/mgt_acceptor_tcp.c b/bin/varnishd/acceptor/mgt_acceptor_tcp.c
index 3b41ef140..e7669b5f6 100644
--- a/bin/varnishd/acceptor/mgt_acceptor_tcp.c
+++ b/bin/varnishd/acceptor/mgt_acceptor_tcp.c
@@ -49,8 +49,6 @@
#include "acceptor/acceptor_tcp.h"
#include "acceptor/mgt_acceptor.h"
-#include "vav.h"
-#include "vcli_serve.h"
#include "vsa.h"
#include "vss.h"
#include "vtcp.h"
diff --git a/bin/varnishd/acceptor/mgt_acceptor_uds.c b/bin/varnishd/acceptor/mgt_acceptor_uds.c
index 325268797..c10fa7af6 100644
--- a/bin/varnishd/acceptor/mgt_acceptor_uds.c
+++ b/bin/varnishd/acceptor/mgt_acceptor_uds.c
@@ -52,10 +52,7 @@
#include "acceptor/acceptor_uds.h"
#include "acceptor/mgt_acceptor.h"
-#include "vav.h"
-#include "vcli_serve.h"
#include "vsa.h"
-#include "vss.h"
#include "vus.h"
int
More information about the varnish-commit
mailing list