Hermes
0.7.0
Linux game streaming host
Toggle main menu visibility
Loading...
Searching...
No Matches
session_devices.h
Go to the documentation of this file.
1
5
#pragma once
6
7
#ifndef BOOST_PROCESS_VERSION
8
#define BOOST_PROCESS_VERSION 1
9
#endif
10
11
#include <memory>
12
#include <string>
13
#include <system_error>
14
#include <vector>
15
16
#include <sys/types.h>
17
18
#include <boost/filesystem/path.hpp>
19
#include <boost/process/v1/child.hpp>
20
#include <boost/process/v1/environment.hpp>
21
#include <boost/process/v1/group.hpp>
22
23
namespace
platf::session_devices {
24
25
struct
options_t
{
28
bool
devices
{};
30
bool
sound
{};
31
};
32
34
bool
available();
35
41
class
plan_t {
42
public
:
44
static
std::unique_ptr<plan_t>
isolate
(
const
std::string &staging,
options_t
options);
45
47
static
std::unique_ptr<plan_t>
join
(pid_t pid);
48
50
void
apply
()
const
noexcept
;
51
52
plan_t();
53
~plan_t();
54
55
struct
op_t
;
56
57
private
:
58
std::string join_path;
59
std::string staging;
60
std::vector<op_t> ops;
61
};
62
64
boost::process::v1::child run_command(
const
plan_t
*plan,
const
std::string &cmd, boost::filesystem::path &working_dir,
const
boost::process::v1::environment &env, FILE *file, std::error_code &ec, boost::process::v1::group *group);
65
74
class
mirror_t
{
75
public
:
76
virtual
~mirror_t
() =
default
;
77
};
78
80
std::unique_ptr<mirror_t>
mirror
(pid_t pid,
const
std::string &seat,
bool
hide_hid_gamepads =
false
);
81
}
// namespace platf::session_devices
platf::session_devices::mirror_t
Keeps a session's /dev holding its devices while they come and go.
Definition
session_devices.h:74
platf::session_devices::plan_t
Work done in a session's process between fork and exec.
Definition
session_devices.h:41
platf::session_devices::plan_t::isolate
static std::unique_ptr< plan_t > isolate(const std::string &staging, options_t options)
A new mount namespace with /dev built on the empty directory staging.
Definition
session_devices.cpp:112
platf::session_devices::plan_t::join
static std::unique_ptr< plan_t > join(pid_t pid)
The mount namespace of a running session process.
Definition
session_devices.cpp:175
platf::session_devices::plan_t::apply
void apply() const noexcept
Child side; exits the child on failure.
Definition
session_devices.cpp:181
platf::session_devices::mirror
std::unique_ptr< mirror_t > mirror(pid_t pid, const std::string &seat, bool hide_hid_gamepads)
Mirror into the /dev of pid's mount namespace; nullptr on failure.
Definition
session_devices.cpp:514
platf::session_devices::options_t
Definition
session_devices.h:25
platf::session_devices::options_t::devices
bool devices
Definition
session_devices.h:28
platf::session_devices::options_t::sound
bool sound
No /dev/snd; the session's audio server is its only way to sound.
Definition
session_devices.h:30
platf::session_devices::plan_t::op_t
Definition
session_devices.cpp:48
src
platform
linux
session_devices.h
Generated by
1.18.0