diff options
Diffstat (limited to 'src/detection/initsystem/initsystem_haiku.c')
| -rw-r--r-- | src/detection/initsystem/initsystem_haiku.c | 35 |
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; +} |