hmp: add info iothreads command
PATCH 1/1 hmp: add info iothreads command
Make "info iothreads" available on the HMP monitor.
The results are as follows:
id1: thread_id1
id2: thread_id2
Signed-off-by Ting Wang <[email protected]>
--- hmp-commands.hx | 2 ++ hmp.c | 21 +++++++++++++++++++++ hmp.h | 1 + monitor.c | 7 +++++++ 4 files changed, 31 insertions(+)
hmp-commands.hx +2 -0
@@ -1746,6 +1746,8 @@ show roms show the TPM device @item info memory-devices show the memory devices +@item info iothreads +show iothreads @end table ETEXI
hmp.c +21 -0
@@ -821,6 +821,27 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)qapi_free_TPMInfoList (info_list); } +void hmp_info_iothreads (Monitor *mon,const QDict *qdict) +{ +IOThreadInfoList *head =NULL , *elem =NULL ; + + head =qmp_query_iothreads (NULL ); +if (!head) { +monitor_printf (mon,"No iothread has been added\n" ); +return ; + } + + elem = head; +while (elem) { +if (elem->value) +monitor_printf (mon,"%s: thread_id=%ld\n" , elem->value->id, + elem->value->thread_id); + elem = elem->next; + } + +qapi_free_IOThreadInfoList (head); +} +void hmp_quit (Monitor *mon,const QDict *qdict) {monitor_suspend (mon);
hmp.h +1 -0
@@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict);void hmp_info_pci (Monitor *mon,const QDict *qdict);void hmp_info_block_jobs (Monitor *mon,const QDict *qdict);void hmp_info_tpm (Monitor *mon,const QDict *qdict); +void hmp_info_iothreads (Monitor *mon,const QDict *qdict);void hmp_quit (Monitor *mon,const QDict *qdict);void hmp_stop (Monitor *mon,const QDict *qdict);void hmp_system_reset (Monitor *mon,const QDict *qdict);
monitor.c +7 -0
@@ -2924,6 +2924,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_memory_devices, }, { + .name = "iothreads", + .args_type = "", + .params = "", + .help = "show iothreads", + .mhandler.cmd = hmp_info_iothreads, + }, + { .name = NULL, }, };
Signature · 1 line
1.8.5
hmp.c void hmp_info_tpm(Monitor *mon, const QDict *qdict) · line 838
Quoted 3 lines · Ting Wang
hmp.c +3
-0+if (elem->value) +monitor_printf (mon,"%s: thread_id=%ld\n" , elem->value->id, + elem->value->thread_id);
Braces are required for if.
Fam
Quoted 10 lines · Fam Zheng
hmp.c void hmp_info_tpm(Monitor *mon, const QDict *qdict) · line 838
Quoted 3 lines · Ting Wang
hmp.c +3
-0+if (elem->value) +monitor_printf (mon,"%s: thread_id=%ld\n" , elem->value->id, + elem->value->thread_id);Braces are required for if.
Fam
Okay, will fix in v2, thanks.
Ting