Path: utzoo!attcan!uunet!oddjob!ncar!boulder!sunybcs!bingvaxu!leah!albanycs!steinmetz!ge-dab!peora!codas!mtune!mtunx!whuts!homxb!antique!whb From: whb@antique.UUCP (Wilson H. Bent) Newsgroups: comp.sources.bugs Subject: screen: Sun load averages patch Summary: 'screen' CAN show load averages on a Sun! Keywords: screen Message-ID: <2235@antique.UUCP> Date: 9 May 88 16:40:36 GMT Reply-To: whb@hoh-2.att.com (Wilson H. Bent) Distribution: comp Organization: Not Organized Lines: 60 Here is a patch to 'screen' to allow display of load averages on a Sun system (tested under Sun-3 UNIX Release 3.3 and Sun-4 SunOS 3.2). Unlike most (all?) other BSD-type systems, Sun keeps the load average in /vmunix as 3 scaled integers, not 3 doubles-precision floats. The conversion is simple and standard. (Betcha this .signature appears twice!) Wilson H. Bent, Jr. ... ihnp4!hoh-2!whb (whb@hoh-2.ATT.COM) AT&T - Bell Laboratories (201) 949-1277 Disclaimer: My company has not authorized me to issue a disclaimer. *** screen.c.orig Fri Aug 14 10:15:53 1987 --- screen.c Thu May 5 11:17:13 1988 *************** *** 85,90 **** --- 85,93 ---- static mflag, nflag, fflag; static char HostName[MAXSTR]; #ifdef LOADAV + #ifdef sun + #include + #endif static char KmemName[] = "/dev/kmem"; static char UnixName[] = "/vmunix"; static char AvenrunSym[] = "_avenrun"; *************** *** 852,859 **** --- 855,866 ---- struct tm *tp; time_t now; #ifdef LOADAV + #ifdef sun + long av[3]; + #else double av[3]; #endif + #endif time (&now); tp = localtime (&now); *************** *** 862,868 **** --- 869,880 ---- #ifdef LOADAV if (avenrun && GetAvenrun (av)) { p = buf + strlen (buf); + #ifdef sun + sprintf (p, " %2.2f %2.2f %2.2f", + (double)av[0]/FSCALE, (double)av[1]/FSCALE, (double)av[2]/FSCALE); + #else sprintf (p, " %2.2f %2.2f %2.2f", av[0], av[1], av[2]); + #endif } #endif p = buf + strlen (buf); -- Wilson H. Bent, Jr. ... ihnp4!hoh-2!whb AT&T - Bell Laboratories (201) 949-1277 Disclaimer: My company has not authorized me to issue a disclaimer.