|
SB++
Sandbox applications
|
Shared functionality. More...
Data Structures | |
| class | TemporaryDirectory |
| A Temporary Directory A directory that destroys itself upon falling out of scope. More... | |
Typedefs | |
| using | set = std::set<std::string> |
| using | vector = std::vector<std::string> |
| using | list = std::initializer_list<std::string_view> |
Functions | |
| void | log (const list &msg, const std::string &level="log") |
| Log output to console, if verbose. | |
| bool | contains (const char &v, const char &d) |
| bool | contains (const char &v, const std::string_view &d) |
| void | emplace (std::set< std::string > &working, const std::string_view &val) |
| void | emplace (std::vector< std::string > &working, const std::string_view &val) |
| template<class T> | |
| std::string | join (const T &list, const char &joiner=' ') |
| Join a vector into a string. | |
| template std::string | join (const list &, const char &) |
| template std::string | join (const vector &, const char &) |
| template std::string | join (const set &, const char &) |
| template<typename T> | |
| std::string | strip (const std::string_view &in, const T &to_strip) |
| Strip all instance of character from a string. | |
| template std::string | strip (const std::string_view &, const char &) |
| template std::string | strip (const std::string_view &, const std::string_view &) |
| template<typename T> | |
| std::string | trim (const std::string &in, const T &to_strip) |
| Trim characters from the front and end of a string. | |
| template std::string | trim (const std::string &, const char &) |
| template std::string | trim (const std::string &, const std::string_view &) |
| set | wildcard (const std::string_view &pattern, const std::string_view &path, const list &args={}) |
| Resolve wildcard patterns. | |
| void | genv (vector &command, const std::string_view &env) |
| Attach an environment variable to the sandbox. | |
| template<class T> | |
| void | extend (vector &dest, T source) |
| Extend a container in place. | |
| template void | extend (vector &, list) |
| template void | extend (vector &, vector) |
| template void | extend (vector &, set) |
| template<class T> | |
| void | extend (set &dest, const T source) |
| template void | extend (set &, const list) |
| template void | extend (set &, const vector) |
| void | extend (set &dest, set source) |
| void | inotify_wait (const int &wd, const std::string_view &name="") |
| Wait for an inotify watcher. | |
| void | share (vector &command, const std::string_view &path, const std::string &mode="ro-bind") |
| Share a path with the sandbox using a mode. | |
| std::string | hash (const std::string_view &in) |
| Hash a string. | |
| std::string | escape (const std::string &in) |
| Escape a string. | |
| void | merge (set &command, set path) |
| Merge two sets together. | |
| template<class T, class A, class L = list, class ... Args> | |
| void | single_batch (const A &fun, T &accum, const L &mem, Args &&... args) |
| Batch multiple iterations of an accumulator function together. | |
| template<class T, class A, class L = list, class ... Args> | |
| void | batch (const A &fun, T &accum, const L &mem, Args &&... args) |
| Batch multiple iterations of an accumulator function together, threaded. | |
| void | extend (vector &dest, const std::initializer_list< const list > &source) |
| Batch multiple extend calls into the thread pool. | |
Variables | |
| BS::thread_pool< BS::tp::wait_deadlock_checks > | pool = {} |
| int | inotify = -1 |
| const std::string | home = std::getenv("HOME") |
| const std::string | runtime = std::getenv("XDG_RUNTIME_DIR") |
| const std::string | session = std::getenv("DBUS_SESSION_BUS_ADDRESS") |
| const std::string | config = std::getenv("XDG_CONFIG_HOME") == nullptr ? home + "/.config/" : std::getenv("XDG_CONFIG_HOME") |
| const std::string | cache = std::getenv("XDG_CACHE_HOME") == nullptr ? home + "/.cache/" : std::getenv("XDG_CACHE_HOME") |
| const std::string | data = std::getenv("XDG_DATA_HOME") == nullptr ? home + "/.local/share/" : std::getenv("XDG_DATA_HOME") |
| const std::string | nobody = std::to_string(getpwnam("nobody")->pw_uid) |
| const std::string | real = std::to_string(getuid()) |
| std::filesystem::path | data_dir = std::filesystem::path(data) / "sb" |
| std::filesystem::path | app_data = "" |
Shared functionality.
| void shared::batch | ( | const A & | fun, |
| T & | accum, | ||
| const L & | mem, | ||
| Args &&... | args ) |
Batch multiple iterations of an accumulator function together, threaded.
| T | The accumulator type. |
| A | The function type |
| L | The container holding each value. |
| ...Args | Additional arguments. |
| fun | The function to call. |
| accum | The accumulator to append to. |
| mem | The list of values to emplace. |
| args | Additional arguments. |
Here is the call graph for this function:
Here is the caller graph for this function:| std::string shared::escape | ( | const std::string & | in | ) |
Escape a string.
| in | The string to escape. |
| void shared::extend | ( | vector & | dest, |
| const std::initializer_list< const list > & | source ) |
Batch multiple extend calls into the thread pool.
| T | The list type. |
| dest | The accumulator. |
| source | A list of lists that need to be extended. |
| void shared::extend | ( | vector & | dest, |
| T | source ) |
Extend a container in place.
| T | The container type for both dest and source. |
| dest | The container to extend. |
| source | The values to pull from. |
Here is the caller graph for this function:| void shared::genv | ( | vector & | command, |
| const std::string_view & | env ) |
Attach an environment variable to the sandbox.
| command | The command to append to. |
| env | The environment variable to add. |
Here is the call graph for this function:| std::string shared::hash | ( | const std::string_view & | in | ) |
Hash a string.
| in | The input string. |
Here is the call graph for this function:
Here is the caller graph for this function:| void shared::inotify_wait | ( | const int & | wd, |
| const std::string_view & | name = "" ) |
Wait for an inotify watcher.
| wd | The inotify FD for a specific watch. |
| name | The optional name to look out for. |
| std::string shared::join | ( | const T & | list, |
| const char & | joiner = ' ' ) |
Join a vector into a string.
| The | container. Defaults to vector of strings, but can also be set. |
| list | The list to join. |
| joiner | The character to join each member. |
Here is the caller graph for this function:| void shared::log | ( | const list & | msg, |
| const std::string & | level = "log" ) |
Log output to console, if verbose.
| msg | A list of strings to be printed. |
Here is the caller graph for this function:| void shared::merge | ( | set & | command, |
| set | path ) |
Merge two sets together.
| command | The set to be extended. |
| path | The set to merge into the first. |
| void shared::share | ( | vector & | command, |
| const std::string_view & | path, | ||
| const std::string & | mode = "ro-bind" ) |
Share a path with the sandbox using a mode.
| command | The command to append to. |
| path | The path to share. |
| mode | The mode to use to share. |
Here is the call graph for this function:
Here is the caller graph for this function:| void shared::single_batch | ( | const A & | fun, |
| T & | accum, | ||
| const L & | mem, | ||
| Args &&... | args ) |
Batch multiple iterations of an accumulator function together.
| T | The accumulator type. |
| A | The function type. |
| L | The container holding each value. |
| ...Args | Additional arguments. |
| fun | The function to call |
| accum | The accumulator passed to the function. |
| mem | The list of values to emplace. |
| args | Additional arguments. |
Here is the caller graph for this function:| std::string shared::strip | ( | const std::string_view & | in, |
| const T & | to_strip ) |
Strip all instance of character from a string.
| in | The input string. |
| to_strip | A list of characters to remove |
Here is the caller graph for this function:| std::string shared::trim | ( | const std::string & | in, |
| const T & | to_strip ) |
Trim characters from the front and end of a string.
| in | The input string. |
| to_strip | The list of characters to trim. |
Here is the caller graph for this function:| set shared::wildcard | ( | const std::string_view & | pattern, |
| const std::string_view & | path, | ||
| const list & | args = {} ) |
Resolve wildcard patterns.
| pattern | The pattern to resolve |
| path | The path to look in |
| args | Any additional arguments to find. |
Here is the caller graph for this function: