SCCS-vsn: usr.bin/systat/systat.h 5.3
SCCS-vsn: usr.sbin/iostat/iostat.c 4.17
SCCS-vsn: old/pcc/lint/llibs/llib-lc 1.45
SCCS-vsn: usr.sbin/sendmail/src/conf.c 5.20
SCCS-vsn: games/dm/dm.c 5.12
SCCS-vsn: old/rogue/machdep.c 5.3
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)dm.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)dm.c 5.12 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
priority = atoi(s_priority);
}
priority = atoi(s_priority);
}
-static struct nlist nl[] = {
- { "_avenrun" },
-#define X_AVENRUN 0
- { "" },
-};
-
/*
* load --
* return 15 minute load average
/*
* load --
* return 15 minute load average
load()
{
double avenrun[3];
load()
{
double avenrun[3];
- int kmem;
- long lseek();
- if (nlist("/vmunix", nl)) {
- fputs("dm: nlist of /vmunix failed.\n", stderr);
- exit(1);
- }
- if ((kmem = open("/dev/kmem", O_RDONLY, 0)) < 0) {
- perror("dm: /dev/kmem");
+ if (getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])) < 0) {
+ fputs("dm: getloadavg() failed.\n", stderr);
- (void)lseek(kmem, (long)nl[X_AVENRUN].n_value, L_SET);
- (void)read(kmem, (char *)avenrun, sizeof(avenrun));
-/* @(#)llib-lc 1.44 (Berkeley) %G% */
+/* @(#)llib-lc 1.45 (Berkeley) %G% */
struct hostent * gethostbyaddr(addr, len, type) char *addr; { return (struct hostent *) 0; }
struct hostent * gethostbyname(name) char *name; { return (struct hostent *) 0; }
struct hostent * gethostent() { return (struct hostent *) 0; }
struct hostent * gethostbyaddr(addr, len, type) char *addr; { return (struct hostent *) 0; }
struct hostent * gethostbyname(name) char *name; { return (struct hostent *) 0; }
struct hostent * gethostent() { return (struct hostent *) 0; }
+int getloadavg( v, l ) double v[]; int l; { return 0; }
char * getlogin(){ return " "; }
struct netent * getnetbyaddr(net, type) { return (struct netent *) 0; }
struct netent * getnetbyname(name) char *name; { return (struct netent *) 0; }
char * getlogin(){ return " "; }
struct netent * getnetbyaddr(net, type) { return (struct netent *) 0; }
struct netent * getnetbyname(name) char *name; { return (struct netent *) 0; }
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)machdep.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)machdep.c 5.3 (Berkeley) %G%";
# include <sys/stat.h>
# include <sys/file.h>
# include <sys/stat.h>
# include <sys/file.h>
+# undef LOADAV /* use getloadavg() by default */
+
# ifdef SCOREFILE
static char *Lockfile = "/tmp/.fredlock";
# ifdef SCOREFILE
static char *Lockfile = "/tmp/.fredlock";
# endif MAXUSERS
# ifdef MAXLOAD
# endif MAXUSERS
# ifdef MAXLOAD
+# else
+ if (getloadavg(avec, sizeof(avec)/sizeof(avec[0])) < 0)
+ avec[0] = avec[1] = avec[2] = 0.0;
+# endif
if (avec[1] > MAXLOAD)
return TRUE;
# endif MAXLOAD
if (avec[1] > MAXLOAD)
return TRUE;
# endif MAXLOAD
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)systat.h 5.2 (Berkeley) %G%
+ * @(#)systat.h 5.3 (Berkeley) %G%
*/
#include <netdb.h>
#include <nlist.h>
#include <signal.h>
#include <curses.h>
*/
#include <netdb.h>
#include <nlist.h>
#include <signal.h>
#include <curses.h>
#include <sys/file.h>
#include <sys/dkstat.h>
#include <sys/file.h>
#include <sys/dkstat.h>
long ntext, textp;
struct text *xtext;
long ntext, textp;
struct text *xtext;
double lccpu;
double avenrun[3];
double lccpu;
double avenrun[3];
-static char *sccsid = "@(#)iostat.c 4.16 (Berkeley) 89/05/11";
+static char *sccsid = "@(#)iostat.c 4.17 (Berkeley) 89/05/29";
#define X_DK_SEEK 6
{ "_cp_time" },
#define X_CP_TIME 7
#define X_DK_SEEK 6
{ "_cp_time" },
#define X_CP_TIME 7
- { "_dk_mspw" },
-#define X_DK_MSPW 8
+ { "_dk_wpms" },
+#define X_DK_WPMS 8
{ "_hz" },
#define X_HZ 9
{ "_phz" },
{ "_hz" },
#define X_HZ 9
{ "_phz" },
char **dr_name;
int *dr_select;
char **dr_name;
int *dr_select;
int dk_ndrive;
int ndrives = 0;
#ifdef vax
int dk_ndrive;
int ndrives = 0;
#ifdef vax
}
dr_select = (int *)calloc(dk_ndrive, sizeof (int));
dr_name = (char **)calloc(dk_ndrive, sizeof (char *));
}
dr_select = (int *)calloc(dk_ndrive, sizeof (int));
dr_name = (char **)calloc(dk_ndrive, sizeof (char *));
- dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
+ dk_wpms = (long *)calloc(dk_ndrive, sizeof (long));
#define allocate(e, t) \
s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
s1./**/e = (t *)calloc(dk_ndrive, sizeof (t));
#define allocate(e, t) \
s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
s1./**/e = (t *)calloc(dk_ndrive, sizeof (t));
read(mf, &phz, sizeof phz);
if (phz)
hz = phz;
read(mf, &phz, sizeof phz);
if (phz)
hz = phz;
- lseek(mf, (long)nl[X_DK_MSPW].n_value, L_SET);
- read(mf, dk_mspw, dk_ndrive*sizeof (dk_mspw));
+ lseek(mf, (long)nl[X_DK_WPMS].n_value, L_SET);
+ read(mf, dk_wpms, dk_ndrive*sizeof (dk_wpms));
/*
* Choose drives to be displayed. Priority
* goes to (in order) drives supplied as arguments,
/*
* Choose drives to be displayed. Priority
* goes to (in order) drives supplied as arguments,
argc--, argv++;
}
for (i = 0; i < dk_ndrive && ndrives < 4; i++) {
argc--, argv++;
}
for (i = 0; i < dk_ndrive && ndrives < 4; i++) {
- if (dr_select[i] || dk_mspw[i] == 0.0)
+ if (dr_select[i] || dk_wpms[i] == 0)
continue;
for (cp = defdrives; *cp; cp++)
if (strcmp(dr_name[i], *cp) == 0) {
continue;
for (cp = defdrives; *cp; cp++)
if (strcmp(dr_name[i], *cp) == 0) {
register i;
double atime, words, xtime, itime;
register i;
double atime, words, xtime, itime;
- if (dk_mspw[dn] == 0.0) {
+ if (dk_wpms[dn] == 0) {
printf("%4.0f%4.0f%5.1f ", 0.0, 0.0, 0.0);
return;
}
atime = s.dk_time[dn];
atime /= (float) hz;
words = s.dk_wds[dn]*32.0; /* number of words transferred */
printf("%4.0f%4.0f%5.1f ", 0.0, 0.0, 0.0);
return;
}
atime = s.dk_time[dn];
atime /= (float) hz;
words = s.dk_wds[dn]*32.0; /* number of words transferred */
- xtime = dk_mspw[dn]*words; /* transfer time */
+ xtime = words/dk_wpms[dn]; /* transfer time */
itime = atime - xtime; /* time not transferring */
if (xtime < 0)
itime += xtime, xtime = 0;
itime = atime - xtime; /* time not transferring */
if (xtime < 0)
itime += xtime, xtime = 0;
-static char sccsid[] = "@(#)conf.c 5.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c 5.20 (Berkeley) %G%";
#endif /* not lint */
# include <sys/ioctl.h>
#endif /* not lint */
# include <sys/ioctl.h>
+#ifndef sun
+
+getla()
+{
+ double avenrun[3];
+
+ if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) < 0)
+ return (0);
+ return ((int) (avenrun[0] + 0.5));
+}
+
+#else /* sun */
getla()
{
static int kmem = -1;
getla()
{
static int kmem = -1;
-# else
- double avenrun[3];
-# endif
extern off_t lseek();
if (kmem < 0)
extern off_t lseek();
if (kmem < 0)
/* thank you Ian */
return (-1);
}
/* thank you Ian */
return (-1);
}
return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
-# else
- return ((int) (avenrun[0] + 0.5));
-# endif
-}
-
-#else VMUNIX
-
-getla()
-{
- return (0);
\f/*
** SHOULDQUEUE -- should this message be queued or sent?
**
\f/*
** SHOULDQUEUE -- should this message be queued or sent?
**