|
Hermes 0.7.0
Linux game streaming host
|
Definitions for attaching a Hermes started before login to the session. More...
#include <array>#include <chrono>#include <condition_variable>#include <cstdlib>#include <mutex>#include <string_view>#include <thread>#include <unistd.h>#include "session_attach.h"#include "src/logging.h"#include "src/nvhttp.h"#include "src/rtsp.h"#include "virtual_display.h"Go to the source code of this file.
Functions | |
| environment_t | platf::session_attach::parse_environment (const std::vector< std::string > &assignments) |
| Split "NAME=value" assignments; entries without a name are dropped. | |
| environment_t | platf::session_attach::parse_environment_block (std::string_view block) |
| Parse an environment as the kernel keeps it: assignments separated by NUL bytes, as in /proc/self/environ. | |
| bool | platf::session_attach::display_server_reachable (const environment_t &environment) |
Whether a display server is listening where environment points. | |
| void | platf::session_attach::drop_stale_display_environment () |
| Forget display variables that point at a display server that is gone. | |
| environment_t | platf::session_attach::initial_environment () |
| The environment Hermes was started with, not the one it has now. | |
| bool | platf::session_attach::attach_needed (const environment_t &own, const environment_t &session) |
Whether session names a display server that own does not talk to. | |
| std::vector< std::string > | platf::session_attach::merged_environment (const environment_t &own, const environment_t &session) |
own with every variable of session laid over it, as "NAME=value" strings ready for execve(). | |
| std::vector< std::string > | platf::session_attach::restart_environment () |
| The environment the next restart must be given, as "NAME=value" strings for execve(). Read by platf::restart()'s re-exec. | |
| std::unique_ptr< platf::deinit_t > | platf::session_attach::start () |
| Start watching for a session to attach to. | |
Variables | |
| char ** | environ |
Definitions for attaching a Hermes started before login to the session.
Definition in file session_attach.cpp.
| bool platf::session_attach::attach_needed | ( | const environment_t & | own, |
| const environment_t & | session ) |
Whether session names a display server that own does not talk to.
Only the variables that select a display server and a desktop are compared; everything else in a session's environment is the session's business. A session that publishes no display server - gamescope-session does not - is never a reason to attach.
Definition at line 217 of file session_attach.cpp.
| bool platf::session_attach::display_server_reachable | ( | const environment_t & | environment | ) |
Whether a display server is listening where environment points.
Definition at line 179 of file session_attach.cpp.
| void platf::session_attach::drop_stale_display_environment | ( | ) |
Forget display variables that point at a display server that is gone.
A lingering user manager can keep the variables of a session after it ends, and hand them to a Hermes it starts afterwards. Qt aborts a process whose display variables point at nothing, and the tray is Qt: restarted into the same environment each time, Hermes would stay down on a machine that is by then waiting at its login screen. Call before anything reads the environment, while Hermes is still single-threaded.
Definition at line 187 of file session_attach.cpp.
| environment_t platf::session_attach::initial_environment | ( | ) |
The environment Hermes was started with, not the one it has now.
Hermes and its libraries adjust their own environment as they come up - the tray sets QT_QPA_PLATFORM=minimal when it finds no display, which before login is always. Carried into the re-exec, that one variable would be inherited by kscreen-doctor and every other Qt tool Hermes runs, none of which can reach Wayland through the minimal platform. What a restart of the unit would be given is the environment this process was started with, copied before main(), laid under what the user manager holds now. Not /proc/self/environ: with its file capabilities, the packaged Hermes is non-dumpable and cannot open it.
Definition at line 213 of file session_attach.cpp.
| std::vector< std::string > platf::session_attach::merged_environment | ( | const environment_t & | own, |
| const environment_t & | session ) |
own with every variable of session laid over it, as "NAME=value" strings ready for execve().
Definition at line 235 of file session_attach.cpp.
| environment_t platf::session_attach::parse_environment | ( | const std::vector< std::string > & | assignments | ) |
Split "NAME=value" assignments; entries without a name are dropped.
Definition at line 154 of file session_attach.cpp.
| environment_t platf::session_attach::parse_environment_block | ( | std::string_view | block | ) |
Parse an environment as the kernel keeps it: assignments separated by NUL bytes, as in /proc/self/environ.
Definition at line 166 of file session_attach.cpp.
| std::vector< std::string > platf::session_attach::restart_environment | ( | ) |
The environment the next restart must be given, as "NAME=value" strings for execve(). Read by platf::restart()'s re-exec.
The session's environment once Hermes is joining one. Otherwise the one Hermes was started with, never the live one: a restart from the Web UI or the tray before login would otherwise carry the tray's QT_QPA_PLATFORM=minimal into the next process, where it would look like part of the environment Hermes was started with and survive joining the session too. Empty only if neither can be read.
Definition at line 249 of file session_attach.cpp.
|
nodiscard |
Start watching for a session to attach to.
Definition at line 256 of file session_attach.cpp.