diff options
author | fraggerfox <santhosh.raju@gmail.com> | 2021-04-09 08:24:02 +0530 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-06-26 12:18:37 +0200 |
commit | 440bb87058fc591175c970b4d5f5c36aa957942d (patch) | |
tree | 504ef3f8e684fff7bfc2daf65fdcd55f95afee79 /netbsd/Platform.c | |
parent | db986236843ac87c89ea74cd13ab4aa8d90cf935 (diff) |
Minor code clean up and corrections.
Diffstat (limited to 'netbsd/Platform.c')
-rw-r--r-- | netbsd/Platform.c | 58 |
1 files changed, 1 insertions, 57 deletions
diff --git a/netbsd/Platform.c b/netbsd/Platform.c index 354476d3..c4a11e1a 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -1,5 +1,5 @@ /* -htop - openbsd/Platform.c +htop - netbsd/Platform.c (C) 2014 Hisham H. Muhammad (C) 2021 Santhosh Raju Released under the GNU GPLv2, see the COPYING file @@ -16,11 +16,9 @@ in the source distribution for its full text. #include <string.h> #include <time.h> #include <sys/resource.h> -//#include <sys/sensors.h> #include <sys/sysctl.h> #include <sys/time.h> #include <sys/types.h> -//#include <uvm/uvmexp.h> #include "CPUMeter.h" #include "ClockMeter.h" @@ -319,62 +317,8 @@ bool Platform_getNetworkIO(NetworkIOData* data) { return false; } -//static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, size_t* sdlen) { -// for (int devn = 0;; devn++) { -// mib[2] = devn; -// if (sysctl(mib, 3, snsrdev, sdlen, NULL, 0) == -1) { -// if (errno == ENXIO) -// continue; -// if (errno == ENOENT) -// return false; -// } -// if (String_eq(name, snsrdev->xname)) { -// return true; -// } -// } -//} - void Platform_getBattery(double* percent, ACPresence* isOnAC) { // TODO (void)percent; (void)isOnAC; -// int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0}; -// struct sensor s; -// size_t slen = sizeof(struct sensor); -// struct sensordev snsrdev; -// size_t sdlen = sizeof(struct sensordev); -// -// bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen); -// -// *percent = NAN; -// if (found) { -// /* last full capacity */ -// mib[3] = 7; -// mib[4] = 0; -// double last_full_capacity = 0; -// if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) -// last_full_capacity = s.value; -// if (last_full_capacity > 0) { -// /* remaining capacity */ -// mib[3] = 7; -// mib[4] = 3; -// if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) { -// double charge = s.value; -// *percent = 100 * (charge / last_full_capacity); -// if (charge >= last_full_capacity) { -// *percent = 100; -// } -// } -// } -// } -// -// found = findDevice("acpiac0", mib, &snsrdev, &sdlen); -// -// *isOnAC = AC_ERROR; -// if (found) { -// mib[3] = 9; -// mib[4] = 0; -// if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) -// *isOnAC = s.value; -// } } |