if [ "$(uname -s)" == "Darwin" ]; then
__rid_plat=osx.10.12
fi
+ if [ "$(uname -s)" == "FreeBSD" ]; then
+ major_ver=`uname -U | cut -b1-2`
+ __rid_plat=freebsd.$major_ver
+ fi
if [ $__linkPortable == 1 ]; then
if [ "$(uname -s)" == "Darwin" ]; then
__rid_plat="osx"
+ elif [ "$(uname -s)" == "FreeBSD" ]; then
+ __rid_plat="freebsd"
else
__rid_plat="linux"
fi
fi
+ echo __rid_plat=$__rid_plat
}
usage()
pal::string_t pal::get_current_os_rid_platform()
{
pal::string_t ridOS;
-
+
char str[256];
// There is no good way to get the visible version of OSX (i.e. something like 10.x.y) as
return ridOS;
}
+#elif defined(__FreeBSD__)
+// On FreeBSD get major verion. Minors should be compatible
+pal::string_t pal::get_current_os_rid_platform()
+{
+ pal::string_t ridOS;
+
+ char str[256];
+
+ size_t size = sizeof(str);
+ int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);
+ if (ret == 0)
+ {
+ char *pos = strchr(str,'.');
+ if (pos) {
+ *pos = '\0';
+ }
+ ridOS.append(_X("freebsd."));
+ ridOS.append(str);
+ }
+
+ return ridOS;
+}
#else
// For some distros, we don't want to use the full version from VERSION_ID. One example is
// Red Hat Enterprise Linux, which includes a minor version in their VERSION_ID but minor
if (error_code == ENOMEM)
{
size_t len = sysctl(mib, 4, NULL, NULL, NULL, 0);
- std::unique_ptr<char[]> buffer = new (std::nothrow) char[len];
+ std::unique_ptr<char[]> buffer (new (std::nothrow) char[len]);
if (buffer == NULL)
{
return false;
}
- error_code = sysctl(mib, 4, buffer, &len, NULL, 0);
+ error_code = sysctl(mib, 4, buffer.get(), &len, NULL, 0);
if (error_code == 0)
{
- recv->assign(buffer);
+ recv->assign(buffer.get());
return true;
}
}