SB++
Sandbox applications
Loading...
Searching...
No Matches
libraries Namespace Reference

Shared-Library Dependency Resolution This header contains all the relevant functions for resolving shared-libraries needed by ELF binaries. It does this through through threaded calls to LDD. Unlike Python-SB, SB++ computes dependencies in one shot, including both wildcards and directories. Therefore, there is no need for additional computation upon calling setup(), it can simply copy the found files to the SOF. LDD is the major bottle neck for speed, and thus the two implementations are comparable on speed on library resolution. More...

Typedefs

using lib_t = shared::set
 

Functions

std::filesystem::path cache_name (std::string library, const std::string &function)
 
void parse_ldd (lib_t &required, const std::string &library, const std::string_view &directory)
 
void get (lib_t &libraries, const std::string_view &library, std::string directory="")
 Recursively resolve all shared-libraries needed by a library.
 
void setup (const vector &libraries, const std::string_view &application, const std::filesystem::path &app_sof)
 
void setup (const shared::set &libraries, const std::string_view &application, const std::filesystem::path &app_sof)
 Setup an SOF directory.
 
void symlink (shared::vector &command)
 Add symlink commands.
 
std::filesystem::path hash_cache (const std::string_view &program, const std::string &hash)
 
std::filesystem::path hash_sof (const std::string_view &program, const std::string &hash)
 
template<class C>
void resolve (const C &required, const std::string_view &program, const std::string &l_hash, const bool &exclude=true)
 

Variables

lib_t directories = {}
 

Detailed Description

Shared-Library Dependency Resolution This header contains all the relevant functions for resolving shared-libraries needed by ELF binaries. It does this through through threaded calls to LDD. Unlike Python-SB, SB++ computes dependencies in one shot, including both wildcards and directories. Therefore, there is no need for additional computation upon calling setup(), it can simply copy the found files to the SOF. LDD is the major bottle neck for speed, and thus the two implementations are comparable on speed on library resolution.

Function Documentation

◆ get()

void libraries::get ( lib_t & libraries,
const std::string_view & library,
std::string directory = "" )

Recursively resolve all shared-libraries needed by a library.

Parameters
libraryThe path to the library.
directoryThe sub-directory within /usr/lib. Used internally.
Returns
: A set of all shared libraries used by the program and its dependencies.
Note
library can be any executable file, such as binaries in /usr/bin, but only shared-libraries in /usr/lib will be included in the return.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setup()

void libraries::setup ( const shared::set & libraries,
const std::string_view & application,
const std::filesystem::path & app_sof )

Setup an SOF directory.

Parameters
librariesThe libraries to copy into the SOF
sofThe path to the SOF directory
applicationThe name of the app.
commandThe command vector to append the needed bwrap args to link to the SOF.

◆ symlink()

void libraries::symlink ( shared::vector & command)

Add symlink commands.

Parameters
commandThe command to append to
applicationThe running application.
Note
This function symlinks /lib /lib64 and /usr/lib64 to /usr/lib, where the SOF is mounted
+ Here is the call graph for this function:
+ Here is the caller graph for this function: