Elektrine lite

← Feed

@hackworks@hachyderm.io

Post #2791892

2023-01-21 00:39 UTC

Is there an idiomatic way on #linux for a shared library to find out the executable name of the process in which the library is currently loaded (without depending on proc file system)? Note: I am using LD_PRELOAD and the library should do something different for certain executables.

Replies (1)

  • @hackworks@hachyderm.io 2023-01-21 00:41

    I could link the executable with ‘-rdynamic’ and use dlsym to check for well known symbol. This will increase binary size with all symbols exported and I need to build from source.

    Open ##3107053