gpakosz / whereami

Locate the current running executable and the current running module/library on the file system 🔎
MIT License
472 stars 64 forks source link

solaris fix #32

Open tkoecker opened 2 years ago

tkoecker commented 2 years ago

This patch fixes the Solaris support (tested on Solaris 10 and 11).

While the existing getExecutablePath() code works fine on Solaris the getModulePath() does not work. The code assumes that the /proc/self/map file on Solaris has the same syntax as the /proc/self/maps file on Linux. This is not the case, actually the /proc/self/map is even a binary file, see: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html The dladdr() based code that is already used for other platforms in whereami however works fine on Solaris too. I added another copy of it (there is already is more than one) - this maybe could be merged.