summaryrefslogtreecommitdiffstats
path: root/freebsd
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2014-11-27 16:27:34 -0200
committerHisham Muhammad <hisham@gobolinux.org>2014-11-27 16:27:34 -0200
commit8915b293957ccaad902c190e9e2aca27eb6f8180 (patch)
treefc39def5711d6529035048185fccdb3a9679e926 /freebsd
parenta75161f8628d04a77bb85ff68a25aa0985b9e15d (diff)
Beginnings of FreeBSD port!
Diffstat (limited to 'freebsd')
-rw-r--r--freebsd/FreeBSDCRT.c21
-rw-r--r--freebsd/FreeBSDCRT.h15
-rw-r--r--freebsd/FreeBSDProcessList.c39
-rw-r--r--freebsd/FreeBSDProcessList.h18
-rw-r--r--freebsd/Platform.c17
-rw-r--r--freebsd/Platform.h17
6 files changed, 127 insertions, 0 deletions
diff --git a/freebsd/FreeBSDCRT.c b/freebsd/FreeBSDCRT.c
new file mode 100644
index 00000000..c4e65eeb
--- /dev/null
+++ b/freebsd/FreeBSDCRT.c
@@ -0,0 +1,21 @@
+/*
+htop - UnsupportedCRT.c
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "config.h"
+#include "CRT.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+void CRT_handleSIGSEGV(int sgn) {
+ (void) sgn;
+ CRT_done();
+ fprintf(stderr, "\n\nhtop " VERSION " aborting.\n");
+ fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
+ fprintf(stderr, "\nPlease contact your platform package mantainer!\n\n");
+ abort();
+}
+
diff --git a/freebsd/FreeBSDCRT.h b/freebsd/FreeBSDCRT.h
new file mode 100644
index 00000000..3c808ca6
--- /dev/null
+++ b/freebsd/FreeBSDCRT.h
@@ -0,0 +1,15 @@
+/* Do not edit this file. It was automatically generated. */
+
+#ifndef HEADER_UnsupportedCRT
+#define HEADER_UnsupportedCRT
+/*
+htop - UnsupportedCRT.h
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+void CRT_handleSIGSEGV(int sgn);
+
+
+#endif
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c
new file mode 100644
index 00000000..275c1082
--- /dev/null
+++ b/freebsd/FreeBSDProcessList.c
@@ -0,0 +1,39 @@
+/*
+htop - UnsupportedProcessList.c
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "ProcessList.h"
+
+#include <stdlib.h>
+#include <sys/sysctl.h>
+
+/*{
+
+}*/
+
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
+ ProcessList* this = calloc(1, sizeof(ProcessList));
+ ProcessList_init(this, usersTable, pidWhiteList);
+
+ int cpus = 1;
+ size_t sizeof_cpus = sizeof(cpus);
+ int err = sysctlbyname("hw.ncpu", &cpus, &sizeof_cpus, NULL, 0);
+ if (err) cpus = 1;
+ this->cpuCount = MAX(cpus, 1);
+ this->cpus = realloc(this->cpus, cpus * sizeof(CPUData));
+
+ for (int i = 0; i < cpus; i++) {
+ this->cpus[i].totalTime = 1;
+ this->cpus[i].totalPeriod = 1;
+ }
+
+ return this;
+}
+
+void ProcessList_scan(ProcessList* this) {
+ (void) this;
+ // stub!
+}
diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h
new file mode 100644
index 00000000..ed9a7a36
--- /dev/null
+++ b/freebsd/FreeBSDProcessList.h
@@ -0,0 +1,18 @@
+/* Do not edit this file. It was automatically generated. */
+
+#ifndef HEADER_FreeBSDProcessList
+#define HEADER_FreeBSDProcessList
+/*
+htop - UnsupportedProcessList.h
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+
+
+ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList);
+
+void ProcessList_scan(ProcessList* this);
+
+#endif
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
new file mode 100644
index 00000000..b65fec40
--- /dev/null
+++ b/freebsd/Platform.c
@@ -0,0 +1,17 @@
+/*
+htop - unsupported/Platform.c
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "Platform.h"
+
+/*{
+#include "Action.h"
+}*/
+
+void Platform_setBindings(Htop_Action* keys) {
+ (void) keys;
+}
+
diff --git a/freebsd/Platform.h b/freebsd/Platform.h
new file mode 100644
index 00000000..65a31993
--- /dev/null
+++ b/freebsd/Platform.h
@@ -0,0 +1,17 @@
+/* Do not edit this file. It was automatically generated. */
+
+#ifndef HEADER_Platform
+#define HEADER_Platform
+/*
+htop - unsupported/Platform.h
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "Action.h"
+
+void Platform_setBindings(Htop_Action* keys);
+
+
+#endif