diff --git a/CMakeLists.txt b/CMakeLists.txt index 0211974..520a431 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,13 +65,13 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(METER_SOURCES "osx/memory.cc" "osx/cpu.cc" "osx/load.cc") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") message("FreeBSD detected") - message(WARNING "FreeBSD is still experimental!") - set(METER_SOURCES "bsd/memory_freebsd.cc" "bsd/cpu.cc" "bsd/load.cc") + message( WARNING "FreeBSD is still experimental!" ) + set( METER_SOURCES "freebsd/memory.cc" "freebsd/cpu.cc" "freebsd/load.cc" ) elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") - message(STATUS "OpenBSD detected") - message(FATAL_ERROR - "OpenBSD is not supported! See bsd/openBSD.txt for more info") - set(METER_SOURCES "bsd/memory_openbsd.cc" "bsd/cpu.cc" "bsd/load.cc") + # OpenBSD Stuff Here + message( "OpenBSD detected") + message( WARNING "OpenBSD is still experimental!" ) + set( METER_SOURCES "openbsd/memory.cc" "openbsd/cpu.cc" "openbsd/load.cc" ) else() message(FATAL_ERROR "Cannot be compiled on this system" ) endif() diff --git a/common/main.cc b/common/main.cc index 2937a39..a5fa0db 100644 --- a/common/main.cc +++ b/common/main.cc @@ -34,12 +34,17 @@ #include "osx/cpu.h" #include "osx/memory.h" #include "osx/load.h" -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) // BSD system #define BSD_BASED 1 - #include "bsd/cpu.h" - #include "bsd/load.h" - #include "bsd/memory.h" + #include "freebsd/cpu.h" + #include "freebsd/load.h" + #include "freebsd/memory.h" +#elif defined(__OpenBSD) + #define BSD_BASED 1 + #include "freebsd/cpu.h" + #include "freebsd/load.h" + #include "freebsd/memory.h" #else // assume linux system #include "linux/cpu.h" diff --git a/bsd/cpu.cc b/freebsd/cpu.cc similarity index 100% rename from bsd/cpu.cc rename to freebsd/cpu.cc diff --git a/bsd/cpu.h b/freebsd/cpu.h similarity index 86% rename from bsd/cpu.h rename to freebsd/cpu.h index ebc0e8e..3840650 100644 --- a/bsd/cpu.h +++ b/freebsd/cpu.h @@ -19,6 +19,13 @@ #ifndef CPU_H_ #define CPU_H_ +#define CP_USER 0 +#define CP_NICE 1 +#define CP_SYS 2 +#define CP_INTR 3 +#define CP_IDLE 4 +#define CPUSTATES 5 + float cpu_percentage( unsigned ); #endif diff --git a/bsd/getsysctl.h b/freebsd/getsysctl.h similarity index 91% rename from bsd/getsysctl.h rename to freebsd/getsysctl.h index 58f6860..aecd004 100644 --- a/bsd/getsysctl.h +++ b/freebsd/getsysctl.h @@ -27,14 +27,6 @@ #include #include -// CPU percentages stuff -#define CP_USER 0 -#define CP_NICE 1 -#define CP_SYS 2 -#define CP_INTR 3 -#define CP_IDLE 4 -#define CPUSTATES 5 - #define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var)) static inline void getsysctl( const char *name, void *ptr, size_t len ) { diff --git a/bsd/load.cc b/freebsd/load.cc similarity index 100% rename from bsd/load.cc rename to freebsd/load.cc diff --git a/bsd/load.h b/freebsd/load.h similarity index 100% rename from bsd/load.h rename to freebsd/load.h diff --git a/bsd/memory_freebsd.cc b/freebsd/memory.cc similarity index 100% rename from bsd/memory_freebsd.cc rename to freebsd/memory.cc diff --git a/bsd/memory.h b/freebsd/memory.h similarity index 100% rename from bsd/memory.h rename to freebsd/memory.h diff --git a/bsd/openBSD.txt b/freebsd/openBSD.txt similarity index 100% rename from bsd/openBSD.txt rename to freebsd/openBSD.txt diff --git a/openbsd/cpu.cc b/openbsd/cpu.cc index fc22f94..4fb2681 100644 --- a/openbsd/cpu.cc +++ b/openbsd/cpu.cc @@ -23,7 +23,7 @@ #include #include -#include "common.h" +#include "error.h" #include "cpu.h" uint8_t get_cpu_count() diff --git a/openbsd/cpu.h b/openbsd/cpu.h index ab8cee9..5a6a641 100644 --- a/openbsd/cpu.h +++ b/openbsd/cpu.h @@ -3,6 +3,13 @@ #include +#define CP_USER 0 +#define CP_NICE 1 +#define CP_SYS 2 +#define CP_INTR 3 +#define CP_IDLE 4 +#define CPUSTATES 5 + float cpu_percentage(unsigned); uint8_t getCpuCount(); diff --git a/openbsd/common.h b/openbsd/error.h similarity index 100% rename from openbsd/common.h rename to openbsd/error.h diff --git a/openbsd/memory.cc b/openbsd/memory.cc index 6442a1d..d42ef80 100644 --- a/openbsd/memory.cc +++ b/openbsd/memory.cc @@ -25,7 +25,7 @@ #include #include // vmtotal struct -#include "common.h" +#include "error.h" #include "memory.h" #include "../luts.h"