Make hastctl(1) ('list' command) output a worker pid.

Reviewed by:	pjd
MFC after:	3 days
This commit is contained in:
Mikolaj Golub 2013-07-01 18:41:07 +00:00
parent 5dd4da9f24
commit 14f200d97e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252472
2 changed files with 5 additions and 0 deletions

View File

@ -293,6 +293,7 @@ control_set_role(struct nv *nv, const char *newrole)
static int static int
control_list(struct nv *nv) control_list(struct nv *nv)
{ {
pid_t pid;
unsigned int ii; unsigned int ii;
const char *str; const char *str;
int error, ret; int error, ret;
@ -331,6 +332,9 @@ control_list(struct nv *nv)
str = nv_get_string(nv, "status%u", ii); str = nv_get_string(nv, "status%u", ii);
if (str != NULL) if (str != NULL)
printf(" status: %s\n", str); printf(" status: %s\n", str);
pid = nv_get_int32(nv, "workerpid%u", ii);
if (pid != 0)
printf(" workerpid: %d\n", pid);
printf(" dirty: %ju (%NB)\n", printf(" dirty: %ju (%NB)\n",
(uintmax_t)nv_get_uint64(nv, "dirty%u", ii), (uintmax_t)nv_get_uint64(nv, "dirty%u", ii),
(intmax_t)nv_get_uint64(nv, "dirty%u", ii)); (intmax_t)nv_get_uint64(nv, "dirty%u", ii));

View File

@ -271,6 +271,7 @@ control_status(struct hastd_config *cfg, struct nv *nvout,
nv_add_string(nvout, compression_name(res->hr_compression), nv_add_string(nvout, compression_name(res->hr_compression),
"compression%u", no); "compression%u", no);
nv_add_string(nvout, role2str(res->hr_role), "role%u", no); nv_add_string(nvout, role2str(res->hr_role), "role%u", no);
nv_add_int32(nvout, res->hr_workerpid, "workerpid%u", no);
switch (res->hr_role) { switch (res->hr_role) {
case HAST_ROLE_PRIMARY: case HAST_ROLE_PRIMARY: