Sha256: 6a74b1b038af2b53650eb59ab6476de015b5fef17e8a57b25832a0398aa74cb4
Contents?: true
Size: 1.01 KB
Versions: 16
Compression:
Stored size: 1.01 KB
Contents
#include <internal/facts/osx/dmi_resolver.hpp> #include <leatherman/logging/logging.hpp> #include <sys/sysctl.h> using namespace std; namespace facter { namespace facts { namespace osx { dmi_resolver::data dmi_resolver::collect_data(collection& facts) { data result; int mib[] = { CTL_HW, HW_MODEL }; size_t length = 0; // OSX only supports the product name if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), nullptr, &length, nullptr, 0) == -1) { LOG_DEBUG("sysctl failed: {1} ({2}): DMI facts are unavailable.", strerror(errno), errno); return result; } vector<char> model_name(length); if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), model_name.data(), &length, nullptr, 0) == -1) { LOG_DEBUG("sysctl failed: {1} ({2}): DMI facts are unavailable.", strerror(errno), errno); return result; } result.product_name = model_name.data(); return result; } }}} // namespace facter::facts::osx
Version data entries
16 entries across 16 versions & 2 rubygems