Miscellaneous declarations for Linux.
More...
#include <chrono>
#include <fcntl.h>
#include <filesystem>
#include <thread>
#include <unistd.h>
#include <vector>
#include "src/utility.h"
Go to the source code of this file.
|
|
using | dyn::apiproc = void (*)(void) |
| | Generic GLX procedure pointer returned by the loader.
|
|
| library_t * | dyn::handle (const std::vector< const char * > &libs) |
| | Open the first available shared library from a nonempty list.
|
| void | platf::handle_pacing (std::chrono::steady_clock::time_point &next_frame, std::chrono::nanoseconds delay, auto &logger) |
| | Generic frame pacing logic for Linux capture methods.
|
| int | dyn::load (library_t *handle, const std::vector< std::tuple< apiproc *, const char * > > &funcs, bool strict) |
| | Load named functions from an open shared library.
|
| int | platf::open_drm_card_fd (const std::filesystem::path &path, int flags) |
| | Open a DRM card node, dropping implicit DRM master when possible.
|
| bool | platf::sanitize_process_environment () |
| | Remove environment variables that can load untrusted GUI modules.
|
Miscellaneous declarations for Linux.
◆ window_system_e
Enumerates supported window system options.
| Enumerator |
|---|
| NONE | No window system.
|
| X11 | X11.
|
| WAYLAND | Wayland.
|
◆ handle()
| void * dyn::handle |
( |
const std::vector< const char * > & | libs | ) |
|
Open the first available shared library from a nonempty list.
Return the native handle owned by the wrapper.
- Returns
- Open library handle, or null if none could be loaded.
- Parameters
-
| libs | List of libraries to probe for the requested symbol. |
- Returns
- Native dynamic-library handle, or nullptr when no library can be opened.
◆ handle_pacing()
| void platf::handle_pacing |
( |
std::chrono::steady_clock::time_point & | next_frame, |
|
|
std::chrono::nanoseconds | delay, |
|
|
auto & | logger ) |
|
inline |
Generic frame pacing logic for Linux capture methods.
Advances the frame pacing timeline and re-anchors it if the capture thread falls behind.
- Parameters
-
| next_frame | Time point that the next frame will be targeted against. |
| delay | Delay interval used to pace next frame. |
| logger | The sleep_overshoot_logger for tracking discontinuities. |
◆ load()
| int dyn::load |
( |
library_t * | handle, |
|
|
const std::vector< std::tuple< apiproc *, const char * > > & | funcs, |
|
|
bool | strict = true ) |
Load named functions from an open shared library.
- Parameters
-
| handle | Library whose symbols are queried. |
| funcs | Function pointer destinations and corresponding symbol names. |
| strict | Whether missing symbols make the operation fail. |
- Returns
- Zero on success or minus one when a required symbol is missing.
◆ open_drm_card_fd()
| int platf::open_drm_card_fd |
( |
const std::filesystem::path & | path, |
|
|
int | flags ) |
Open a DRM card node, dropping implicit DRM master when possible.
Open a DRM card node and drop implicit DRM master, if any.
See misc.h for full documentation. Master check/drop failures are logged as warnings but do not fail the call.
Performs open(path, flags | O_CLOEXEC) and probes the resulting fd with DRM_IOCTL_AUTH_MAGIC. If the kernel implicitly handed us master, calls drmDropMaster and re-verifies before returning. Master check/drop failures are logged as warnings but do not fail the call: the caller still receives a usable fd.
Callers should use this helper for any /dev/dri/cardN open so we never keep implicit master and block compositors from re-acquiring it on VT switches.
- Parameters
-
| path | Path to the DRM card node (e.g. /dev/dri/card0). |
| flags | open() flags. O_CLOEXEC is always OR-ed in. |
- Returns
- A file descriptor on success, or -1 if open() itself fails.
◆ sanitize_process_environment()
| bool platf::sanitize_process_environment |
( |
| ) |
|
Remove environment variables that can load untrusted GUI modules.
Loader paths and module lists used by Qt, GTK, GIO, and GdkPixbuf are removed before any of those libraries can initialize. The caller determines whether privileged execution requires the policy.
- Returns
- true when the environment is safe to use; false if a variable could not be removed.