| Server IP : 82.208.35.60 / Your IP : 216.73.216.89 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/x11/deforaos-panel/files/ |
Upload File : |
--- src/applets/swap.c.orig 2015-10-24 01:33:21.000000000 +0200
+++ src/applets/swap.c 2016-03-02 09:10:06.697330000 +0100
@@ -19,9 +19,15 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#if defined(__linux__)
+#if defined(__FreeBSD__)
+# include <sys/types.h>
+# include <sys/sysctl.h>
+# include <sys/vmmeter.h>
+# include <vm/vm_param.h>
+#elif defined(__linux__)
# include <sys/sysinfo.h>
#elif defined(__NetBSD__)
+# include <sys/param.h>
# include <sys/sysctl.h>
# include <uvm/uvm_extern.h>
#endif
@@ -128,7 +134,20 @@
/* swap_on_timeout */
static gboolean _swap_on_timeout(gpointer data)
{
-#if defined(__linux__)
+#if defined(__FreeBSD__)
+ Swap * swap = data;
+ int mib[] = { CTL_VM, VM_TOTAL };
+ struct vmtotal t;
+ size_t size = sizeof(t);
+ gdouble value;
+
+ if(sysctl(mib, 2, &t, &size, NULL, 0) < 0)
+ return TRUE;
+ value = t.t_rm;
+ value /= t.t_vm;
+ _swap_set(swap, value);
+ return TRUE;
+#elif defined(__linux__)
Swap * swap = data;
struct sysinfo sy;
gdouble value;
@@ -157,7 +176,7 @@
Swap * swap = data;
/* FIXME not supported */
- swap->source = 0;
+ swap->timeout = 0;
return FALSE;
#endif
}