Shared libraries

Shared libraries — Information about shared libraries

Functions

Properties

char * absolute-path Read / Write / Construct Only
GStrv dependencies Read / Write / Construct Only
int exit-status Read / Write / Construct Only
SrtLibraryIssues issues Read / Write / Construct Only
char * messages Read / Write / Construct Only
GStrv missing-symbols Read / Write / Construct Only
GStrv missing-versions Read / Write / Construct Only
GStrv misversioned-symbols Read / Write / Construct Only
char * multiarch-tuple Read / Write / Construct Only
char * real-soname Read / Write / Construct Only
char * requested-name Read / Write / Construct Only
char * soname Read / Write / Construct Only
int terminating-signal Read / Write / Construct Only

Types and Values

Object Hierarchy

    GEnum
    ╰── SrtLibrarySymbolsFormat
    GFlags
    ╰── SrtLibraryIssues
    GObject
    ╰── SrtLibrary

Includes

#include <steam-runtime-tools/steam-runtime-tools.h>

Description

SrtLibrary is an opaque object representing a shared library. This is a reference-counted object: use g_object_ref() and g_object_unref() to manage its lifecycle.

Functions

srt_library_get_requested_name ()

const char *
srt_library_get_requested_name (SrtLibrary *self);

Return the name that was requested to be loaded when checking self .

Parameters

self

a library

 

Returns

A string like libz.so.1, which is valid as long as self is not destroyed.

[type filename][transfer none]


srt_library_get_absolute_path ()

const char *
srt_library_get_absolute_path (SrtLibrary *self);

Return the absolute path of self .

Parameters

self

a library

 

Returns

A string like /usr/lib/libz.so.1, which is valid as long as self is not destroyed.

[type filename][transfer none]


srt_library_get_soname ()

const char *
srt_library_get_soname (SrtLibrary *self);

srt_library_get_soname is deprecated and should not be used in newly-written code.

Deprecated alias for srt_library_get_requested_name(). See also srt_library_get_real_soname(), which might be what you thought this did.

Parameters

self

a library

 

Returns

A string like libz.so.1, which is valid as long as self is not destroyed.

[type filename][transfer none]


srt_library_get_messages ()

const char *
srt_library_get_messages (SrtLibrary *self);

Return the diagnostic messages produced while checking this library, if any.

Parameters

self

a library object

 

Returns

A string, which must not be freed, or NULL if there were no diagnostic messages.

[nullable][transfer none][type utf8]


srt_library_get_multiarch_tuple ()

const char *
srt_library_get_multiarch_tuple (SrtLibrary *self);

Return the multiarch tuple representing the ABI of self .

Parameters

self

a library

 

Returns

A Debian-style multiarch tuple, usually SRT_ABI_I386 or SRT_ABI_X86_64


srt_library_get_issues ()

SrtLibraryIssues
srt_library_get_issues (SrtLibrary *self);

Return the problems found when loading self .

Parameters

self

a library

 

Returns

A bitfield containing problems, or SRT_LIBRARY_ISSUES_NONE if no problems were found


srt_library_get_missing_symbols ()

const char * const *
srt_library_get_missing_symbols (SrtLibrary *self);

Return the symbols that were expected to be provided by self but were not found.

Parameters

self

a library

 

Returns

The symbols that were missing from self , as a NULL-terminated array. The pointer remains valid until self is destroyed.

[array zero-terminated=1][element-type filename]


srt_library_get_misversioned_symbols ()

const char * const *
srt_library_get_misversioned_symbols (SrtLibrary *self);

Return the symbols that were expected to be provided by self but were available with a different version. Note that this list contains the symbol we expected, not the symbol we found. For example, if we expected to find the versioned symbol curl_getenv@CURL_OPENSSL_3 in libcurl.so.4 (as seen in Ubuntu 12.04 and the Steam Runtime), but we actually found either curl_getenv@CURL_OPENSSL_4 (as seen in Debian 10) or an unversioned curl_getenv, then this list would contain curl_getenv@CURL_OPENSSL_3

Parameters

self

a library

 

Returns

The symbols were available with a different version from self , as a NULL-terminated array. The pointer remains valid until self is destroyed.

[array zero-terminated=1][element-type filename]


srt_library_get_missing_versions ()

const char * const *
srt_library_get_missing_versions (SrtLibrary *self);

Return the version definitions that were expected to be provided by self but were not found. This array is non-empty if and only if the SRT_LIBRARY_ISSUES_MISSING_VERSIONS issue flag is set.

Parameters

self

a library

 

Returns

The versions that were missing from self , as a NULL-terminated array. The pointer remains valid until self is destroyed.

[array zero-terminated=1][element-type filename]


srt_library_get_dependencies ()

const char * const *
srt_library_get_dependencies (SrtLibrary *self);

Return the dependencies of self .

Parameters

self

a library

 

Returns

The dependencies of self , as a NULL-terminated array. The pointer remains valid until self is destroyed.

[array zero-terminated=1][element-type utf8]


srt_library_get_real_soname ()

const char *
srt_library_get_real_soname (SrtLibrary *self);

Return the ELF DT_SONAME found by parsing the loaded library. This is often the same as srt_library_get_requested_name(), but can differ when compatibility aliases are involved.

Parameters

self

a library

 

Returns

A string like libz.so.1, which is valid as long as self is not destroyed, or NULL if the SONAME could not be determined.

[type filename][transfer none]


srt_check_library_presence ()

SrtLibraryIssues
srt_check_library_presence (const char *requested_name,
                            const char *multiarch,
                            const char *symbols_path,
                            SrtLibrarySymbolsFormat symbols_format,
                            SrtLibrary **more_details_out);

