xosview
1.23
About: xosview is an X Windows based system monitor (cpu, memory, swap and network usage; interrupt and serial activities; load average).
![]() ![]() |
#include "kernel.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <kvm.h>
#include <nlist.h>
#include <limits.h>
#include <string.h>
#include <err.h>
#include <errno.h>
#include <ifaddrs.h>
#include <sysexits.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <sys/vmmeter.h>
Go to the source code of this file.
Macros | |
#define | DUMMY_SYM "dummy_sym" |
#define | DUMMY_0 |
#define | DUMMY_1 |
#define | DUMMY_2 |
#define | IFA_STAT(s) (((struct if_data *)ifa->ifa_data)->ifi_ ## s) |
Functions | |
static void | safe_kvm_read (unsigned long kernel_addr, void *user_addr, size_t nbytes) |
static void | safe_kvm_read_symbol (int nlstOffset, void *user_addr, size_t nbytes) |
int | ValidSymbol (int index) |
int | SymbolValue (int index) |
void | BSDInit () |
void | SetKernelName (const char *kernelName) |
void | OpenKDIfNeeded () |
int | BSDGetCPUSpeed () |
void | BSDPageInit () |
void | BSDGetPageStats (uint64_t *meminfo, uint64_t *pageinfo) |
void | BSDCPUInit () |
void | BSDGetCPUTimes (uint64_t *timeArray, unsigned int cpu) |
int | BSDNetInit () |
void | BSDGetNetInOut (uint64_t *inbytes, uint64_t *outbytes, const char *netIface, bool ignored) |
int | BSDSwapInit () |
void | BSDGetSwapInfo (uint64_t *total, uint64_t *used) |
int | BSDDiskInit () |
uint64_t | BSDGetDiskXFerBytes (uint64_t *read_bytes, uint64_t *write_bytes) |
int | BSDIntrInit () |
int | BSDNumInts () |
void | BSDGetIntrStats (uint64_t *intrCount, unsigned int *intrNbrs) |
int | BSDCountCpus (void) |
void | BSDGetSensor (const char *name, const char *valname, float *value, char *unit) |
bool | BSDHasBattery () |
void | BSDGetBatteryInfo (int *remaining, unsigned int *state) |
Variables | |
kvm_t * | kd = NULL |
static struct nlist | nlst [] |
static char | kernelFileName [_POSIX2_LINE_MAX] |
static int | mib_cpu [2] = { CTL_HW, HW_NCPU } |
#define DUMMY_0 |
#define DUMMY_1 |
#define DUMMY_2 |
#define DUMMY_SYM "dummy_sym" |
#define IFA_STAT | ( | s | ) | (((struct if_data *)ifa->ifa_data)->ifi_ ## s) |
int BSDCountCpus | ( | void | ) |
Definition at line 1127 of file kernel.cc.
References mib_cpu.
Referenced by BSDGetCPUSpeed(), BSDGetCPUTimes(), LoadMeter::checkResources(), and MeterMaker::makeMeters().
void BSDCPUInit | ( | ) |
Definition at line 394 of file kernel.cc.
References OpenKDIfNeeded().
Referenced by CPUMeter::CPUMeter().
int BSDDiskInit | ( | ) |
Definition at line 795 of file kernel.cc.
References OpenKDIfNeeded().
Referenced by DiskMeter::DiskMeter().
void BSDGetBatteryInfo | ( | int * | remaining, |
unsigned int * | state | ||
) |
Definition at line 1585 of file kernel.cc.
References BSDGetSensor(), XOSVIEW_BATT_CHARGING, XOSVIEW_BATT_CRITICAL, XOSVIEW_BATT_DISCHARGING, XOSVIEW_BATT_FULL, XOSVIEW_BATT_LOW, and XOSVIEW_BATT_NONE.
Referenced by BtryMeter::getstats().
int BSDGetCPUSpeed | ( | ) |
Definition at line 254 of file kernel.cc.
References BSDCountCpus().
Referenced by LoadMeter::checkevent().
void BSDGetCPUTimes | ( | uint64_t * | timeArray, |
unsigned int | cpu | ||
) |
Definition at line 407 of file kernel.cc.
References BSDCountCpus().
Referenced by CPUMeter::getcputime().
uint64_t BSDGetDiskXFerBytes | ( | uint64_t * | read_bytes, |
uint64_t * | write_bytes | ||
) |
Definition at line 804 of file kernel.cc.
References safe_kvm_read(), and safe_kvm_read_symbol().
Referenced by DiskMeter::getstats().
void BSDGetIntrStats | ( | uint64_t * | intrCount, |
unsigned int * | intrNbrs | ||
) |
Definition at line 976 of file kernel.cc.
References nlst, and safe_kvm_read().
Referenced by IrqRateMeter::checkResources(), IrqRateMeter::getinfo(), and IntMeter::getirqs().
void BSDGetNetInOut | ( | uint64_t * | inbytes, |
uint64_t * | outbytes, | ||
const char * | netIface, | ||
bool | ignored | ||
) |
Definition at line 492 of file kernel.cc.
References IFA_STAT.
Referenced by NetMeter::getstats(), and NetMeter::NetMeter().
void BSDGetPageStats | ( | uint64_t * | meminfo, |
uint64_t * | pageinfo | ||
) |
Definition at line 301 of file kernel.cc.
Referenced by MemMeter::getmeminfo(), PageMeter::getpageinfo(), and PageMeter::PageMeter().
void BSDGetSensor | ( | const char * | name, |
const char * | valname, | ||
float * | value, | ||
char * | unit | ||
) |
Definition at line 1275 of file kernel.cc.
Referenced by BSDGetBatteryInfo(), BSDHasBattery(), BSDSensor::checkResources(), and BSDSensor::getsensor().
void BSDGetSwapInfo | ( | uint64_t * | total, |
uint64_t * | used | ||
) |
Definition at line 531 of file kernel.cc.
References kd, and OpenKDIfNeeded().
Referenced by SwapMeter::getswapinfo().
bool BSDHasBattery | ( | ) |
Definition at line 1532 of file kernel.cc.
References BSDGetSensor().
Referenced by MeterMaker::makeMeters().
void BSDInit | ( | ) |
Definition at line 198 of file kernel.cc.
References kernelFileName.
Referenced by XOSView::XOSView().
int BSDIntrInit | ( | ) |
Definition at line 855 of file kernel.cc.
References nlst, OpenKDIfNeeded(), safe_kvm_read(), SymbolValue(), and ValidSymbol().
Referenced by IntMeter::IntMeter(), and IrqRateMeter::IrqRateMeter().
int BSDNetInit | ( | ) |
Definition at line 486 of file kernel.cc.
References OpenKDIfNeeded().
Referenced by NetMeter::NetMeter().
int BSDNumInts | ( | ) |
Definition at line 873 of file kernel.cc.
References nlst, and safe_kvm_read().
Referenced by IntMeter::IntMeter(), and IrqRateMeter::IrqRateMeter().
void BSDPageInit | ( | ) |
Definition at line 294 of file kernel.cc.
References OpenKDIfNeeded().
Referenced by MemMeter::MemMeter(), and PageMeter::PageMeter().
int BSDSwapInit | ( | ) |
Definition at line 525 of file kernel.cc.
References OpenKDIfNeeded().
Referenced by SwapMeter::SwapMeter().
void OpenKDIfNeeded | ( | ) |
Definition at line 211 of file kernel.cc.
References DUMMY_SYM, kd, kernelFileName, and nlst.
Referenced by BSDCPUInit(), BSDDiskInit(), BSDGetSwapInfo(), BSDIntrInit(), BSDNetInit(), BSDPageInit(), and BSDSwapInit().
|
inlinestatic |
Definition at line 167 of file kernel.cc.
References kd.
Referenced by BSDGetDiskXFerBytes(), BSDGetIntrStats(), BSDIntrInit(), BSDNumInts(), and safe_kvm_read_symbol().
|
inlinestatic |
Definition at line 183 of file kernel.cc.
References nlst, and safe_kvm_read().
Referenced by BSDGetDiskXFerBytes().
void SetKernelName | ( | const char * | kernelName | ) |
Definition at line 203 of file kernel.cc.
References kernelFileName.
Referenced by XOSView::checkArgs().
int SymbolValue | ( | int | index | ) |
int ValidSymbol | ( | int | index | ) |
kvm_t* kd = NULL |
Definition at line 110 of file kernel.cc.
Referenced by BSDGetSwapInfo(), OpenKDIfNeeded(), and safe_kvm_read().
|
static |
Definition at line 158 of file kernel.cc.
Referenced by BSDInit(), OpenKDIfNeeded(), and SetKernelName().
|
static |
Definition at line 1124 of file kernel.cc.
Referenced by BSDCountCpus().
|
static |
Definition at line 110 of file kernel.cc.
Referenced by BSDGetIntrStats(), BSDIntrInit(), BSDNumInts(), OpenKDIfNeeded(), safe_kvm_read_symbol(), SymbolValue(), and ValidSymbol().