From de5c0d664dc428c351a4b160103ffd8e14ca698f Mon Sep 17 00:00:00 2001 From: Aurel Feer Date: Thu, 2 Jun 2022 15:44:18 +0200 Subject: [PATCH] add names to ps command --- usr/shelly/shelly_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr/shelly/shelly_cmd.c b/usr/shelly/shelly_cmd.c index a27c264..1687689 100644 --- a/usr/shelly/shelly_cmd.c +++ b/usr/shelly/shelly_cmd.c @@ -115,7 +115,11 @@ static errval_t shelly_cmd_ps(char * line) { shelly_write_str("PIDs:\n\r"); char buf[256]; for(size_t i = 0; i < pid_count; ++i) { - snprintf(buf, 256, " %lu\n\r", pids[i]); + // get process name + char *name; + err = aos_rpc_process_get_name(rpc, pids[i], &name); + if (err_is_fail(err)) name = "unknown name"; + snprintf(buf, 256, " %lu : %s\n\r", pids[i], name); shelly_write_str(buf); } return SYS_ERR_OK;