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
4998fb2e
Commit
4998fb2e
authored
Feb 25, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the debugging CLI commands to cache_panic.c where they belong
parent
076e0770
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
95 deletions
+102
-95
cache_cli.c
bin/varnishd/cache/cache_cli.c
+2
-94
cache_main.c
bin/varnishd/cache/cache_main.c
+1
-1
cache_panic.c
bin/varnishd/cache/cache_panic.c
+99
-0
No files found.
bin/varnishd/cache/cache_cli.c
View file @
4998fb2e
...
...
@@ -36,19 +36,14 @@
#include "config.h"
#include <stddef.h> // offsetof
#include "cache.h"
#include "common/heritage.h"
#include "cache_backend.h" // struct vbc
#include "hash/hash_slinger.h" // struct objhead
#include "vsa.h"
#include "vcli.h"
#include "vcli_common.h"
#include "vcli_priv.h"
#include "vcli_serve.h"
#include "storage/storage.h" // struct storage
pthread_t
cli_thread
;
static
struct
lock
cli_mtx
;
...
...
@@ -116,96 +111,9 @@ CLI_Run(void)
/*--------------------------------------------------------------------*/
static
void
cli_debug_sizeof
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
av
;
(
void
)
priv
;
#define SZOF(foo) VCLI_Out(cli, \
"sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo))
SZOF
(
struct
ws
);
SZOF
(
struct
http
);
SZOF
(
struct
http_conn
);
SZOF
(
struct
acct_req
);
SZOF
(
struct
worker
);
SZOF
(
struct
wrk_accept
);
SZOF
(
struct
storage
);
SZOF
(
struct
busyobj
);
SZOF
(
struct
object
);
SZOF
(
struct
objcore
);
SZOF
(
struct
objhead
);
SZOF
(
struct
sess
);
SZOF
(
struct
req
);
SZOF
(
struct
vbc
);
SZOF
(
struct
VSC_C_main
);
SZOF
(
struct
lock
);
SZOF
(
struct
dstat
);
VCLI_Out
(
cli
,
"sizeof(struct suckaddr) = %d = 0x%x
\n
"
,
vsa_suckaddr_len
,
vsa_suckaddr_len
);
#if 0
#define OFOF(foo, bar) { foo __foo; VCLI_Out(cli, \
"%-30s = 0x%4zx @ 0x%4zx\n", \
#foo "." #bar, sizeof(__foo.bar), offsetof(foo, bar)); }
#if 0
OFOF(struct objhead, magic);
OFOF(struct objhead, refcnt);
OFOF(struct objhead, mtx);
OFOF(struct objhead, objcs);
OFOF(struct objhead, digest);
OFOF(struct objhead, waitinglist);
OFOF(struct objhead, _u);
#endif
#if 0
OFOF(struct http, magic);
OFOF(struct http, logtag);
OFOF(struct http, ws);
OFOF(struct http, hd);
OFOF(struct http, hdf);
OFOF(struct http, shd);
OFOF(struct http, nhd);
OFOF(struct http, status);
OFOF(struct http, protover);
OFOF(struct http, conds);
#endif
#if 0
OFOF(struct storage, magic);
OFOF(struct storage, fd);
OFOF(struct storage, where);
OFOF(struct storage, list);
OFOF(struct storage, stevedore);
OFOF(struct storage, priv);
OFOF(struct storage, ptr);
OFOF(struct storage, len);
OFOF(struct storage, space);
#endif
#undef OFOF
#endif
}
/*--------------------------------------------------------------------*/
static
void
ccf_panic
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
cli
;
(
void
)
av
;
(
void
)
priv
;
AZ
(
strcmp
(
""
,
"You asked for it"
));
}
/*--------------------------------------------------------------------*/
static
struct
cli_proto
master_cmds
[]
=
{
static
struct
cli_proto
cli_cmds
[]
=
{
{
CLI_PING
,
"i"
,
VCLS_func_ping
},
{
CLI_HELP
,
"i"
,
VCLS_func_help
},
{
"debug.sizeof"
,
"debug.sizeof"
,
"
\t
Dump sizeof various data structures."
,
0
,
0
,
"d"
,
cli_debug_sizeof
},
{
"debug.panic.worker"
,
"debug.panic.worker"
,
"
\t
Panic the worker process."
,
0
,
0
,
"d"
,
ccf_panic
},
{
NULL
}
};
...
...
@@ -224,5 +132,5 @@ CLI_Init(void)
&
cache_param
->
cli_buffer
,
&
cache_param
->
cli_limit
);
AN
(
cls
);
CLI_AddFuncs
(
master
_cmds
);
CLI_AddFuncs
(
cli
_cmds
);
}
bin/varnishd/cache/cache_main.c
View file @
4998fb2e
...
...
@@ -211,8 +211,8 @@ child_main(void)
Lck_New
(
&
vxid_lock
,
lck_vxid
);
PAN_Init
();
CLI_Init
();
PAN_Init
();
VFP_Init
();
Wait_Init
();
...
...
bin/varnishd/cache/cache_panic.c
View file @
4998fb2e
...
...
@@ -36,18 +36,23 @@
#endif
#include <stdio.h>
#include <stddef.h> // offsetof()
#include <stdlib.h>
#include <signal.h>
#include "cache.h"
#include "cache_filter.h"
#include "hash/hash_slinger.h" // struct objhead
#include "vend.h"
#include "common/heritage.h"
#include "cache_backend.h"
#include "storage/storage.h"
#include "vcl.h"
#include "vcli.h"
#include "vcli_priv.h"
#include "waiter/waiter.h"
#include "vsa.h"
/*
* The panic string is constructed in memory, then copied to the
...
...
@@ -572,6 +577,99 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
/*--------------------------------------------------------------------*/
static
void
__match_proto__
(
cli_func_t
)
cli_debug_sizeof
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
av
;
AZ
(
priv
);
#define SZOF(foo) VCLI_Out(cli, \
"sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo))
SZOF
(
struct
ws
);
SZOF
(
struct
http
);
SZOF
(
struct
http_conn
);
SZOF
(
struct
acct_req
);
SZOF
(
struct
worker
);
SZOF
(
struct
wrk_accept
);
SZOF
(
struct
storage
);
SZOF
(
struct
busyobj
);
SZOF
(
struct
object
);
SZOF
(
struct
objcore
);
SZOF
(
struct
objhead
);
SZOF
(
struct
sess
);
SZOF
(
struct
req
);
SZOF
(
struct
vbc
);
SZOF
(
struct
VSC_C_main
);
SZOF
(
struct
lock
);
SZOF
(
struct
dstat
);
VCLI_Out
(
cli
,
"sizeof(struct suckaddr) = %d = 0x%x
\n
"
,
vsa_suckaddr_len
,
vsa_suckaddr_len
);
#if 0
#define OFOF(foo, bar) { foo __foo; VCLI_Out(cli, \
"%-30s = 0x%4zx @ 0x%4zx\n", \
#foo "." #bar, sizeof(__foo.bar), offsetof(foo, bar)); }
#if 0
OFOF(struct objhead, magic);
OFOF(struct objhead, refcnt);
OFOF(struct objhead, mtx);
OFOF(struct objhead, objcs);
OFOF(struct objhead, digest);
OFOF(struct objhead, waitinglist);
OFOF(struct objhead, _u);
#endif
#if 0
OFOF(struct http, magic);
OFOF(struct http, logtag);
OFOF(struct http, ws);
OFOF(struct http, hd);
OFOF(struct http, hdf);
OFOF(struct http, shd);
OFOF(struct http, nhd);
OFOF(struct http, status);
OFOF(struct http, protover);
OFOF(struct http, conds);
#endif
#if 0
OFOF(struct storage, magic);
OFOF(struct storage, fd);
OFOF(struct storage, where);
OFOF(struct storage, list);
OFOF(struct storage, stevedore);
OFOF(struct storage, priv);
OFOF(struct storage, ptr);
OFOF(struct storage, len);
OFOF(struct storage, space);
#endif
#undef OFOF
#endif
}
/*--------------------------------------------------------------------*/
static
void
__match_proto__
(
cli_func_t
)
ccf_panic
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
cli
;
(
void
)
av
;
AZ
(
priv
);
AZ
(
strcmp
(
""
,
"You asked for it"
));
}
/*--------------------------------------------------------------------*/
static
struct
cli_proto
debug_cmds
[]
=
{
{
"debug.sizeof"
,
"debug.sizeof"
,
"
\t
Dump sizeof various data structures."
,
0
,
0
,
"d"
,
cli_debug_sizeof
},
{
"debug.panic.worker"
,
"debug.panic.worker"
,
"
\t
Panic the worker process."
,
0
,
0
,
"d"
,
ccf_panic
},
{
NULL
}
};
/*--------------------------------------------------------------------*/
void
PAN_Init
(
void
)
{
...
...
@@ -582,4 +680,5 @@ PAN_Init(void)
AN
(
heritage
.
panic_str_len
);
AN
(
VSB_new
(
pan_vsp
,
heritage
.
panic_str
,
heritage
.
panic_str_len
,
VSB_FIXEDLEN
));
CLI_AddFuncs
(
debug_cmds
);
}
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