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:
Paul Gardner-Stephen 2012-09-06 07:52:22 +09:30
parent 0891a7429f
commit 3fd262c6f8

12
log.c
View File

@ -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)