*BSD News Article 93912


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!newsxfer.itd.umich.edu!newsxfer3.itd.umich.edu!news.maxwell.syr.edu!news-xfer.cybernet.dk!news.new-york.net!wlbr!moe.2bsd.com!sms
From: sms@moe.2bsd.com (Steven M. Schultz)
Subject: ruptime vs. systems up more than a year (#368)
Organization: 2BSD, Simi Valley CA USA
Message-ID: <E8vCus.1Cp@moe.2bsd.com>
Date: Sat, 19 Apr 1997 05:06:28 GMT
Lines: 134
Xref: euryale.cc.adfa.oz.au comp.bugs.2bsd:749

Subject: ruptime vs. systems up more than a year (#368)
Index:	ucb/ruptime.c 2.11BSD

Description:
	ruptime prints "??:??" if it sees a system up more than a year.

Repeat-By:
	Have a system stay up for a year (a good UPS helps a *lot*).  Do a
	'ruptime -a' and observe:

catbert     down 10+15:02
curly         up     0:48,     1 user,   load 0.73, 0.45, 0.44
curlyjoe    down 70+12:26
larry         up     2:00,     1 user,   load 1.43, 1.39, 1.19
moe           up  6+15:30,     6 users,  load 2.06, 2.08, 2.08
ns3              up ??:??,     0 users,  load 0.10, 0.17, 0.11

Fix:
	Apply the small patch below.  It simply extends, to 3 years, the
	interval ruptime will believe as reasonable.

	Cut where indicated, saving to a file (/tmp/368) and then:

		patch -p0 < /tmp/368
		cd /usr/src/ucb
		make ruptime
		install -s -m 755 ruptime /usr/ucb/ruptime

	The output from ruptime looks like this after installing the new
	version:

catbert     down  10+15:02
curly         up      0:48,     1 user,   load 0.73, 0.45, 0.44
curlyjoe    down  70+12:27
larry         up      2:00,     1 user,   load 1.43, 1.39, 1.19
moe           up   6+15:30,     6 users,  load 2.06, 2.08, 2.08
ns3           up 382+06:05,     0 users,  load 0.10, 0.17, 0.11

	Oh, in case you're wondering - curlyjoe's the notebook (BSD of course)
	and doesn't always run 'rwhod'.

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

--------------------------cut here-------------------------
*** /usr/src/ucb/ruptime.c.old	Thu Jan 12 08:50:56 1989
--- /usr/src/ucb/ruptime.c	Fri Apr 18 12:39:53 1997
***************
*** 4,18 ****
   * specifies the terms and conditions for redistribution.
   */
  
! #ifndef lint
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
- #endif not lint
  
! #ifndef lint
! static char sccsid[] = "@(#)ruptime.c	5.3 (Berkeley) 1/7/86";
! #endif not lint
  
  #include <sys/param.h>
  #include <stdio.h>
--- 4,16 ----
   * specifies the terms and conditions for redistribution.
   */
  
! #if	!defined(lint) && defined(DOSCCS)
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)ruptime.c	5.3.1 (2.11BSD) 1997/4/18";
! #endif
  
  #include <sys/param.h>
  #include <stdio.h>
***************
*** 159,165 ****
  	static char resbuf[32];
  	long days, hours, minutes;
  
! 	if (time < 0 || time > 365L*24L*60L*60L) {
  		(void) sprintf(resbuf, "   %s ??:??", updown);
  		return (resbuf);
  	}
--- 157,163 ----
  	static char resbuf[32];
  	long days, hours, minutes;
  
! 	if (time < 0 || time > 3L* 365L*24L*60L*60L) {
  		(void) sprintf(resbuf, "   %s ??:??", updown);
  		return (resbuf);
  	}
***************
*** 167,176 ****
  	hours = minutes / 60; minutes %= 60;
  	days = hours / 24; hours %= 24;
  	if (days)
! 		(void) sprintf(resbuf, "%s %2ld+%02ld:%02ld",
  		    updown, days, hours, minutes);
  	else
! 		(void) sprintf(resbuf, "%s    %2ld:%02ld",
  		    updown, hours, minutes);
  	return (resbuf);
  }
--- 165,174 ----
  	hours = minutes / 60; minutes %= 60;
  	days = hours / 24; hours %= 24;
  	if (days)
! 		(void) sprintf(resbuf, "%s %3ld+%02ld:%02ld",
  		    updown, days, hours, minutes);
  	else
! 		(void) sprintf(resbuf, "%s    %3ld:%02ld",
  		    updown, hours, minutes);
  	return (resbuf);
  }
*** /VERSION.old	Fri Mar 28 20:05:40 1997
--- /VERSION	Fri Apr 18 12:42:24 1997
***************
*** 1,5 ****
! Current Patch Level: 367
! Date: March 28, 1997
  
  2.11 BSD
  ============
--- 1,5 ----
! Current Patch Level: 368
! Date: April 18, 1997
  
  2.11 BSD
  ============