From owner-freebsd-bugs Sun Feb 20 12:10: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 49AB937BFCF for ; Sun, 20 Feb 2000 12:10:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA34450; Sun, 20 Feb 2000 12:10:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from germanium.xtalwind.net (germanium.xtalwind.net [205.160.242.5]) by hub.freebsd.org (Postfix) with ESMTP id BF1B837BED6 for ; Sun, 20 Feb 2000 12:01:43 -0800 (PST) (envelope-from jack@germanium.xtalwind.net) Received: (from jack@localhost) by germanium.xtalwind.net (8.9.3/8.9.3) id PAA01489; Sun, 20 Feb 2000 15:01:37 -0500 (EST) Message-Id: <200002202001.PAA01489@germanium.xtalwind.net> Date: Sun, 20 Feb 2000 15:01:37 -0500 (EST) From: jack@germanium.xtalwind.net Reply-To: jack@germanium.xtalwind.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/16838: MFC: phk's print uptime at reboot Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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