diff --git a/include/toksvc/toksvc.h b/include/toksvc/toksvc.h index 8b88959..3dde4f0 100644 --- a/include/toksvc/toksvc.h +++ b/include/toksvc/toksvc.h @@ -64,6 +64,8 @@ extern "C" { #define TOKS_DRIVER_ACTION_SVCINFO_GET 0X10000000 #define TOKS_DRIVER_ACTION_SVCINFO_LOG 0X20000000 +#define TOKS_DRIVER_ACTION_TOKINFO_LOG 0X80000000 + /* message options */ #define TOKS_OPT_SYSTEM_PID 0x0000 #define TOKS_OPT_FRAMEWORK_PID 0x0001 diff --git a/src/driver/toks_amain.c b/src/driver/toks_amain.c index 7a92ce6..35a8092 100644 --- a/src/driver/toks_amain.c +++ b/src/driver/toks_amain.c @@ -253,6 +253,28 @@ int toks_main(char ** argv, char ** envp) } } + if (dctx->cctx->drvflags & TOKS_DRIVER_ACTION_TOKINFO_LOG) { + status = toks_service_ioctl(dctx,TOKS_IOCTL_LOG_TOKEN_INFO,0,0); + ret = status ? 2 : 0; + + switch (status) { + case NT_STATUS_SUCCESS: + toks_dprintf(STDERR_FILENO, + "%s: a service info log record, " + "followed by a info table for currently " + "allocated tokens, was successfully created\n", + toks_log_basename(argv[0])); + break; + + default: + toks_dprintf(STDERR_FILENO, + "%s: the TOKS_IOCTL_LOG_TOKEN_INFO " + "ioctl operataion has failed " + "(check the system's documentation) [0x%x].", + toks_log_basename(argv[0]),status); + } + } + if (dctx->cctx->drvflags & TOKS_DRIVER_ACTION_ABORT) { ret = (status = toks_service_abort(dctx)) ? 2 : 0; diff --git a/src/driver/toks_driver_ctx.c b/src/driver/toks_driver_ctx.c index 38475e3..87cce27 100644 --- a/src/driver/toks_driver_ctx.c +++ b/src/driver/toks_driver_ctx.c @@ -659,6 +659,12 @@ int toks_get_driver_ctx( cctx.drvflags |= TOKS_DRIVER_ACTION_SVCINFO_LOG; break; + case TAG_LOGTOKINFO: + cctx.drvflags &= ~(uint64_t)TOKS_DRIVER_MODE_SERVER; + cctx.drvflags |= TOKS_DRIVER_MODE_CLIENT; + cctx.drvflags |= TOKS_DRIVER_ACTION_TOKINFO_LOG; + break; + case TAG_LOGLEVELGET: cctx.drvflags &= ~(uint64_t)TOKS_DRIVER_MODE_SERVER; cctx.drvflags |= TOKS_DRIVER_MODE_CLIENT; diff --git a/src/internal/toksvc_driver_impl.h b/src/internal/toksvc_driver_impl.h index 818dd02..4a55b21 100644 --- a/src/internal/toksvc_driver_impl.h +++ b/src/internal/toksvc_driver_impl.h @@ -50,6 +50,7 @@ enum app_tags { TAG_LOGLEVELSET, TAG_GETSVCINFO, TAG_LOGSVCINFO, + TAG_LOGTOKINFO, }; struct toks_ticks { diff --git a/src/skin/toks_skin_default.c b/src/skin/toks_skin_default.c index b563b14..ffac44a 100644 --- a/src/skin/toks_skin_default.c +++ b/src/skin/toks_skin_default.c @@ -93,6 +93,11 @@ const struct argv_option toks_default_options[] = { "connect to the server and request that the current " "service information be sent to its log"}, + {"log-token-info", 'S',TAG_LOGTOKINFO,ARGV_OPTARG_NONE,0,0,0, + "connect to the server and request that the current " + "service information, along with information about all " + "currently allocated tokens, be sent to the log"}, + {"get-log-level", 'g',TAG_LOGLEVELGET,ARGV_OPTARG_NONE,0,0,0, "connect to the server and output the service's " "current log level"},