Skip to content

Commit 04b1309

Browse files
committed
Swap (Haiku): detect detailed info
1 parent 64d4035 commit 04b1309

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/detection/swap/swap_haiku.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
#include "swap.h"
22

33
#include <OS.h>
4+
#include <driver_settings.h>
45

5-
const char* ffDetectSwap(FFSwapResult* swap)
6+
const char* ffDetectSwap(FFlist* result)
67
{
78
system_info info;
89
if (get_system_info(&info) != B_OK)
910
return "Error getting system info";
1011

1112
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
13+
FFSwapResult* swap = ffListAdd(result);
14+
ffStrbufInitStatic(&swap->name, "System");
15+
void* kvms = load_driver_settings("virtual_memory"); // /boot/home/config/settings/kernel/drivers/virtual_memory
16+
if (kvms)
17+
{
18+
const char* swapAuto = get_driver_parameter(kvms, "swap_auto", NULL, NULL);
19+
if (swapAuto)
20+
ffStrbufSetStatic(&swap->name, swapAuto[0] == 'y' ? "Auto" : "Manual");
21+
unload_driver_settings(kvms);
22+
}
1223
swap->bytesTotal = pageSize * (uint64_t) info.max_swap_pages;
1324
swap->bytesUsed = pageSize * (uint64_t) (info.max_swap_pages - info.free_swap_pages);
1425

0 commit comments

Comments
 (0)