2021-07-10 06:43:15 +00:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2023-01-30 14:41:12 +00:00
|
|
|
#ifndef HC_EXT_SYSFS_CPU_H
|
|
|
|
#define HC_EXT_SYSFS_CPU_H
|
2021-07-10 06:43:15 +00:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
static const char SYSFS_HWMON[] = "/sys/class/hwmon";
|
|
|
|
|
|
|
|
static const char SENSOR_CORETEMP[] = "coretemp";
|
|
|
|
static const char SENSOR_K10TEMP[] = "k10temp";
|
|
|
|
static const char SENSOR_K8TEMP[] = "k8temp";
|
|
|
|
static const char SENSOR_ACPITZ[] = "acpitz";
|
|
|
|
|
2021-07-10 12:24:51 +00:00
|
|
|
static const char PROC_STAT[] = "/proc/stat";
|
|
|
|
|
2021-07-10 06:43:15 +00:00
|
|
|
typedef int HM_ADAPTER_SYSFS_CPU;
|
|
|
|
|
|
|
|
typedef void *SYSFS_CPU_LIB;
|
|
|
|
|
|
|
|
typedef struct hm_sysfs_cpu_lib
|
|
|
|
{
|
|
|
|
// currently not using libudev, because it can only read values, not set them, so using /sys instead
|
|
|
|
|
|
|
|
SYSFS_CPU_LIB lib;
|
|
|
|
|
|
|
|
} hm_sysfs_cpu_lib_t;
|
|
|
|
|
2021-07-10 12:24:51 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned long user;
|
|
|
|
unsigned long nice;
|
|
|
|
unsigned long system;
|
|
|
|
unsigned long idle;
|
|
|
|
unsigned long iowait;
|
|
|
|
unsigned long irq;
|
|
|
|
unsigned long softirq;
|
|
|
|
unsigned long steal;
|
|
|
|
unsigned long guest;
|
|
|
|
unsigned long guest_nice;
|
|
|
|
|
|
|
|
} proc_stat_t;
|
|
|
|
|
2021-07-10 06:43:15 +00:00
|
|
|
typedef hm_sysfs_cpu_lib_t SYSFS_CPU_PTR;
|
|
|
|
|
|
|
|
bool sysfs_cpu_init (void *hashcat_ctx);
|
|
|
|
void sysfs_cpu_close (void *hashcat_ctx);
|
2023-08-18 23:10:45 +00:00
|
|
|
char *hm_SYSFS_CPU_get_syspath_hwmon (void);
|
2021-07-10 06:43:15 +00:00
|
|
|
int hm_SYSFS_CPU_get_temperature_current (void *hashcat_ctx, int *val);
|
|
|
|
|
2021-07-10 12:24:51 +00:00
|
|
|
bool read_proc_stat (void *hashcat_ctx, proc_stat_t *proc_stat);
|
|
|
|
int hm_SYSFS_CPU_get_utilization_current (void *hashcat_ctx, int *val);
|
|
|
|
|
2023-01-30 14:41:12 +00:00
|
|
|
#endif // HC_EXT_SYSFS_CPU_H
|