Attempt to load requested_name into a helper subprocess, and check whether it conforms to the ABI provided in symbols_path.

If symbols_format is SRT_LIBRARY_SYMBOLS_FORMAT_PLAIN, symbols_path must list one symbol per line, in the format jpeg_input_complete@LIBJPEG_6.2 for versioned symbols or DGifOpen@Base (or just DGifOpen) for symbols not associated with a version.

If symbols_format is SRT_LIBRARY_SYMBOLS_FORMAT_DEB_SYMBOLS, symbols_path must be in deb-symbols(5) format. It may list symbols for more SONAMEs than just requested_name ; if so, they are ignored.

Parameters

requested_name

The SONAME or absolute or relative path of a shared library, for example libjpeg.so.62.

[type filename]

multiarch

A multiarch tuple like SRT_ABI_I386, representing an ABI.

 

symbols_path

The filename of a file listing symbols, or NULL if we do not know which symbols the library is meant to contain.

[nullable][type filename]

symbols_format

The format of symbols_path .

 

more_details_out

Used to return an SrtLibrary object representing the shared library provided by requested_name . Free with g_object_unref().

[out][optional][transfer full]

Returns

A bitfield containing problems, or SRT_LIBRARY_ISSUES_NONE if no problems were found.


srt_library_get_exit_status ()

int
srt_library_get_exit_status (SrtLibrary *self);

Return the exit status of helpers when testing the given library.

Parameters

self

a library

 

Returns

0 on success, positive on unsuccessful exit(), or -1 if killed by a signal or not run at all


srt_library_get_terminating_signal ()

int
srt_library_get_terminating_signal (SrtLibrary *self);

Return the terminating signal used to terminate the helper if any.

Parameters

self

a library

 

Returns

a signal number such as SIGTERM, or 0 if not killed by a signal or not run at all.

Types and Values

SRT_LIBRARY_ISSUES_INTERNAL_ERROR

#define SRT_LIBRARY_ISSUES_INTERNAL_ERROR SRT_LIBRARY_ISSUES_UNKNOWN

enum SrtLibraryIssues

A bitfield with flags representing problems with a library, or SRT_LIBRARY_ISSUES_NONE (which is numerically zero) if no problems were detected.

In general, more bits set means more problems.

Members

SRT_LIBRARY_ISSUES_CANNOT_LOAD

The library could not be loaded

 

SRT_LIBRARY_ISSUES_MISSING_SYMBOLS

Some of the expected symbols were not present

 

SRT_LIBRARY_ISSUES_MISVERSIONED_SYMBOLS

Some of the expected symbols were available with a different version

 

SRT_LIBRARY_ISSUES_UNKNOWN

A generic internal error occurred, or an unknown issue flag was encountered while reading a report

 

SRT_LIBRARY_ISSUES_UNKNOWN_EXPECTATIONS

No directory containing expected ABIs has been set, so we cannot know which libraries we are meant to have found

 

SRT_LIBRARY_ISSUES_TIMEOUT

Helper timed out when executing

 

SRT_LIBRARY_ISSUES_MISSING_VERSIONS

Some of the expected version definitions were not present

 

SRT_LIBRARY_ISSUES_UNVERSIONED

The library was expected to have at least one version definition, but has no version definitions at all. Implies SRT_LIBRARY_ISSUES_MISSING_VERSIONS.

 

SRT_LIBRARY_ISSUES_NONE

There are no problems

 

enum SrtLibrarySymbolsFormat

The format of a file listing expected symbols.

Members

SRT_LIBRARY_SYMBOLS_FORMAT_PLAIN

One symbol per line

 

SRT_LIBRARY_SYMBOLS_FORMAT_DEB_SYMBOLS

deb-symbols(5) format

 

Property Details

The “absolute-path” property

  “absolute-path”            char *

The absolute path of this library, for example /usr/lib/libz.so.1.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “dependencies” property

  “dependencies”             GStrv

Dependencies of this library.

Owner: SrtLibrary

Flags: Read / Write / Construct Only


The “exit-status” property

  “exit-status”              int

Exit status of helper(s) executed. 0 on success, positive on unsuccessful exit(), -1 if killed by a signal or not run at all.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Allowed values: >= -1

Default value: 0


The “issues” property

  “issues”                   SrtLibraryIssues

Problems with this library.

Owner: SrtLibrary

Flags: Read / Write / Construct Only


The “messages” property

  “messages”                 char *

Diagnostic messages produced while checking this library.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “missing-symbols” property

  “missing-symbols”          GStrv

Symbols that were expected to be in this library, but were found to be missing.

Owner: SrtLibrary

Flags: Read / Write / Construct Only


The “missing-versions” property

  “missing-versions”         GStrv

Versions that were expected to be in this library, but were found to be missing.

Owner: SrtLibrary

Flags: Read / Write / Construct Only


The “misversioned-symbols” property

  “misversioned-symbols”     GStrv

Symbols that were expected to be in this library, but were available with a different version.

Owner: SrtLibrary

Flags: Read / Write / Construct Only


The “multiarch-tuple” property

  “multiarch-tuple”          char *

Debian-style multiarch tuple representing the ABI of this library, usually i386-linux-gnu or x86_64-linux-gnu.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “real-soname” property

  “real-soname”              char *

ELF DT_SONAME found when loading the library.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “requested-name” property

  “requested-name”           char *

The name that was loaded, for example libz.so.1.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “soname” property

  “soname”                   char *

Deprecated alias for requested-name.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Default value: NULL


The “terminating-signal” property

  “terminating-signal”       int

Signal used to terminate helper process if any, 0 otherwise.

Owner: SrtLibrary

Flags: Read / Write / Construct Only

Allowed values: >= 0

Default value: 0