const char *units;
};
+static struct params master;
+
/*--------------------------------------------------------------------*/
static void
cli_result(cli, CLIS_PARAM);
return;
}
- if (params->user)
- free(params->user);
- params->user = strdup(pw->pw_name);
- AN(params->user);
- params->uid = pw->pw_uid;
+ if (master.user)
+ free(master.user);
+ master.user = strdup(pw->pw_name);
+ AN(master.user);
+ master.uid = pw->pw_uid;
/* set group to user's primary group */
- if (params->group)
- free(params->group);
+ if (master.group)
+ free(master.group);
if ((gr = getgrgid(pw->pw_gid)) != NULL &&
(gr = getgrnam(gr->gr_name)) != NULL &&
gr->gr_gid == pw->pw_gid) {
- params->group = strdup(gr->gr_name);
- AN(params->group);
+ master.group = strdup(gr->gr_name);
+ AN(master.group);
}
- params->gid = pw->pw_gid;
- } else if (params->user) {
- cli_out(cli, "%s (%d)", params->user, (int)params->uid);
+ master.gid = pw->pw_gid;
+ } else if (master.user) {
+ cli_out(cli, "%s (%d)", master.user, (int)master.uid);
} else {
- cli_out(cli, "%d", (int)params->uid);
+ cli_out(cli, "%d", (int)master.uid);
}
}
cli_result(cli, CLIS_PARAM);
return;
}
- if (params->group)
- free(params->group);
- params->group = strdup(gr->gr_name);
- AN(params->group);
- params->gid = gr->gr_gid;
- } else if (params->group) {
- cli_out(cli, "%s (%d)", params->group, (int)params->gid);
+ if (master.group)
+ free(master.group);
+ master.group = strdup(gr->gr_name);
+ AN(master.group);
+ master.gid = gr->gr_gid;
+ } else if (master.group) {
+ cli_out(cli, "%s (%d)", master.group, (int)master.gid);
} else {
- cli_out(cli, "%d", (int)params->gid);
+ cli_out(cli, "%d", (int)master.gid);
}
}
{
(void)par;
- tweak_generic_uint(cli, ¶ms->default_ttl, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.default_ttl, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_uint(cli, ¶ms->wthread_pools, arg,
+ tweak_generic_uint(cli, &master.wthread_pools, arg,
1, UINT_MAX);
}
{
(void)par;
- tweak_generic_uint(cli, ¶ms->wthread_min, arg,
- 0, params->wthread_max);
+ tweak_generic_uint(cli, &master.wthread_min, arg,
+ 0, master.wthread_max);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_uint(cli, ¶ms->wthread_max, arg,
- params->wthread_min, UINT_MAX);
+ tweak_generic_uint(cli, &master.wthread_max, arg,
+ master.wthread_min, UINT_MAX);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_timeout(cli, ¶ms->wthread_timeout, arg);
+ tweak_generic_timeout(cli, &master.wthread_timeout, arg);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_uint(cli, ¶ms->overflow_max, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.overflow_max, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_uint(cli, ¶ms->mem_workspace, arg,
+ tweak_generic_uint(cli, &master.mem_workspace, arg,
1024, UINT_MAX);
}
tweak_sess_timeout(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_timeout(cli, ¶ms->sess_timeout, arg);
+ tweak_generic_timeout(cli, &master.sess_timeout, arg);
}
/*--------------------------------------------------------------------*/
tweak_pipe_timeout(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_timeout(cli, ¶ms->pipe_timeout, arg);
+ tweak_generic_timeout(cli, &master.pipe_timeout, arg);
}
/*--------------------------------------------------------------------*/
tweak_send_timeout(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_timeout(cli, ¶ms->send_timeout, arg);
+ tweak_generic_timeout(cli, &master.send_timeout, arg);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_bool(cli, ¶ms->auto_restart, arg);
+ tweak_generic_bool(cli, &master.auto_restart, arg);
}
/*--------------------------------------------------------------------*/
{
(void)par;
- tweak_generic_uint(cli, ¶ms->fetch_chunksize, arg,
+ tweak_generic_uint(cli, &master.fetch_chunksize, arg,
4, UINT_MAX / 1024);
}
{
(void)par;
- tweak_generic_uint(cli, ¶ms->sendfile_threshold, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.sendfile_threshold, arg, 0, UINT_MAX);
}
#endif /* HAVE_SENDFILE */
tweak_vcl_trace(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_bool(cli, ¶ms->vcl_trace, arg);
+ tweak_generic_bool(cli, &master.vcl_trace, arg);
}
/*--------------------------------------------------------------------*/
if (arg == NULL) {
/* Quote the string if we have more than one socket */
if (heritage.nsocks > 1)
- cli_out(cli, "\"%s\"", params->listen_address);
+ cli_out(cli, "\"%s\"", master.listen_address);
else
- cli_out(cli, "%s", params->listen_address);
+ cli_out(cli, "%s", master.listen_address);
return;
}
return;
}
- free(params->listen_address);
- params->listen_address = strdup(arg);
- AN(params->listen_address);
+ free(master.listen_address);
+ master.listen_address = strdup(arg);
+ AN(master.listen_address);
clean_listen_sock_head(&heritage.socks);
heritage.nsocks = 0;
tweak_listen_depth(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_uint(cli, ¶ms->listen_depth, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.listen_depth, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
tweak_srcaddr_hash(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_uint(cli, ¶ms->srcaddr_hash, arg, 63, UINT_MAX);
+ tweak_generic_uint(cli, &master.srcaddr_hash, arg, 63, UINT_MAX);
}
/*--------------------------------------------------------------------*/
tweak_srcaddr_ttl(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_uint(cli, ¶ms->srcaddr_ttl, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.srcaddr_ttl, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
tweak_backend_http11(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_bool(cli, ¶ms->backend_http11, arg);
+ tweak_generic_bool(cli, &master.backend_http11, arg);
}
/*--------------------------------------------------------------------*/
tweak_client_http11(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_bool(cli, ¶ms->client_http11, arg);
+ tweak_generic_bool(cli, &master.client_http11, arg);
}
/*--------------------------------------------------------------------*/
tweak_ping_interval(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
- tweak_generic_uint(cli, ¶ms->ping_interval, arg, 0, UINT_MAX);
+ tweak_generic_uint(cli, &master.ping_interval, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
+void
+MCF_ParamSync(void)
+{
+ if (params != &master)
+ *params = master;
+}
+
+/*--------------------------------------------------------------------*/
+
void
MCF_ParamSet(struct cli *cli, const char *param, const char *val)
{
}
cli_result(cli, CLIS_PARAM);
cli_out(cli, "Unknown paramter \"%s\".", param);
+ MCF_ParamSync();
}
if (cli->result != CLIS_OK)
return;
}
+ params = &master;
}