Commit 5a4964c8 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Slight improvements on Cecilie's commit: correct nroff style and man page

wording, constify varnish_name, move default name logic into VSL_Open*().


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1525 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ebd5b639
......@@ -507,7 +507,7 @@ tweak_name(struct cli *cli, struct parspec *par, const char* arg)
char *old_path;
int renaming;
(void)par;
if (arg != NULL) {
/* Check that the new name follows hostname convention */
/* [a-zA-Z0-9.-] */
......@@ -518,7 +518,7 @@ tweak_name(struct cli *cli, struct parspec *par, const char* arg)
if (stat(path, &st)) {
if (renaming) {
if (renaming && rename(old_path, path)) {
cli_out(cli,
cli_out(cli,
"Error: Directory %s could not be "
"renamed to %s",
old_path, path);
......@@ -578,12 +578,12 @@ tweak_name(struct cli *cli, struct parspec *par, const char* arg)
*/
static struct parspec parspec[] = {
{ "user", tweak_user,
"The unprivileged user to run as. Setting this will "
"The unprivileged user to run as. Setting this will "
"also set \"group\" to the specified user's primary group.\n"
MUST_RESTART,
"nobody" },
{ "group", tweak_group,
"The unprivileged group to run as.\n"
"The unprivileged group to run as.\n"
MUST_RESTART,
"nogroup" },
{ "default_ttl", tweak_default_ttl,
......@@ -734,7 +734,7 @@ static struct parspec parspec[] = {
"naming conventions. Makes it possible to run "
"multiple varnishd instances on one server.\n"
EXPERIMENTAL,
"hostname"},
"hostname" },
{ NULL, NULL, NULL }
};
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd May 30, 2007
.Dd June 15, 2007
.Dt VARNISHD 1
.Os
.Sh NAME
......@@ -129,9 +129,10 @@ See
.Sx Hash Algorithms
for a list of supported algorithms.
.It Fl n
Specify a name for this instance. If
.Fl n
is not specified, hostname is used. Files will be stored in /tmp/<name>/
Specify a name for this instance.
This is a shortcut for specifying the
.Va name
run-time parameter.
.It Fl P Ar file
Write the process's PID to the specified
.Ar file .
......@@ -401,6 +402,14 @@ The default is 0.0.0.0:80.
The depth of the TCP listen queue.
.Pp
The default is 512.
.It Va name
The name of this
.Nm
instance.
All temporary files are stored in
.Pa /tmp/ Ns Va name .
.Pp
The default is the hostname.
.It Va overflow_max
The maximum depth of the overflow queue as a percentage of
.Va thread_pool_max .
......@@ -499,11 +508,6 @@ Note that this will generate large amounts of log data.
.Pp
The default is
.Dv off .
.It Va name
The name if this varnishd instance. All temporary files are stored in
/tmp/<name>/
.Pp
The default is the hostname
.El
.Sh SEE ALSO
.Xr varnishlog 1 ,
......
......@@ -403,7 +403,6 @@ main(int argc, char *argv[])
const char *b_arg = NULL;
const char *f_arg = NULL;
const char *h_arg = "classic";
char *n_arg = NULL;
const char *P_arg = NULL;
const char *s_arg = "file";
const char *T_arg = NULL;
......@@ -452,7 +451,7 @@ main(int argc, char *argv[])
h_arg = optarg;
break;
case 'n':
n_arg = optarg;
MCF_ParamSet(cli, "name", optarg);
break;
case 'P':
P_arg = optarg;
......@@ -504,13 +503,7 @@ main(int argc, char *argv[])
fprintf(stderr, "One of -b or -f must be specified\n");
usage();
}
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
MCF_ParamSet(cli, "name", n_arg);
if (P_arg && (pfh = vpf_open(P_arg, 0600, NULL)) == NULL) {
perror(P_arg);
exit(1);
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd September 20, 2006
.Dd June 15, 2007
.Dt VARNISHHIST 1
.Os
.Sh NAME
......@@ -102,11 +102,12 @@ nor
.Fl i
is specified, all log entries are included.
.It Fl n
Specify the name of the varnishd to get logs from. If
Specifies the name of the
.Nm varnishd
instance to get logs from.
If
.Fl n
is not specified, hostname is used. If varnishd was started with
.Fl n
the option must be specified.
is not specified, the host name is used.
.It Fl r Ar file
Read log entries from
.Ar file
......
......@@ -180,7 +180,7 @@ main(int argc, char **argv)
{
int i, c, x;
struct VSL_data *vd;
char *n_arg = NULL;
const char *n_arg = NULL;
vd = VSL_New();
......@@ -202,11 +202,6 @@ main(int argc, char **argv)
}
}
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
if (VSL_OpenLog(vd, n_arg))
exit (1);
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd May 11, 2007
.Dd June 15, 2007
.Dt VARNISHLOG 1
.Os
.Sh NAME
......@@ -108,11 +108,12 @@ nor
.Fl i
is specified, all log entries are included.
.It Fl n
Specify the name of the varnishd to get logs from. If
.Fl n
is not specified, hostname is used. If varnishd was started with
Specifies the name of the
.Nm varnishd
instance to get logs from.
If
.Fl n
the option must be specified.
is not specified, the host name is used.
.It Fl o
Group log entries by request ID.
This has no effect when writing to a file using the
......
......@@ -285,7 +285,7 @@ main(int argc, char **argv)
int a_flag = 0, D_flag = 0, o_flag = 0;
const char *P_arg = NULL;
const char *w_arg = NULL;
char *n_arg = NULL;
const char *n_arg = NULL;
struct pidfh *pfh = NULL;
struct VSL_data *vd;
......@@ -334,11 +334,6 @@ main(int argc, char **argv)
if (o_flag && w_arg != NULL)
usage();
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
if (VSL_OpenLog(vd, n_arg))
exit(1);
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd April 21, 2007
.Dd June 15, 2007
.Dt VARNISHNCSA 1
.Os
.Sh NAME
......@@ -103,11 +103,12 @@ nor
.Fl i
is specified, all log entries are included.
.It Fl n
Specify the name of the varnishd to get logs from. If
.Fl n
is not specified, hostname is used. If varnishd was started with
Specifies the name of the
.Nm varnishd
instance to get logs from.
If
.Fl n
the option must be specified.
is not specified, the host name is used.
.It Fl r Ar file
Read log entries from
.Ar file
......
......@@ -444,7 +444,7 @@ main(int argc, char *argv[])
int i, c;
struct VSL_data *vd;
const char *ofn = NULL;
char *n_arg = NULL;
const char *n_arg = NULL;
int append = 0;
FILE *of;
......@@ -475,11 +475,6 @@ main(int argc, char *argv[])
usage();
}
}
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
if (VSL_OpenLog(vd, n_arg))
exit(1);
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd September 20, 2006
.Dd June 15, 2007
.Dt VARNISHSTAT 1
.Os
.Sh NAME
......@@ -53,11 +53,12 @@ The following options are available:
Instead of presenting of a continuously updated display, print the
statistics once and exit.
.It Fl n
Specify the name of the varnishd to get logs from. If
Specifies the name of the
.Nm varnishd
instance to get logs from.
If
.Fl n
is not specified, hostname is used. If varnishd was started with
.Fl n
the option must be specified.
is not specified, the host name is used.
.It Fl V
Display the version number and exit.
.It Fl w Ar delay
......
......@@ -141,7 +141,7 @@ main(int argc, char **argv)
int c;
struct varnish_stats *VSL_stats;
int delay = 1, once = 0;
char *n_arg = NULL;
const char *n_arg = NULL;
while ((c = getopt(argc, argv, "1n:Vw:")) != -1) {
switch (c) {
......@@ -161,15 +161,9 @@ main(int argc, char **argv)
usage();
}
}
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
if (!(VSL_stats = VSL_OpenStats(n_arg))) {
if ((VSL_stats = VSL_OpenStats(n_arg)) == NULL)
exit(1);
}
if (!once) {
do_curses(VSL_stats, delay);
......
......@@ -28,7 +28,7 @@
.\"
.\" $Id$
.\"
.Dd September 20, 2006
.Dd June 15, 2007
.Dt VARNISHTOP 1
.Os
.Sh NAME
......@@ -118,11 +118,12 @@ nor
.Fl i
is specified, all log entries are included.
.It Fl n
Specify the name of the varnishd to get logs from. If
Specifies the name of the
.Nm varnishd
instance to get logs from.
If
.Fl n
is not specified, hostname is used. If varnishd was started with
.Fl n
the option must be specified.
is not specified, the host name is used.
.It Fl r Ar file
Read log entries from
.Ar file
......
......@@ -113,7 +113,7 @@ main(int argc, char **argv)
unsigned u, v;
struct top *tp, *tp2;
int f_flag = 0;
char *n_arg = NULL;
const char *n_arg = NULL;
vd = VSL_New();
......@@ -140,11 +140,6 @@ main(int argc, char **argv)
usage();
}
}
if (n_arg == NULL) {
n_arg = malloc(HOST_NAME_MAX+1);
gethostname(n_arg, HOST_NAME_MAX+1);
}
if (VSL_OpenLog(vd, n_arg))
exit (1);
......
......@@ -50,12 +50,12 @@ vsl_handler VSL_H_Print;
struct VSL_data;
struct VSL_data *VSL_New(void);
void VSL_Select(struct VSL_data *vd, unsigned tag);
int VSL_OpenLog(struct VSL_data *vd, char *varnish_name);
int VSL_OpenLog(struct VSL_data *vd, const char *varnish_name);
void VSL_NonBlocking(struct VSL_data *vd, int nb);
int VSL_Dispatch(struct VSL_data *vd, vsl_handler *func, void *priv);
int VSL_NextLog(struct VSL_data *lh, unsigned char **pp);
int VSL_Arg(struct VSL_data *vd, int arg, const char *opt);
struct varnish_stats *VSL_OpenStats(char *varnish_name);
struct varnish_stats *VSL_OpenStats(const char *varnish_name);
extern const char *VSL_tags[256];
/* varnish_debug.c */
......
......@@ -102,7 +102,7 @@ const char *VSL_tags[256] = {
/*--------------------------------------------------------------------*/
static int
vsl_shmem_map(char* varnish_name)
vsl_shmem_map(const char *varnish_name)
{
int i;
struct shmloghead slh;
......@@ -170,16 +170,21 @@ VSL_Select(struct VSL_data *vd, unsigned tag)
/*--------------------------------------------------------------------*/
int
VSL_OpenLog(struct VSL_data *vd, char *varnish_name)
VSL_OpenLog(struct VSL_data *vd, const char *varnish_name)
{
char hostname[1024];
unsigned char *p;
CHECK_OBJ_NOTNULL(vd, VSL_MAGIC);
if (vd->fi != NULL)
return (0);
if (varnish_name == NULL) {
gethostname(hostname, sizeof hostname);
varnish_name = hostname;
}
if (vsl_shmem_map(varnish_name))
return (1);
return (-1);
vd->head = vsl_lh;
vd->logstart = (unsigned char *)vsl_lh + vsl_lh->start;
......@@ -477,7 +482,7 @@ VSL_Arg(struct VSL_data *vd, int arg, const char *opt)
}
struct varnish_stats *
VSL_OpenStats(char *varnish_name)
VSL_OpenStats(const char *varnish_name)
{
if (vsl_shmem_map(varnish_name))
......
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