Date: Sun, 20 Feb 2000 15:01:37 -0500 (EST) From: jack@germanium.xtalwind.net To: FreeBSD-gnats-submit@freebsd.org Subject: kern/16838: MFC: phk's print uptime at reboot Message-ID: <200002202001.PAA01489@germanium.xtalwind.net>
next in thread | raw e-mail | index | archive | help
>Number: 16838 >Category: kern >Synopsis: MFC: phk's print uptime at reboot >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Feb 20 12:10:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: >Release: FreeBSD 3.4-STABLE i386 >Organization: >Environment: >Description: The original commit pretty well covers it. :) I always forget to check before I reboot a system, and while it boots I try in vain to remember which month or even year this system was last booted in. Print out the uptime before rebooting, and give people like me less (or more as it may be) to think about while the systems boots. >How-To-Repeat: >Fix: --- kern_shutdown.c.orig Sun Aug 29 12:26:02 1999 +++ kern_shutdown.c Sun Feb 20 14:39:53 2000 @@ -125,6 +125,7 @@ static void boot __P((int)) __dead2; static void dumpsys __P((void)); +static void print_uptime __P((void)); #ifndef _SYS_SYSPROTO_H_ struct reboot_args { @@ -168,6 +169,33 @@ static int waittime = -1; static struct pcb dumppcb; +static void +print_uptime() +{ + int f; + struct timespec ts; + + getnanouptime(&ts); + printf("Uptime: "); + f = 0; + if (ts.tv_sec >= 86400) { + printf("%ldd", ts.tv_sec / 86400); + ts.tv_sec %= 86400; + f = 1; + } + if (f || ts.tv_sec >= 3600) { + printf("%ldh", ts.tv_sec / 3600); + ts.tv_sec %= 3600; + f = 1; + } + if (f || ts.tv_sec >= 60) { + printf("%ldm", ts.tv_sec / 60); + ts.tv_sec %= 60; + f = 1; + } + printf("%lds\n", ts.tv_sec); +} + /* * Go through the rigmarole of shutting down.. * this used to be in machdep.c but I'll be dammned if I could see @@ -271,6 +299,8 @@ } DELAY(100000); /* wait for console output to finish */ } + + print_uptime(); /* * Ok, now do things that assume all filesystem activity has >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002202001.PAA01489>