From 8892d5b2e8933c3d496fc4bcf38a89740a21be6e Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 12 Jan 2008 15:49:44 +0000 Subject: [PATCH] STABLE14-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 00c3ab167..0b4c6f39d 100644 --- a/src/venus/cmdebug.c +++ b/src/venus/cmdebug.c @@ -39,6 +39,8 @@ RCSID extern struct hostent *hostutil_GetHostByName(); +static int print_ctime = 0; + static int PrintCacheConfig(struct rx_connection *aconn) { @@ -303,8 +305,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 */ @@ -405,8 +412,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 */ @@ -499,6 +511,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; @@ -563,6 +579,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