vere: lord info

This commit is contained in:
Jōshin 2022-03-06 16:33:53 -05:00
parent 3400e55b2d
commit a480b2a91f
No known key found for this signature in database
GPG Key ID: A8BE5A9A521639D0
5 changed files with 56 additions and 12 deletions

View File

@ -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')

View File

@ -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.
*/

View File

@ -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.

View File

@ -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;

View File

@ -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);
}
}