diff --git a/pkg/urbit/include/c/motes.h b/pkg/urbit/include/c/motes.h index 3e5a4108b3..ae710af467 100644 --- a/pkg/urbit/include/c/motes.h +++ b/pkg/urbit/include/c/motes.h @@ -696,6 +696,7 @@ # define c3__look c3_s4('l','o','o','k') # define c3__loop c3_s4('l','o','o','p') # define c3__lorb c3_s4('l','o','r','b') +# define c3__lord c3_s4('l','o','r','d') # define c3__lort c3_s4('l','o','r','t') # define c3__lose c3_s4('l','o','s','e') # define c3__loss c3_s4('l','o','s','s') diff --git a/pkg/urbit/include/vere/vere.h b/pkg/urbit/include/vere/vere.h index 0641b59a43..6157bedd4d 100644 --- a/pkg/urbit/include/vere/vere.h +++ b/pkg/urbit/include/vere/vere.h @@ -990,10 +990,15 @@ c3_d key_d[4], u3_lord_cb cb_u); - /* u3_lord_info(): print status info. + /* u3_lord_info(): status info as a $mass. + */ + u3_noun + u3_lord_info(u3_lord* god_u); + + /* u3_lord_slog(): print status info. */ void - u3_lord_info(u3_lord* god_u); + u3_lord_slog(u3_lord* god_u); /* u3_lord_exit(): shutdown gracefully. */ @@ -1253,10 +1258,15 @@ void u3_newt_read(u3_moat* mot_u); - /* u3_newt_moat_info(); print status info. + /* u3_newt_moat_info(): status info as $mass. + */ + u3_noun + u3_newt_moat_info(u3_moat* mot_u); + + /* u3_newt_moat_slog(); print status info. */ void - u3_newt_moat_info(u3_moat* mot_u); + u3_newt_moat_slog(u3_moat* mot_u); /* u3_newt_moat_stop(); newt stop/close input stream. */ diff --git a/pkg/urbit/vere/lord.c b/pkg/urbit/vere/lord.c index 89831e7d91..3428a1ff38 100644 --- a/pkg/urbit/vere/lord.c +++ b/pkg/urbit/vere/lord.c @@ -1107,17 +1107,33 @@ _lord_on_serf_bail(void* ptr_v, _lord_bail(god_u); } -/* u3_lord_info(): print status info. +/* u3_lord_info(): status info as $mass. +*/ +u3_noun +u3_lord_info(u3_lord* god_u) +{ + return u3_pier_mass( + c3__lord, + u3i_list( + u3_pier_mase("live", god_u->liv_o), + u3_pier_mase("event", u3i_chub(god_u->eve_d)), + u3_pier_mase("mug", god_u->mug_l), + u3_pier_mase("queue", u3i_word(god_u->dep_w)), + u3_newt_moat_info(&god_u->out_u), + u3_none)); +} + +/* u3_lord_slog(): print status info. */ void -u3_lord_info(u3_lord* god_u) +u3_lord_slog(u3_lord* god_u) { u3l_log(" lord: live=%s, event=%" PRIu64 ", mug=%x, queue=%u\n", ( c3y == god_u->liv_o ) ? "&" : "|", god_u->eve_d, god_u->mug_l, god_u->dep_w); - u3_newt_moat_info(&god_u->out_u); + u3_newt_moat_slog(&god_u->out_u); } /* u3_lord_init(): instantiate child process. diff --git a/pkg/urbit/vere/newt.c b/pkg/urbit/vere/newt.c index e9cdff4720..02dd23b10a 100644 --- a/pkg/urbit/vere/newt.c +++ b/pkg/urbit/vere/newt.c @@ -352,10 +352,28 @@ u3_newt_read(u3_moat* mot_u) _newt_read_init(mot_u, _newt_read_cb); } -/* u3_newt_moat_info(); print status info. +/* u3_newt_moat_info(): status info as $mass. +*/ +u3_noun +u3_newt_moat_info(u3_moat* mot_u) +{ + u3_meat* met_u = mot_u->ext_u; + c3_w len_w = 0; + + while ( met_u ) { + len_w++; + met_u = met_u->nex_u; + } + return u3_pier_mass( + c3__moat, + u3i_list(u3_pier_mase("pending-inbound", u3i_word(len_w)), + u3_none)); +} + +/* u3_newt_moat_slog(); print status info. */ void -u3_newt_moat_info(u3_moat* mot_u) +u3_newt_moat_slog(u3_moat* mot_u) { u3_meat* met_u = mot_u->ext_u; c3_w len_w = 0; diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index b6cb18f742..2f389291a6 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -1459,8 +1459,6 @@ u3_pier_info(u3_pier* pir_u) { u3_noun nat; - // TODO lord info - // switch (pir_u->sat_e) { default: { nat = u3_pier_mass(u3i_string("state-unknown"), u3_nul); @@ -1519,6 +1517,7 @@ u3_pier_info(u3_pier* pir_u) u3i_list( nat, u3_disk_info(pir_u->log_u), + u3_lord_info(pir_u->god_u), u3_none)); } @@ -1592,7 +1591,7 @@ u3_pier_slog(u3_pier* pir_u) } if ( pir_u->god_u ) { - u3_lord_info(pir_u->god_u); + u3_lord_slog(pir_u->god_u); } }