formatting shit
This commit is contained in:
18
src/sys.c
18
src/sys.c
@@ -1,14 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sys.h"
|
||||
#include "log.h"
|
||||
#include "sys.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
void sys_get_time(struct time_date_t *td) {
|
||||
const char months[][4] = {"sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paz", "lis", "gru"};
|
||||
const char wdays[][4] = {"Nie", "Pon", "Wto", "Sro", "Czw", "Pia", "Sob"};
|
||||
@@ -31,15 +30,16 @@ void sys_get_ram(struct memory_t *ram) {
|
||||
return;
|
||||
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
sscanf(buf, "MemTotal: %lu kB", &ram->total); // NOLINT we live dangerously
|
||||
sscanf(buf, "MemTotal: %lu kB", &ram->total); // NOLINT we live dangerously
|
||||
sscanf(buf, "MemAvailable: %lu kB", &ram->free); // NOLINT (its not really that dangerous)
|
||||
if (ram->total && ram->free) break;
|
||||
if (ram->total && ram->free)
|
||||
break;
|
||||
}
|
||||
fclose(f);
|
||||
ram->used = ram->total - ram->free;
|
||||
}
|
||||
|
||||
void sys_get_disk(struct disk_t* disk) {
|
||||
void sys_get_disk(struct disk_t *disk) {
|
||||
struct statvfs diskData;
|
||||
statvfs(disk->mountpoint, &diskData);
|
||||
disk->usage.free = diskData.f_bfree * diskData.f_frsize;
|
||||
@@ -47,7 +47,7 @@ void sys_get_disk(struct disk_t* disk) {
|
||||
disk->usage.total = diskData.f_blocks * diskData.f_frsize;
|
||||
}
|
||||
|
||||
void sys_get_network(struct network_t* network) {
|
||||
void sys_get_network(struct network_t *network) {
|
||||
struct _net_t {
|
||||
struct timespec ts;
|
||||
uint64_t rx;
|
||||
@@ -69,7 +69,7 @@ void sys_get_network(struct network_t* network) {
|
||||
prev = current;
|
||||
}
|
||||
|
||||
void sys_detect(struct syssensors_t* s, const char* platform) {
|
||||
void sys_detect(struct syssensors_t *s, const char *platform) {
|
||||
snprintf(s->hwmon, sizeof(s->hwmon), "/sys/devices/platform/%s/hwmon", platform);
|
||||
const int ret = get_hwmon_dir(s->hwmon);
|
||||
if (ret != 0) {
|
||||
@@ -80,7 +80,7 @@ void sys_detect(struct syssensors_t* s, const char* platform) {
|
||||
applog(LOG_INF, "Detected system sensors in %s", s->hwmon);
|
||||
}
|
||||
|
||||
void sys_update_sensors(struct syssensors_t* s) {
|
||||
void sys_update_sensors(struct syssensors_t *s) {
|
||||
if (!s->hwmon[0])
|
||||
return;
|
||||
static char buf[8];
|
||||
|
||||
Reference in New Issue
Block a user