sysctl.c (106829) | sysctl.c (109097) |
---|---|
1/* 2 * Copyright (c) 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 --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 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 --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93"; 43#endif 44static const char rcsid[] = |
45 "$FreeBSD: head/sbin/sysctl/sysctl.c 106829 2002-11-12 21:18:21Z peter $"; | 45 "$FreeBSD: head/sbin/sysctl/sysctl.c 109097 2003-01-11 07:29:47Z dillon $"; |
46#endif /* not lint */ 47 48#ifdef __i386__ 49#include <sys/diskslice.h> /* used for bootdev parsing */ 50#include <sys/reboot.h> /* used for bootdev parsing */ 51#endif 52#include <sys/param.h> 53#include <sys/time.h> 54#include <sys/resource.h> 55#include <sys/stat.h> 56#include <sys/sysctl.h> | 46#endif /* not lint */ 47 48#ifdef __i386__ 49#include <sys/diskslice.h> /* used for bootdev parsing */ 50#include <sys/reboot.h> /* used for bootdev parsing */ 51#endif 52#include <sys/param.h> 53#include <sys/time.h> 54#include <sys/resource.h> 55#include <sys/stat.h> 56#include <sys/sysctl.h> |
57#include <sys/vmmeter.h> |
|
57 58#include <ctype.h> 59#include <err.h> 60#include <errno.h> 61#include <stdio.h> 62#include <stdlib.h> 63#include <string.h> 64#include <unistd.h> --- 253 unchanged lines hidden (view full) --- 318 for (p2=p1; *p2 ; p2++) 319 if (*p2 == '\n') 320 *p2 = '\0'; 321 fputs(p1, stdout); 322 return (0); 323} 324 325static int | 58 59#include <ctype.h> 60#include <err.h> 61#include <errno.h> 62#include <stdio.h> 63#include <stdlib.h> 64#include <string.h> 65#include <unistd.h> --- 253 unchanged lines hidden (view full) --- 319 for (p2=p1; *p2 ; p2++) 320 if (*p2 == '\n') 321 *p2 = '\0'; 322 fputs(p1, stdout); 323 return (0); 324} 325 326static int |
327S_vmtotal(int l2, void *p) 328{ 329 struct vmtotal *v = (struct vmtotal *)p; 330 331 if (l2 != sizeof(*v)) { 332 warnx("S_vmtotal %d != %d", l2, sizeof(*v)); 333 return (0); 334 } 335 336 printf("\nSystem wide totals computed every five seconds:\n"); 337 printf("===============================================\n"); 338 printf("Processes: (RUNQ:\t %hu Disk Wait: %hu Page Wait: %hu Sleep: %hu)\n", 339 v->t_rq, v->t_dw, v->t_pw, v->t_sl); 340 printf("Virtual Memory:\t\t (Total: %hu Active %hu)\n", v->t_vm, v->t_avm); 341 printf("Real Memory:\t\t (Total: %hu Active %hu)\n", v->t_rm, v->t_arm); 342 printf("Shared Virtual Memory:\t (Total: %hu Active: %hu)\n", v->t_vmshr, v->t_avmshr); 343 printf("Shared Real Memory:\t (Total: %hu Active: %hu)\n", v->t_rmshr, v->t_armshr); 344 printf("Free Memory Pages:\t %hu\n", v->t_free); 345 346 return (0); 347} 348 349static int |
|
326T_dev_t(int l2, void *p) 327{ 328 dev_t *d = (dev_t *)p; 329 if (l2 != sizeof(*d)) { 330 warnx("T_dev_T %d != %d", l2, sizeof(*d)); 331 return (0); 332 } 333 if ((int)(*d) != -1) { --- 248 unchanged lines hidden (view full) --- 582 case 'S': 583 i = 0; 584 if (strcmp(fmt, "S,clockinfo") == 0) 585 func = S_clockinfo; 586 else if (strcmp(fmt, "S,timeval") == 0) 587 func = S_timeval; 588 else if (strcmp(fmt, "S,loadavg") == 0) 589 func = S_loadavg; | 350T_dev_t(int l2, void *p) 351{ 352 dev_t *d = (dev_t *)p; 353 if (l2 != sizeof(*d)) { 354 warnx("T_dev_T %d != %d", l2, sizeof(*d)); 355 return (0); 356 } 357 if ((int)(*d) != -1) { --- 248 unchanged lines hidden (view full) --- 606 case 'S': 607 i = 0; 608 if (strcmp(fmt, "S,clockinfo") == 0) 609 func = S_clockinfo; 610 else if (strcmp(fmt, "S,timeval") == 0) 611 func = S_timeval; 612 else if (strcmp(fmt, "S,loadavg") == 0) 613 func = S_loadavg; |
614 else if (strcmp(fmt, "S,vmtotal") == 0) 615 func = S_vmtotal; |
|
590 else if (strcmp(fmt, "T,dev_t") == 0) 591 func = T_dev_t; 592 else 593 func = NULL; 594 if (func) { 595 if (!nflag) 596 printf("%s%s", name, sep); 597 return ((*func)(len, p)); --- 61 unchanged lines hidden --- | 616 else if (strcmp(fmt, "T,dev_t") == 0) 617 func = T_dev_t; 618 else 619 func = NULL; 620 if (func) { 621 if (!nflag) 622 printf("%s%s", name, sep); 623 return ((*func)(len, p)); --- 61 unchanged lines hidden --- |