Commit 51e8961f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move shm-related arg processing to mgt_shmem.c

Apply our naming system



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4795 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent a4a69df9
......@@ -42,8 +42,6 @@ void VCA_tweak_waiter(struct cli *cli, const char *arg);
void VSL_Panic(int *len, char **ptr);
/* mgt_shmem.c */
void VSL_MgtInit(const char *fn, unsigned size);
void VSL_MgtPid(void);
extern struct varnish_stats *VSL_stats;
extern struct shmloghead *loghead;
extern unsigned char *logstart;
......
......@@ -68,6 +68,10 @@ void MCF_ParamSet(struct cli *, const char *param, const char *val);
void MCF_DumpMdoc(void);
#endif
/* mgt_shmem.c */
void mgt_SHM_Init(const char *fn, const char *arg);
void mgt_SHM_Pid(void);
/* mgt_vcc.c */
void mgt_vcc_init(void);
int mgt_vcc_default(const char *bflag, const char *f_arg, char *vcl, int Cflag);
......
......@@ -126,10 +126,23 @@ vsl_buildnew(const char *fn, unsigned size)
}
void
VSL_MgtInit(const char *fn, unsigned size)
mgt_SHM_Init(const char *fn, const char *l_arg)
{
int i;
struct params *pp;
const char *arg_default = "80m";
const char *q;
uintmax_t size;
if (l_arg == NULL)
l_arg = arg_default;
q = str2bytes(l_arg, &size, 0);
if (q != NULL) {
fprintf(stderr, "Parameter error:\n");
fprintf(stderr, "\t-l ...: %s\n", q);
exit (1);
}
i = open(fn, O_RDWR, 0644);
if (i >= 0 && vsl_goodold(i)) {
......@@ -155,7 +168,7 @@ VSL_MgtInit(const char *fn, unsigned size)
}
void
VSL_MgtPid(void)
mgt_SHM_Pid(void)
{
loghead->master_pid = getpid();
......
......@@ -409,9 +409,7 @@ main(int argc, char * const *argv)
const char *b_arg = NULL;
const char *f_arg = NULL;
const char *i_arg = NULL;
const char *l_arg = "80m";
uintmax_t l_size;
const char *q;
const char *l_arg = NULL; /* default in mgt_shmem.c */
const char *h_arg = "critbit";
const char *M_arg = NULL;
const char *n_arg = NULL;
......@@ -604,13 +602,6 @@ main(int argc, char * const *argv)
usage();
}
q = str2bytes(l_arg, &l_size, 0);
if (q != NULL) {
fprintf(stderr, "Parameter error:\n");
fprintf(stderr, "\t-l ...: %s\n", q);
exit (1);
}
/* XXX: we can have multiple CLI actions above, is this enough ? */
if (cli[0].result != CLIS_OK) {
fprintf(stderr, "Parameter errors:\n");
......@@ -689,7 +680,7 @@ main(int argc, char * const *argv)
setup_hash(h_arg);
VSL_MgtInit(SHMLOG_FILENAME, l_size);
mgt_SHM_Init(SHMLOG_FILENAME, l_arg);
vsb_finish(vident);
AZ(vsb_overflowed(vident));
......@@ -697,7 +688,7 @@ main(int argc, char * const *argv)
if (!d_flag && !F_flag)
AZ(varnish_daemon(1, 0));
VSL_MgtPid();
mgt_SHM_Pid();
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
......
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