Detect if running under Rosetta

This commit is contained in:
Jonas Kvinge
2023-03-07 23:04:00 +01:00
parent 7f76c3f2ce
commit ea8e5180ff
3 changed files with 16 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ namespace Utilities {
qint32 GetMacOsVersion();
void IncreaseFDLimit();
bool ProcessTranslated();
} // namespace Utilities

View File

@@ -59,4 +59,16 @@ void IncreaseFDLimit() {
}
bool ProcessTranslated() {
int value = 0;
size_t value_size = sizeof(value);
if (sysctlbyname("sysctl.proc_translated", &value, &value_size, nullptr, 0) != 0) {
return false;
}
return value == 1;
}
} // namespace Utilities