passes config flags from king to pier

This commit is contained in:
Joe Bryan 2018-12-06 12:16:48 -05:00
parent 2c3387f018
commit 5906f480ad
3 changed files with 26 additions and 29 deletions

View File

@ -654,6 +654,7 @@
typedef struct _u3_pier {
c3_c* pax_c; // pier directory
c3_c* sys_c; // pill file
c3_w wag_w; // config flags
c3_d gen_d; // last event discovered
c3_d but_d; // boot barrier
c3_d tic_d[1]; // ticket (unstretched)
@ -1218,7 +1219,7 @@
/* u3_pier_create(): create a pier, loading existing.
*/
u3_pier*
u3_pier_create(c3_c* pax_c, c3_c* sys_c);
u3_pier_create(c3_w wag_w, c3_c* pax_c, c3_c* sys_c);
/* u3_pier_interrupt(): interrupt running process.
*/
@ -1260,7 +1261,8 @@
/* u3_pier_boot(): start the new pier system.
*/
void
u3_pier_boot(u3_noun who, // identity
u3_pier_boot(c3_w wag_w, // config flags
u3_noun who, // identity
u3_noun ven, // boot event
u3_noun pil, // type-of/path-to pill
u3_noun pax); // path to pier
@ -1268,7 +1270,7 @@
/* u3_pier_stay(): restart the new pier system.
*/
void
u3_pier_stay(u3_noun pax);
u3_pier_stay(c3_w wag_w, u3_noun pax);
/* u3_pier_tank(): dump single tank.
*/

View File

@ -7,6 +7,10 @@
#include "all.h"
#include "vere/vere.h"
// stash config flags for serf
//
static c3_c sag_w;
/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: wyrd: requires auth to a single relevant ship ::
@ -229,7 +233,7 @@ _king_boot(u3_noun bul)
void
_king_fake(u3_noun ship, u3_noun pill, u3_noun path)
{
u3_pier_boot(ship, u3nc(c3__fake, u3k(ship)), pill, path);
u3_pier_boot(sag_w, ship, u3nc(c3__fake, u3k(ship)), pill, path);
}
/* _king_come(): mine a comet under star (unit)
@ -245,7 +249,7 @@ _king_come(u3_noun star, u3_noun pill, u3_noun path)
void
_king_dawn(u3_noun seed, u3_noun pill, u3_noun path)
{
u3_pier_boot(u3k(u3h(seed)), u3_dawn_vent(seed), pill, path);
u3_pier_boot(sag_w, u3k(u3h(seed)), u3_dawn_vent(seed), pill, path);
}
/* _king_exit(): exit parser
@ -266,7 +270,7 @@ _king_pier(u3_noun pier)
exit(1);
}
u3_pier_stay(u3k(u3t(pier)));
u3_pier_stay(sag_w, u3k(u3t(pier)));
u3z(pier);
}
@ -550,9 +554,10 @@ u3_king_commence()
{
u3_Host.lup_u = uv_default_loop();
/* start up a "fast-compile" arvo for internal use only
** (with hashboard always disabled)
*/
// start up a "fast-compile" arvo for internal use only
// (with hashboard always disabled)
//
sag_w = u3C.wag_w;
u3C.wag_w |= u3o_hashless;
u3m_boot_pier();

View File

@ -1389,7 +1389,6 @@ _pier_work_create(u3_pier* pir_u)
c3_c* pax_c;
c3_c key_c[256];
c3_c wag_c[11];
c3_w wag_w;
c3_i err_i;
pax_c = c3_malloc(1 + strlen(pir_u->pax_c));
@ -1401,18 +1400,7 @@ _pier_work_create(u3_pier* pir_u)
pir_u->key_d[2],
pir_u->key_d[3]);
{
/* restore hashboard if appropriate
** (otherwise always be disabled in king.c)
*/
wag_w = u3C.wag_w;
if ( c3n == u3_Host.ops_u.has ) {
wag_w &= ~u3o_hashless;
}
sprintf(wag_c, "%u", u3C.wag_w);
}
sprintf(wag_c, "%u", pir_u->wag_w);
arg_c[0] = "bin/urbit-worker"; // executable
arg_c[1] = pax_c; // path to checkpoint directory
@ -1464,7 +1452,7 @@ _pier_work_create(u3_pier* pir_u)
/* u3_pier_create(): create a pier, loading existing.
*/
u3_pier*
u3_pier_create(c3_c* pax_c, c3_c* sys_c)
u3_pier_create(c3_w wag_w, c3_c* pax_c, c3_c* sys_c)
{
u3_pier* pir_u;
@ -1479,6 +1467,7 @@ u3_pier_create(c3_c* pax_c, c3_c* sys_c)
pir_u->sys_c = c3_malloc(1 + strlen(sys_c));
strcpy(pir_u->sys_c, sys_c);
pir_u->wag_w = wag_w;
pir_u->gen_d = 0;
pir_u->key_d[0] = pir_u->key_d[1] = pir_u->key_d[2] = pir_u->key_d[3] = 0;
@ -1984,7 +1973,7 @@ u3_pier_stub(void)
/* _pier_boot_make(): create/load a pier.
*/
static u3_pier*
_pier_boot_make(u3_noun pax, u3_noun sys)
_pier_boot_make(c3_w wag_w, u3_noun pax, u3_noun sys)
{
c3_c* pax_c = u3r_string(pax);
c3_c* sys_c;
@ -1993,7 +1982,7 @@ _pier_boot_make(u3_noun pax, u3_noun sys)
c3_assert( c3y == u3h(sys) );
sys_c = u3r_string(u3t(sys));
pir_u = u3_pier_create(pax_c, sys_c);
pir_u = u3_pier_create(wag_w, pax_c, sys_c);
u3z(pax); free(pax_c);
u3z(sys); free(sys_c);
@ -2006,7 +1995,8 @@ _pier_boot_make(u3_noun pax, u3_noun sys)
/* u3_pier_boot(): start the new pier system.
*/
void
u3_pier_boot(u3_noun who, // identity
u3_pier_boot(c3_w wag_w, // config flags
u3_noun who, // identity
u3_noun ven, // boot event
u3_noun pil, // type-of/path-to pill
u3_noun pax) // path to pier
@ -2015,7 +2005,7 @@ u3_pier_boot(u3_noun who, // identity
/* make/load pier
*/
pir_u = _pier_boot_make(pax, pil);
pir_u = _pier_boot_make(wag_w, pax, pil);
/* set boot params
*/
@ -2059,13 +2049,13 @@ u3_pier_boot(u3_noun who, // identity
/* u3_pier_stay(): resume the new pier system.
*/
void
u3_pier_stay(u3_noun pax)
u3_pier_stay(c3_w wag_w, u3_noun pax)
{
u3_pier* pir_u;
/* make/load pier
*/
pir_u = _pier_boot_make(pax, u3_nul);
pir_u = _pier_boot_make(wag_w, pax, u3_nul);
/* initialize polling handle
*/