add makefile, fix annoying errors

This commit is contained in:
2026-08-13 17:39:36 +02:00
parent 73a9b4303d
commit e4e7c4bbc2
9 changed files with 129 additions and 31 deletions

View File

@@ -1,8 +1,7 @@
#ifndef LINUXSMARTIE_UTILS_H
#define LINUXSMARTIE_UTILS_H
#include <stddef.h>
#include <time.h>
#include <sys/types.h>
#if __STDC_VERSION__ >= 202000L
#define C_STD "C23"
@@ -22,11 +21,11 @@
#define P_BYTES(bytes, start) pretty_bytes((bytes), (start), (char[16]){0}, 16)
#define P_NUM(num) pretty_num((num), (char[16]){0}, 16)
int get_instance_lock(void);
int get_instance_lock();
void timespec_add_ms(struct timespec *ts, uint16_t ms);
uint64_t timespec_diff_us(const struct timespec *a, const struct timespec *b);
int64_t timespec_diff_us(const struct timespec *a, const struct timespec *b);
char *pretty_num(double num, char *buf, size_t bufsz);
@@ -34,7 +33,7 @@ char *pretty_bytes(uint64_t bytes, int8_t start_suffix, char *buf, size_t bufsz)
int get_hwmon_dir(char *path, size_t bufsz);
size_t read_file(const char *dir, const char *file, char *buffer, size_t n);
ssize_t read_file(const char *dir, const char *file, char *buffer, size_t n);
void fast_read_num_u64(const char *dir, const char *file, char *buf, uint64_t *result, uint32_t divider);