main.c (3f2631c7ba2e73ed6ae16268b57aaa40e7c55813) | main.c (099a0e588cbe1bbc56a565bf57d722621b47a866) |
---|---|
1/* 2 * Copyright (c) 1983, 1988, 1993 3 * 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 --- 242 unchanged lines hidden (view full) --- 251static struct protox *knownname (char *); 252 253static kvm_t *kvmd; 254static char *nlistf = NULL, *memf = NULL; 255 256int Aflag; /* show addresses of protocol control block */ 257int aflag; /* show all sockets (including servers) */ 258int bflag; /* show i/f total bytes in/out */ | 1/* 2 * Copyright (c) 1983, 1988, 1993 3 * 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 --- 242 unchanged lines hidden (view full) --- 251static struct protox *knownname (char *); 252 253static kvm_t *kvmd; 254static char *nlistf = NULL, *memf = NULL; 255 256int Aflag; /* show addresses of protocol control block */ 257int aflag; /* show all sockets (including servers) */ 258int bflag; /* show i/f total bytes in/out */ |
259int cflag; /* show mbuf cache information */ | |
260int dflag; /* show i/f dropped packets */ 261int gflag; /* show group (multicast) routing or stats */ 262int iflag; /* show interfaces */ 263int Lflag; /* show size of listen queues */ 264int mflag; /* show memory stats */ 265int numeric_addr; /* show addresses numerically */ 266int numeric_port; /* show ports numerically */ 267static int pflag; /* show given protocol */ --- 24 unchanged lines hidden (view full) --- 292 Aflag = 1; 293 break; 294 case 'a': 295 aflag = 1; 296 break; 297 case 'b': 298 bflag = 1; 299 break; | 259int dflag; /* show i/f dropped packets */ 260int gflag; /* show group (multicast) routing or stats */ 261int iflag; /* show interfaces */ 262int Lflag; /* show size of listen queues */ 263int mflag; /* show memory stats */ 264int numeric_addr; /* show addresses numerically */ 265int numeric_port; /* show ports numerically */ 266static int pflag; /* show given protocol */ --- 24 unchanged lines hidden (view full) --- 291 Aflag = 1; 292 break; 293 case 'a': 294 aflag = 1; 295 break; 296 case 'b': 297 bflag = 1; 298 break; |
300 case 'c': 301 cflag = 1; 302 break; | |
303 case 'd': 304 dflag = 1; 305 break; 306 case 'f': 307 if (strcmp(optarg, "ipx") == 0) 308 af = AF_IPX; 309 else if (strcmp(optarg, "inet") == 0) 310 af = AF_INET; --- 109 unchanged lines hidden (view full) --- 420 421 /* 422 * Discard setgid privileges if not the running kernel so that bad 423 * guys can't print interesting stuff from kernel memory. 424 */ 425 if (nlistf != NULL || memf != NULL) 426 setgid(getgid()); 427 | 299 case 'd': 300 dflag = 1; 301 break; 302 case 'f': 303 if (strcmp(optarg, "ipx") == 0) 304 af = AF_IPX; 305 else if (strcmp(optarg, "inet") == 0) 306 af = AF_INET; --- 109 unchanged lines hidden (view full) --- 416 417 /* 418 * Discard setgid privileges if not the running kernel so that bad 419 * guys can't print interesting stuff from kernel memory. 420 */ 421 if (nlistf != NULL || memf != NULL) 422 setgid(getgid()); 423 |
428 if (cflag && !mflag) { 429 (void)fprintf(stderr, "-c only valid with -m\n"); 430 usage(); 431 } | |
432 if (mflag) { 433 if (memf != NULL) { 434 if (kread(0, 0, 0) == 0) 435 mbpr(nl[N_MBSTAT].n_value, 436 nl[N_MBTYPES].n_value, 437 nl[N_NMBCLUSTERS].n_value, 438 nl[N_NMBUFS].n_value, 439 nl[N_MBHI].n_value, --- 265 unchanged lines hidden --- | 424 if (mflag) { 425 if (memf != NULL) { 426 if (kread(0, 0, 0) == 0) 427 mbpr(nl[N_MBSTAT].n_value, 428 nl[N_MBTYPES].n_value, 429 nl[N_NMBCLUSTERS].n_value, 430 nl[N_NMBUFS].n_value, 431 nl[N_MBHI].n_value, --- 265 unchanged lines hidden --- |