mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-12 21:33:03 +00:00
Add Solaris method for getting executable path & make the compiler
bail out if there is no method available rather than waiting until runtime.
This commit is contained in:
parent
0891a7429f
commit
3fd262c6f8
12
log.c
12
log.c
@ -386,16 +386,16 @@ ssize_t read_symlink(const char *path, char *buf, size_t len)
|
||||
|
||||
ssize_t get_self_executable_path(char *buf, size_t len)
|
||||
{
|
||||
#ifdef linux
|
||||
#if defined(linux)
|
||||
return read_symlink("/proc/self/exe", buf, len);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
// Mac OS X
|
||||
// TODO: Not tested
|
||||
#elif defined (__sun__)
|
||||
return read_symlink("/proc/self/path/a.out", buf, len);
|
||||
#elif defined (__APPLE__)
|
||||
uint32_t bufsize = len;
|
||||
return _NSGetExecutablePath(buf, &bufsize) == -1 && len ? -1 : bufsize;
|
||||
#else
|
||||
#error Unable to find executable path
|
||||
#endif
|
||||
return WHYF("Not implemented");
|
||||
}
|
||||
|
||||
int log_backtrace(struct __sourceloc where)
|
||||
|
Loading…
x
Reference in New Issue
Block a user