From 37de4ba83caf467fb559e54883322d08a7c8bed4 Mon Sep 17 00:00:00 2001 From: midipix Date: Jul 06 2020 06:00:15 +0000 Subject: logging: toks_log_token_info(): output pending requests info. --- diff --git a/src/log/toks_log_token_info.c b/src/log/toks_log_token_info.c index b95ebd3..3cb711e 100644 --- a/src/log/toks_log_token_info.c +++ b/src/log/toks_log_token_info.c @@ -19,9 +19,11 @@ void toks_log_token_info(struct toks_daemon_ctx * dctx) TOKS_LOG_LEVEL(drvctx,1); int idx; + int nwaiters; char path[2048]; char tokstr[64]; struct toks_token * token; + struct toks_waiter * waiter; toks_log_service_info(dctx); @@ -100,4 +102,87 @@ void toks_log_token_info(struct toks_daemon_ctx * dctx) "\n",0); } } + + if ((nwaiters = toks_get_driver_nwaiters(dctx->driver_ctx)) == 0) + return; + + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_1, + "\n",0); + + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_2, + "%-11s%-55s%-12s%-14s%s\n", + "waiter no.", + "token id.", + "token pid", + "token syspid", + "token refstr", + 0); + + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_2, + "%-11s%-55s%-12s%-14s%s\n", + "==========", + "=========", + "=========", + "============", + "============", + 0); + + idx = 0; + waiter = dctx->waiter_first; + + for (; idxmsg.header.msg_id) { + toks_log_get_process_name( + waiter->client.hprocess, + path,sizeof(path)); + + ntapi->sprintf( + tokstr, + "%08x-%08x-%08x-%08x-%08x-%08x", + waiter->msg.syncinfo.ipckeys[0], + waiter->msg.syncinfo.ipckeys[1], + waiter->msg.syncinfo.ipckeys[2], + waiter->msg.syncinfo.ipckeys[3], + waiter->msg.syncinfo.ipckeys[4], + waiter->msg.syncinfo.ipckeys[5]); + + if (waiter->client.tokpid) { + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_2, + "*%-10d%-55s%-12d%-14d%s\n", + ++idx,tokstr, + waiter->client.tokpid, + waiter->client.cid.process_id, + waiter->msg.syncinfo.ipcsvc.keys.key); + } else { + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_2, + "*%-10d%-55s%-12s%-14d%s\n", + ++idx,tokstr,"N/A", + waiter->client.cid.process_id, + waiter->msg.syncinfo.ipcsvc.keys.key); + } + + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_2, + "%-11s%s.\n",(char[]){0},path); + + toks_log_write( + drvctx, + TOKS_LOG_ENTRY_SUB_LEVEL_1, + "\n",0); + } + + if (++waiter == dctx->waiter_cap) + waiter = dctx->waiter_base; + } }