Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
service_lifecycle.h
Go to the documentation of this file.
1
5#pragma once
6#include <string_view>
7
8namespace platf {
9 inline bool is_hermes_user_service_cgroup(std::string_view entry) {
10 // Accept unified and legacy systemd cgroup entries. A terminal can inherit
11 // INVOCATION_ID from another unit, so that environment variable is not proof.
12 const auto first = entry.find(':');
13 const auto second = first == std::string_view::npos ? first : entry.find(':', first + 1);
14 if (second == std::string_view::npos) {
15 return false;
16 }
17 const auto path = entry.substr(second + 1);
18 return path.find("/user@") != std::string_view::npos && path.ends_with("/hermes.service");
19 }
20} // namespace platf