From 5cbdd5c93e2ee9af8be7362ca3e671689d730a27 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 10 Nov 2007 00:19:20 +0000 Subject: [PATCH] DEVEL15-cmdebug-human-readable-expiration-time-20071109 add -ctime parameter which produces human readable expiration times. Doesn't work with OpenAFS for Windows prior to 1.5.28 because time() was not used in those versions for tracking expiration times. (cherry picked from commit 578e0d957547e4ac7f39b0559e166fd9eea5f150) --- src/venus/cmdebug.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/venus/cmdebug.c b/src/venus/cmdebug.c index 90fe9c15d..81b1c6179 100644 --- a/src/venus/cmdebug.c +++ b/src/venus/cmdebug.c @@ -40,6 +40,8 @@ RCSID extern struct hostent *hostutil_GetHostByName(); +static int print_ctime = 0; + static int PrintCacheConfig(struct rx_connection *aconn) { @@ -304,8 +306,13 @@ PrintCacheEntries32(struct rx_connection *aconn, int aint32) } printf(" %12d bytes DV %12d refcnt %5d\n", centry.Length, centry.DataVersion, centry.refCount); - printf(" callback %08x\texpires %u\n", centry.callback, - centry.cbExpires); + if (print_ctime) { + time_t t = centry.cbExpires; + printf(" callback %08x\texpires %s\n", centry.callback, + ctime(&t)); + } else + printf(" callback %08x\texpires %u\n", centry.callback, + centry.cbExpires); printf(" %d opens\t%d writers\n", centry.opens, centry.writers); /* now display states */ @@ -406,8 +413,13 @@ PrintCacheEntries64(struct rx_connection *aconn, int aint32) printf(" %12d bytes DV %12d refcnt %5d\n", centry.Length, centry.DataVersion, centry.refCount); #endif - printf(" callback %08x\texpires %u\n", centry.callback, - centry.cbExpires); + if (print_ctime) { + time_t t = centry.cbExpires; + printf(" callback %08x\texpires %s\n", centry.callback, + ctime(&t)); + } else + printf(" callback %08x\texpires %u\n", centry.callback, + centry.cbExpires); printf(" %d opens\t%d writers\n", centry.opens, centry.writers); /* now display states */ @@ -500,6 +512,10 @@ CommandProc(struct cmd_syndesc *as, void *arock) PrintCacheConfig(conn); return 0; } + + if (as->parms[7].items) + print_ctime = 1; + if (as->parms[2].items) /* -long */ int32p = 1; @@ -564,6 +580,8 @@ main(int argc, char **argv) "print only host interfaces"); cmd_AddParm(ts, "-cache", CMD_FLAG, CMD_OPTIONAL, "print only cache configuration"); + cmd_AddParm(ts, "-ctime", CMD_FLAG, CMD_OPTIONAL, + "print human readable expiration time"); cmd_Dispatch(argc, argv); exit(0); -- 2.39.5