Commit 9584dc03 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move cache_param entirely into the cache * namespace and communicate

it via heritage.
parent eb18d9be
...@@ -784,6 +784,7 @@ int HTC_Complete(struct http_conn *htc); ...@@ -784,6 +784,7 @@ int HTC_Complete(struct http_conn *htc);
#undef HTTPH #undef HTTPH
/* cache_main.c */ /* cache_main.c */
extern volatile struct params * cache_param;
void THR_SetName(const char *name); void THR_SetName(const char *name);
const char* THR_GetName(void); const char* THR_GetName(void);
void THR_SetSession(const struct sess *sp); void THR_SetSession(const struct sess *sp);
......
...@@ -96,6 +96,8 @@ child_main(void) ...@@ -96,6 +96,8 @@ child_main(void)
setbuf(stderr, NULL); setbuf(stderr, NULL);
printf("Child starts\n"); printf("Child starts\n");
cache_param = heritage.param;
AZ(pthread_key_create(&sp_key, NULL)); AZ(pthread_key_create(&sp_key, NULL));
AZ(pthread_key_create(&name_key, NULL)); AZ(pthread_key_create(&name_key, NULL));
......
...@@ -60,6 +60,8 @@ struct heritage { ...@@ -60,6 +60,8 @@ struct heritage {
struct vsm_sc *vsm; struct vsm_sc *vsm;
struct params *param;
char *name; char *name;
char identity[1024]; char identity[1024];
}; };
......
...@@ -193,9 +193,3 @@ struct params { ...@@ -193,9 +193,3 @@ struct params {
ssize_t vsm_space; ssize_t vsm_space;
ssize_t vsl_space; ssize_t vsl_space;
}; };
/*
* We declare this a volatile pointer, so that reads of parameters
* become atomic, leaving the CLI thread lattitude to change the values
*/
extern volatile struct params * cache_param;
...@@ -315,7 +315,7 @@ start_child(struct cli *cli) ...@@ -315,7 +315,7 @@ start_child(struct cli *cli)
heritage.std_fd = cp[1]; heritage.std_fd = cp[1];
child_output = cp[0]; child_output = cp[0];
AN(cache_param); AN(heritage.param);
if ((pid = fork()) < 0) { if ((pid = fork()) < 0) {
perror("Could not fork child"); perror("Could not fork child");
exit(1); exit(1);
......
...@@ -1205,8 +1205,8 @@ MCF_ParamSet(struct cli *cli, const char *param, const char *val) ...@@ -1205,8 +1205,8 @@ MCF_ParamSet(struct cli *cli, const char *param, const char *val)
} }
pp->func(cli, pp, val); pp->func(cli, pp, val);
if (cli->result == CLIS_OK && cache_param != NULL) if (cli->result == CLIS_OK && heritage.param != NULL)
*cache_param = mgt_param; *heritage.param = mgt_param;
if (cli->result != CLIS_OK) { if (cli->result != CLIS_OK) {
VCLI_Out(cli, "(attempting to set param %s to %s)\n", VCLI_Out(cli, "(attempting to set param %s to %s)\n",
......
...@@ -210,9 +210,10 @@ mgt_SHM_Init(void) ...@@ -210,9 +210,10 @@ mgt_SHM_Init(void)
AZ(atexit(mgt_shm_atexit)); AZ(atexit(mgt_shm_atexit));
cache_param = VSM_Alloc(sizeof *cache_param, VSM_CLASS_PARAM, "", ""); heritage.param =
AN(cache_param); VSM_Alloc(sizeof *heritage.param, VSM_CLASS_PARAM, "", "");
*cache_param = mgt_param; AN(heritage.param);
*heritage.param = mgt_param;
PAN_panicstr_len = 64 * 1024; PAN_panicstr_len = 64 * 1024;
PAN_panicstr = VSM_Alloc(PAN_panicstr_len, PAN_CLASS, "", ""); PAN_panicstr = VSM_Alloc(PAN_panicstr_len, PAN_CLASS, "", "");
......
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