SCCS-vsn: usr.bin/systat/cmds.c 5.4
SCCS-vsn: usr.bin/systat/disks.c 5.2
SCCS-vsn: usr.bin/systat/iostat.c 5.2
SCCS-vsn: usr.bin/systat/mbufs.c 5.2
SCCS-vsn: usr.bin/systat/netcmds.c 5.2
SCCS-vsn: usr.bin/systat/netstat.c 5.2
SCCS-vsn: usr.bin/systat/pigs.c 5.4
SCCS-vsn: usr.bin/systat/swap.c 5.2
SCCS-vsn: usr.bin/systat/vmstat.c 5.4
-static char sccsid[] = "@(#)cmds.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)cmds.c 5.4 (Berkeley) %G%";
register char *cp;
register struct cmdtab *p;
int interval, omask;
register char *cp;
register struct cmdtab *p;
int interval, omask;
extern (*sigtstpdfl)();
omask = sigblock(sigmask(SIGALRM));
extern (*sigtstpdfl)();
omask = sigblock(sigmask(SIGALRM));
if ((p->c_flags & CF_INIT) == 0) {
if ((p->c_flags & CF_INIT) == 0) {
- (*p->c_init)();
- p->c_flags |= CF_INIT;
+ if ((*p->c_init)())
+ p->c_flags |= CF_INIT;
+ else
+ goto done;
labels();
display();
status();
labels();
display();
status();
-static char sccsid[] = "@(#)disks.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)disks.c 5.2 (Berkeley) %G%";
#endif not lint
#include "systat.h"
#endif not lint
#include "systat.h"
static char buf[1024];
if (once)
static char buf[1024];
if (once)
nlist("/vmunix", nlst);
if (nlst[X_DK_NDRIVE].n_value == 0) {
error("dk_ndrive undefined in kernel");
nlist("/vmunix", nlst);
if (nlst[X_DK_NDRIVE].n_value == 0) {
error("dk_ndrive undefined in kernel");
}
dk_ndrive = getw(nlst[X_DK_NDRIVE].n_value);
if (dk_ndrive <= 0) {
error("dk_ndrive=%d according to /vmunix", dk_ndrive);
}
dk_ndrive = getw(nlst[X_DK_NDRIVE].n_value);
if (dk_ndrive <= 0) {
error("dk_ndrive=%d according to /vmunix", dk_ndrive);
}
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
lseek(kmem, nlst[X_DK_MSPW].n_value, L_SET);
}
dk_mspw = (float *)calloc(dk_ndrive, sizeof (float));
lseek(kmem, nlst[X_DK_MSPW].n_value, L_SET);
if (dk_mspw[i] != 0.0)
dk_select[i] = 1;
}
if (dk_mspw[i] != 0.0)
dk_select[i] = 1;
}
+ if (! read_names()) {
+ free(dr_name);
+ free(dk_select);
+ free(dk_mspw);
+ return(0);
+ }
+ once = 1;
+ return(1);
struct mba_device mdev;
struct mba_driver mdrv;
short two_char;
struct mba_device mdev;
struct mba_driver mdrv;
short two_char;
up = (struct uba_device *)nlst[X_UBDINIT].n_value;
if (mp == 0 && up == 0) {
error("Disk init info not in namelist\n");
up = (struct uba_device *)nlst[X_UBDINIT].n_value;
if (mp == 0 && up == 0) {
error("Disk init info not in namelist\n");
}
if (mp) for (;;) {
steal(mp++, mdev);
}
if (mp) for (;;) {
steal(mp++, mdev);
sprintf(dr_name[udev.ui_dk], "%c%c%d",
cp[0], cp[1], udev.ui_unit);
}
sprintf(dr_name[udev.ui_dk], "%c%c%d",
cp[0], cp[1], udev.ui_unit);
}
mp = (struct mb_device *)nlst[X_MBDINIT].n_value;
if (mp == 0) {
error("Disk init info not in namelist\n");
mp = (struct mb_device *)nlst[X_MBDINIT].n_value;
if (mp == 0) {
error("Disk init info not in namelist\n");
}
for (;;) {
steal(mp++, mdev);
}
for (;;) {
steal(mp++, mdev);
sprintf(dr_name[mdev.md_dk], "%c%c%d",
cp[0], cp[1], mdev.md_unit);
}
sprintf(dr_name[mdev.md_dk], "%c%c%d",
cp[0], cp[1], mdev.md_unit);
}
-static char sccsid[] = "@(#)iostat.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)iostat.c 5.2 (Berkeley) %G%";
if (nlst[X_DK_BUSY].n_type == 0) {
nlist("/vmunix", nlst);
if (nlst[X_DK_BUSY].n_type == 0) {
error("Disk init information isn't in namelist");
if (nlst[X_DK_BUSY].n_type == 0) {
nlist("/vmunix", nlst);
if (nlst[X_DK_BUSY].n_type == 0) {
error("Disk init information isn't in namelist");
+ if (! dkinit())
+ return(0);
if (dk_ndrive) {
#define allocate(e, t) \
s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
if (dk_ndrive) {
#define allocate(e, t) \
s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
allocate(dk_xfer, long);
#undef allocate
}
allocate(dk_xfer, long);
#undef allocate
}
stats(row, col, dn)
int row, dn;
{
stats(row, col, dn)
int row, dn;
{
double atime, words, xtime, itime;
atime = s.dk_time[dn];
double atime, words, xtime, itime;
atime = s.dk_time[dn];
cmdiostat(cmd, args)
char *cmd, *args;
{
cmdiostat(cmd, args)
char *cmd, *args;
{
if (prefix(cmd, "msps"))
msps = !msps;
if (prefix(cmd, "msps"))
msps = !msps;
-static char sccsid[] = "@(#)mbufs.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)mbufs.c 5.2 (Berkeley) %G%";
#endif not lint
#include "systat.h"
#endif not lint
#include "systat.h"
nlist("/vmunix", nlst);
if (nlst[X_MBSTAT].n_type == 0) {
error("namelist on /vmunix failed");
nlist("/vmunix", nlst);
if (nlst[X_MBSTAT].n_type == 0) {
error("namelist on /vmunix failed");
}
}
if (mb == 0)
mb = (struct mbstat *)calloc(1, sizeof (*mb));
}
}
if (mb == 0)
mb = (struct mbstat *)calloc(1, sizeof (*mb));
-static char sccsid[] = "@(#)netcmds.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)netcmds.c 5.2 (Berkeley) %G%";
int onoff;
{
register char *cp;
int onoff;
{
register char *cp;
struct servent *sp;
struct hostent *hp;
struct in_addr in;
struct servent *sp;
struct hostent *hp;
struct in_addr in;
- register struct pitem *p, *open;
+ register struct pitem *p;
if (port == -1) {
if (ports == 0)
if (port == -1) {
if (ports == 0)
nports = 0;
return (1);
}
nports = 0;
return (1);
}
for (p = ports; p < ports+nports; p++)
if (p->port == port) {
p->onoff = onoff;
for (p = ports; p < ports+nports; p++)
if (p->port == port) {
p->onoff = onoff;
-static char sccsid[] = "@(#)netstat.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)netstat.c 5.2 (Berkeley) %G%";
closenetstat(w)
WINDOW *w;
{
closenetstat(w)
WINDOW *w;
{
- register struct netinfo *p, *q;
+ register struct netinfo *p;
endhostent();
endnetent();
endhostent();
endnetent();
nlist("/vmunix", nlst);
if (nlst[X_TCB].n_value == 0) {
error("No symbols in namelist");
nlist("/vmunix", nlst);
if (nlst[X_TCB].n_value == 0) {
error("No symbols in namelist");
}
netcb.ni_forw = netcb.ni_prev = (struct netinfo *)&netcb;
protos = TCP|UDP;
}
netcb.ni_forw = netcb.ni_prev = (struct netinfo *)&netcb;
protos = TCP|UDP;
-static char sccsid[] = "@(#)pigs.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)pigs.c 5.4 (Berkeley) %G%";
nlist("/vmunix", nlst);
if (nlst[X_PROC].n_type == 0) {
error("namelist on /vmunix failed");
nlist("/vmunix", nlst);
if (nlst[X_PROC].n_type == 0) {
error("namelist on /vmunix failed");
if (kprocp == NULL)
kprocp = (struct proc *)calloc(nproc, sizeof (struct proc));
if (usrpt != NULL)
if (kprocp == NULL)
kprocp = (struct proc *)calloc(nproc, sizeof (struct proc));
if (usrpt != NULL)
usrpt = (struct pte *)nlst[X_USRPT].n_value;
Usrptma = (struct pte *)nlst[X_USRPTMAP].n_value;
if (pt == NULL)
pt = (struct p_times *)calloc(nproc, sizeof (struct p_times));
lseek(kmem, (long)nlst[X_CPTIME].n_value, L_SET);
read(kmem, stime, sizeof stime);
usrpt = (struct pte *)nlst[X_USRPT].n_value;
Usrptma = (struct pte *)nlst[X_USRPTMAP].n_value;
if (pt == NULL)
pt = (struct p_times *)calloc(nproc, sizeof (struct p_times));
lseek(kmem, (long)nlst[X_CPTIME].n_value, L_SET);
read(kmem, stime, sizeof stime);
register float time;
register struct proc *pp;
long ctime[CPUSTATES];
register float time;
register struct proc *pp;
long ctime[CPUSTATES];
double t;
if (nlst[X_PROC].n_type == 0)
double t;
if (nlst[X_PROC].n_type == 0)
-static char sccsid[] = "@(#)swap.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)swap.c 5.2 (Berkeley) %G%";
#endif not lint
#include "systat.h"
#endif not lint
#include "systat.h"
nlist("/vmunix", nlst);
if (nlst[X_PROC].n_type == 0) {
error("namelist on /vmunix failed");
nlist("/vmunix", nlst);
if (nlst[X_PROC].n_type == 0) {
error("namelist on /vmunix failed");
if (kprocp == NULL)
kprocp = (struct proc *)calloc(nproc, sizeof (struct proc));
if (usrpt != NULL)
if (kprocp == NULL)
kprocp = (struct proc *)calloc(nproc, sizeof (struct proc));
if (usrpt != NULL)
usrpt = (struct pte *)nlst[X_USRPT].n_value;
Usrptma = (struct pte *)nlst[X_USRPTMAP].n_value;
if (pt == NULL)
pt = (struct p_times *)malloc(nproc * sizeof (struct p_times));
usrpt = (struct pte *)nlst[X_USRPT].n_value;
Usrptma = (struct pte *)nlst[X_USRPTMAP].n_value;
if (pt == NULL)
pt = (struct p_times *)malloc(nproc * sizeof (struct p_times));
register int row;
if (nswdev == 0) {
register int row;
if (nswdev == 0) {
-static char sccsid[] = "@(#)vmstat.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)vmstat.c 5.4 (Berkeley) %G%";
{
char *intrnamebuf, *cp;
int i;
{
char *intrnamebuf, *cp;
int i;
if (name[0].n_type == 0) {
nlist("/vmunix",name);
if (name[0].n_type == 0) {
error("No namelist");
if (name[0].n_type == 0) {
nlist("/vmunix",name);
if (name[0].n_type == 0) {
error("No namelist");
}
}
hertz = phz ? phz : hz;
}
}
hertz = phz ? phz : hz;
- dkinit();
- if (dk_ndrive) {
+ if (! dkinit())
+ return(0);
+ if (dk_ndrive && !once) {
#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)); \
allocate(dk_wds, long);
allocate(dk_seek, long);
allocate(dk_xfer, long);
allocate(dk_wds, long);
allocate(dk_seek, long);
allocate(dk_xfer, long);
#undef allocate
}
if (nintr == 0) {
#undef allocate
}
if (nintr == 0) {
name[X_INTRNAMES].n_value);
if (intrnamebuf == 0 || intrname == 0 || intrloc == 0) {
error("Out of memory\n");
name[X_INTRNAMES].n_value);
if (intrnamebuf == 0 || intrname == 0 || intrloc == 0) {
error("Out of memory\n");
+ if (intrnamebuf)
+ free(intrnamebuf);
+ if (intrname)
+ free(intrname);
+ if (intrloc)
+ free(intrloc);
+ nintr = 0;
+ return(0);
}
lseek(kmem, (long)name[X_INTRNAMES].n_value, L_SET);
read(kmem, intrnamebuf, name[X_EINTRNAMES].n_value -
}
lseek(kmem, (long)name[X_INTRNAMES].n_value, L_SET);
read(kmem, intrnamebuf, name[X_EINTRNAMES].n_value -
}
getinfo(&s2, RUN);
copyinfo(&s2, &s1);
}
getinfo(&s2, RUN);
copyinfo(&s2, &s1);
showkre()
{
float f1, f2;
showkre()
{
float f1, f2;
- int psiz, interv, hits, inttotal;
int i, l, c;
for (i = 0; i < dk_ndrive; i++) {
int i, l, c;
for (i = 0; i < dk_ndrive; i++) {
cmdkre(cmd, args)
char *cmd, *args;
{
cmdkre(cmd, args)
char *cmd, *args;
{
- static enum state oldstate;
if (prefix(cmd, "run")) {
copyinfo(&s2, &s1);
if (prefix(cmd, "run")) {
copyinfo(&s2, &s1);
s->intrcnt = (long *) malloc(nintr * sizeof(long));
if (s->intrcnt == NULL) {
s->intrcnt = (long *) malloc(nintr * sizeof(long));
if (s->intrcnt == NULL) {
- fprintf(stderr, "vsta: out of memory\n");
+ fprintf(stderr, "systat: out of memory\n");
register struct Info *from, *to;
{
long *time, *wds, *seek, *xfer;
register struct Info *from, *to;
{
long *time, *wds, *seek, *xfer;
time = to->dk_time; wds = to->dk_wds; seek = to->dk_seek;
xfer = to->dk_xfer; intrcnt = to->intrcnt;
time = to->dk_time; wds = to->dk_wds; seek = to->dk_seek;
xfer = to->dk_xfer; intrcnt = to->intrcnt;