FreeBSD and OpenBSD ports

- Removed OpenBSD stuff from freebsd port
- Renamed bsd folder to freebsd since now it contains only
  freebsd-relevant files.
- Changed CMake instructions to account for bsd port changes
- modified main source file to account for openbsd port
This commit is contained in:
Pawel "l0ner" Soltys 2015-01-19 23:57:53 +01:00
parent 8afed01977
commit 112004f3db
14 changed files with 31 additions and 20 deletions

@ -66,12 +66,12 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
message("FreeBSD detected") message("FreeBSD detected")
message( WARNING "FreeBSD is still experimental!" ) message( WARNING "FreeBSD is still experimental!" )
set(METER_SOURCES "bsd/memory_freebsd.cc" "bsd/cpu.cc" "bsd/load.cc") set( METER_SOURCES "freebsd/memory.cc" "freebsd/cpu.cc" "freebsd/load.cc" )
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
message(STATUS "OpenBSD detected") # OpenBSD Stuff Here
message(FATAL_ERROR message( "OpenBSD detected")
"OpenBSD is not supported! See bsd/openBSD.txt for more info") message( WARNING "OpenBSD is still experimental!" )
set(METER_SOURCES "bsd/memory_openbsd.cc" "bsd/cpu.cc" "bsd/load.cc") set( METER_SOURCES "openbsd/memory.cc" "openbsd/cpu.cc" "openbsd/load.cc" )
else() else()
message(FATAL_ERROR "Cannot be compiled on this system" ) message(FATAL_ERROR "Cannot be compiled on this system" )
endif() endif()

@ -34,12 +34,17 @@
#include "osx/cpu.h" #include "osx/cpu.h"
#include "osx/memory.h" #include "osx/memory.h"
#include "osx/load.h" #include "osx/load.h"
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__)
// BSD system // BSD system
#define BSD_BASED 1 #define BSD_BASED 1
#include "bsd/cpu.h" #include "freebsd/cpu.h"
#include "bsd/load.h" #include "freebsd/load.h"
#include "bsd/memory.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 #else
// assume linux system // assume linux system
#include "linux/cpu.h" #include "linux/cpu.h"

@ -19,6 +19,13 @@
#ifndef CPU_H_ #ifndef CPU_H_
#define 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 ); float cpu_percentage( unsigned );
#endif #endif

@ -27,14 +27,6 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/types.h> #include <sys/types.h>
// 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)) #define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
static inline void getsysctl( const char *name, void *ptr, size_t len ) static inline void getsysctl( const char *name, void *ptr, size_t len )
{ {

@ -23,7 +23,7 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/types.h> #include <sys/types.h>
#include "common.h" #include "error.h"
#include "cpu.h" #include "cpu.h"
uint8_t get_cpu_count() uint8_t get_cpu_count()

@ -3,6 +3,13 @@
#include <sys/types.h> #include <sys/types.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); float cpu_percentage(unsigned);
uint8_t getCpuCount(); uint8_t getCpuCount();

@ -25,7 +25,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/vmmeter.h> // vmtotal struct #include <sys/vmmeter.h> // vmtotal struct
#include "common.h" #include "error.h"
#include "memory.h" #include "memory.h"
#include "../luts.h" #include "../luts.h"