exe: add freebsd image_path implementation
This commit is contained in:
parent
7cc4173dea
commit
5c2952561b
27
exe.cpp
27
exe.cpp
@ -53,6 +53,33 @@ retry:
|
||||
return boost::filesystem::path (resolved.data (), resolved.data () + written);
|
||||
}
|
||||
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
|
||||
#include "types.hpp"
|
||||
#include "except.hpp"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
boost::filesystem::path
|
||||
util::image_path (void)
|
||||
{
|
||||
int name[] = {
|
||||
CTL_KERN,
|
||||
KERN_PROC,
|
||||
KERN_PROC_PATHNAME,
|
||||
-1
|
||||
};
|
||||
|
||||
char data[1024];
|
||||
size_t len = sizeof (data);
|
||||
|
||||
auto err = sysctl (name, elems (name), data, &len, nullptr, 0);
|
||||
errno_error::try_code (err);
|
||||
|
||||
return boost::filesystem::path (std::cbegin (data), std::cbegin (data) + len);
|
||||
}
|
||||
|
||||
#elif defined(PLATFORM_WIN32)
|
||||
|
||||
#include "except.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user