mbufs.c (160607) | mbufs.c (175387) |
---|---|
1/*- 2 * Copyright (c) 1980, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> 35 | 1/*- 2 * Copyright (c) 1980, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> 35 |
36__FBSDID("$FreeBSD: head/usr.bin/systat/mbufs.c 160607 2006-07-24 01:49:24Z rwatson $"); | 36__FBSDID("$FreeBSD: head/usr.bin/systat/mbufs.c 175387 2008-01-16 19:27:43Z delphij $"); |
37 38#ifdef lint 39static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93"; 40#endif 41 42#include <sys/param.h> 43#include <sys/types.h> 44#include <sys/mbuf.h> --- 19 unchanged lines hidden (view full) --- 64 { MT_HEADER, "headers"}, 65 { MT_SONAME, "socknames"}, 66 { MT_CONTROL, "control"}, 67 { MT_OOBDATA, "oobdata"} 68}; 69#define NNAMES (sizeof (mtnames) / sizeof (mtnames[0])) 70 71WINDOW * | 37 38#ifdef lint 39static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6/93"; 40#endif 41 42#include <sys/param.h> 43#include <sys/types.h> 44#include <sys/mbuf.h> --- 19 unchanged lines hidden (view full) --- 64 { MT_HEADER, "headers"}, 65 { MT_SONAME, "socknames"}, 66 { MT_CONTROL, "control"}, 67 { MT_OOBDATA, "oobdata"} 68}; 69#define NNAMES (sizeof (mtnames) / sizeof (mtnames[0])) 70 71WINDOW * |
72openmbufs() | 72openmbufs(void) |
73{ 74 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); 75} 76 77void | 73{ 74 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); 75} 76 77void |
78closembufs(w) 79 WINDOW *w; | 78closembufs(WINDOW *w) |
80{ 81 if (w == NULL) 82 return; 83 wclear(w); 84 wrefresh(w); 85 delwin(w); 86} 87 88void | 79{ 80 if (w == NULL) 81 return; 82 wclear(w); 83 wrefresh(w); 84 delwin(w); 85} 86 87void |
89labelmbufs() | 88labelmbufs(void) |
90{ 91 wmove(wnd, 0, 0); wclrtoeol(wnd); 92 mvwaddstr(wnd, 0, 10, 93 "/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50 /55 /60"); 94} 95 96void | 89{ 90 wmove(wnd, 0, 0); wclrtoeol(wnd); 91 mvwaddstr(wnd, 0, 10, 92 "/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50 /55 /60"); 93} 94 95void |
97showmbufs() | 96showmbufs(void) |
98{ 99 int i, j, max, idx; 100 u_long totmbufs; 101 char buf[10]; 102 const char *mtname; 103 104 totmbufs = mbstat->m_mbufs; 105 --- 54 unchanged lines hidden (view full) --- 160 } 161 wclrtoeol(wnd); 162 j++; 163 } 164 wmove(wnd, 1+j, 0); wclrtobot(wnd); 165} 166 167int | 97{ 98 int i, j, max, idx; 99 u_long totmbufs; 100 char buf[10]; 101 const char *mtname; 102 103 totmbufs = mbstat->m_mbufs; 104 --- 54 unchanged lines hidden (view full) --- 159 } 160 wclrtoeol(wnd); 161 j++; 162 } 163 wmove(wnd, 1+j, 0); wclrtobot(wnd); 164} 165 166int |
168initmbufs() | 167initmbufs(void) |
169{ 170 size_t len; 171 172 len = sizeof *mbstat; 173 if ((mbstat = malloc(len)) == NULL) { 174 error("malloc mbstat failed"); 175 return 0; 176 } --- 6 unchanged lines hidden (view full) --- 183 error("calloc m_mbtypes failed"); 184 return 0; 185 } 186 187 return 1; 188} 189 190void | 168{ 169 size_t len; 170 171 len = sizeof *mbstat; 172 if ((mbstat = malloc(len)) == NULL) { 173 error("malloc mbstat failed"); 174 return 0; 175 } --- 6 unchanged lines hidden (view full) --- 182 error("calloc m_mbtypes failed"); 183 return 0; 184 } 185 186 return 1; 187} 188 189void |
191fetchmbufs() | 190fetchmbufs(void) |
192{ 193 size_t len; 194 195 len = sizeof *mbstat; 196 if (sysctlbyname("kern.ipc.mbstat", mbstat, &len, NULL, 0) < 0) 197 printw("sysctl: mbstat: %s", strerror(errno)); 198} | 191{ 192 size_t len; 193 194 len = sizeof *mbstat; 195 if (sysctlbyname("kern.ipc.mbstat", mbstat, &len, NULL, 0) < 0) 196 printw("sysctl: mbstat: %s", strerror(errno)); 197} |