--- 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 #include #include -#if defined(__linux__) +#if defined(__FreeBSD__) +# include +# include +# include +# include +#elif defined(__linux__) # include #elif defined(__NetBSD__) +# include # include # include #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 }