projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_3_Reno release
[unix-history]
/
usr
/
src
/
usr.bin
/
systat
/
mbufs.c
diff --git
a/usr/src/usr.bin/systat/mbufs.c
b/usr/src/usr.bin/systat/mbufs.c
index
558436a
..
36e0b17
100644
(file)
--- a/
usr/src/usr.bin/systat/mbufs.c
+++ b/
usr/src/usr.bin/systat/mbufs.c
@@
-1,40
+1,40
@@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)mbufs.c
1.2 (Lucasfilm) %G%
";
-#endif
+static char sccsid[] = "@(#)mbufs.c
5.3 (Berkeley) 5/11/89
";
+#endif
not lint
#include "systat.h"
#include <sys/mbuf.h>
#include "systat.h"
#include <sys/mbuf.h>
+#include <paths.h>
WINDOW *
openmbufs()
{
WINDOW *
openmbufs()
{
- static WINDOW *w = NULL;
-
- if (w == NULL)
- w = newwin(20, 70, 3, 5);
- return (w);
+ return (subwin(stdscr, LINES-5-1, 0, 5, 0));
}
closembufs(w)
WINDOW *w;
{
}
closembufs(w)
WINDOW *w;
{
-
if (w == NULL)
return;
if (w == NULL)
return;
- move(5, 0);
- clrtobot();
wclear(w);
wrefresh(w);
wclear(w);
wrefresh(w);
+ delwin(w);
}
struct mbstat *mb;
labelmbufs()
{
}
struct mbstat *mb;
labelmbufs()
{
-
- move(5, 0); clrtoeol();
- mvaddstr(5, 20,
- "/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50");
+ wmove(wnd, 0, 0); wclrtoeol(wnd);
+ mvwaddstr(wnd, 0, 10,
+ "/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50 /55 /60");
}
char *mtnames[] = {
}
char *mtnames[] = {
@@
-50,7
+50,10
@@
char *mtnames[] = {
"zombies",
"sockopts",
"frags",
"zombies",
"sockopts",
"frags",
+ "rights",
+ "ifaddrs",
};
};
+#define NNAMES (sizeof (mtnames) / sizeof (mtnames[0]))
showmbufs()
{
showmbufs()
{
@@
-59,21
+62,23
@@
showmbufs()
if (mb == 0)
return;
if (mb == 0)
return;
- for (j = 0; j <
15
; j++) {
+ for (j = 0; j <
wnd->_maxy
; j++) {
max = 0, index = -1;
max = 0, index = -1;
- for (i = 0; i <
15
; i++)
+ for (i = 0; i <
wnd->_maxy
; i++)
if (mb->m_mtypes[i] > max) {
max = mb->m_mtypes[i];
index = i;
}
if (max == 0)
break;
if (mb->m_mtypes[i] > max) {
max = mb->m_mtypes[i];
index = i;
}
if (max == 0)
break;
- wmove(wnd, 3 + j, 0);
- waddstr(wnd, mtnames[index]);
- wmove(wnd, 3 + j, 15);
- if (max > 50) {
+ if (j > NNAMES)
+ mvwprintw(wnd, 1+j, 0, "%10d", index);
+ else
+ mvwprintw(wnd, 1+j, 0, "%-10.10s", mtnames[index]);
+ wmove(wnd, 1 + j, 10);
+ if (max > 60) {
sprintf(buf, " %d", max);
sprintf(buf, " %d", max);
- max =
5
0;
+ max =
6
0;
while (max--)
waddch(wnd, 'X');
waddstr(wnd, buf);
while (max--)
waddch(wnd, 'X');
waddstr(wnd, buf);
@@
-84,35
+89,31
@@
showmbufs()
}
mb->m_mtypes[index] = 0;
}
}
mb->m_mtypes[index] = 0;
}
- while (j++ < 15) {
- wmove(wnd, 3 + j, 0);
- wclrtoeol(wnd);
- }
+ wmove(wnd, 1+j, 0); wclrtobot(wnd);
}
static struct nlist nlst[] = {
#define X_MBSTAT 0
{ "_mbstat" },
}
static struct nlist nlst[] = {
#define X_MBSTAT 0
{ "_mbstat" },
-
{ "" }
+ { "" }
};
initmbufs()
{
};
initmbufs()
{
-
if (nlst[X_MBSTAT].n_type == 0) {
if (nlst[X_MBSTAT].n_type == 0) {
- nlist(
"/vmunix"
, nlst);
+ nlist(
_PATH_UNIX
, nlst);
if (nlst[X_MBSTAT].n_type == 0) {
if (nlst[X_MBSTAT].n_type == 0) {
- error("namelist on
/vmunix failed"
);
- return;
+ error("namelist on
%s failed", _PATH_UNIX
);
+ return
(0)
;
}
}
if (mb == 0)
mb = (struct mbstat *)calloc(1, sizeof (*mb));
}
}
if (mb == 0)
mb = (struct mbstat *)calloc(1, sizeof (*mb));
+ return(1);
}
fetchmbufs()
{
}
fetchmbufs()
{
-
if (nlst[X_MBSTAT].n_type == 0)
return;
lseek(kmem, nlst[X_MBSTAT].n_value, L_SET);
if (nlst[X_MBSTAT].n_type == 0)
return;
lseek(kmem, nlst[X_MBSTAT].n_value, L_SET);