summaryrefslogtreecommitdiffstats
path: root/src/detection/initsystem/initsystem_haiku.c
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/initsystem/initsystem_haiku.c
Add the files
Diffstat (limited to 'src/detection/initsystem/initsystem_haiku.c')
-rw-r--r--src/detection/initsystem/initsystem_haiku.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/detection/initsystem/initsystem_haiku.c b/src/detection/initsystem/initsystem_haiku.c
new file mode 100644
index 0000000..04857bc
--- /dev/null
+++ b/src/detection/initsystem/initsystem_haiku.c
@@ -0,0 +1,35 @@
+#include "initsystem.h"
+#include "common/strutil.h"
+#include "common/haiku/version.h"
+#include "common/io.h"
+
+#include <OS.h>
+#include <unistd.h>
+
+const char* ffDetectInitSystem(FFInitSystemResult* result) {
+ // Since it runs first, registrar does not know about it,
+ // so we can't query be_roster for it.
+ const char* path = "/boot/system/servers/launch_daemon";
+ if (!ffPathExists(path, FF_PATHTYPE_FILE)) {
+ return "launch_daemon is not found";
+ }
+
+ ffStrbufSetStatic(&result->exe, path);
+ ffStrbufSetStatic(&result->name, "launch_daemon");
+ result->pid = 0;
+
+ team_info teamInfo;
+ int32 cookie = 0;
+ while (get_next_team_info(&cookie, &teamInfo) == B_OK) {
+ if (ffStrEquals(teamInfo.args, path)) {
+ result->pid = (uint32_t) teamInfo.team;
+ break;
+ }
+ }
+
+ if (instance.config.general.detectVersion) {
+ ffGetFileVersion(path, &result->version);
+ }
+
+ return NULL;
+}