Skip to content
Browse files

Add build number to OS X OSInfo.

This change also removes the architecture
from the OSInfo string, since it is noisy.

The old code would always emit "i386", seemingly
since that's the "lowest" fatch arch that the current
OS X x86_64 kernels will run binaries from.

I tried to update the code, but instead of x86_64, I
got "x86_64h", which is Apple's arch string for
Haswell chips.

I don't think it makes sense anymore to have the
architecture string in the OSInfo on OS X. All
Macs running the modern OSes are x86_64 anyway.

Fixes #1341
  • Loading branch information...
mkrautz committed Apr 10, 2016
1 parent 48cc538 commit 72ef9026fa2cf28c54bafc4fc832f571c6c70800
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/OSInfo.cpp
@@ -127,15 +127,19 @@ QString OSInfo::getOSVersion() {
if (err != noErr)
return QString::number(QSysInfo::MacintoshVersion, 16);

const NXArchInfo *local = NXGetLocalArchInfo();
const NXArchInfo *ai = local ? NXGetArchInfoFromCpuType(local->cputype, CPU_SUBTYPE_MULTIPLE) : NULL;
const char *arch = ai ? ai->name : "unknown";
char *buildno = NULL;
char buildno_buf[32];
size_t sz_buildno_buf = sizeof(buildno);
int ret = sysctlbyname("kern.osversion", buildno_buf, &sz_buildno_buf, NULL, 0);
if (ret == 0) {
buildno = &buildno_buf[0];

os.sprintf("%lu.%lu.%lu (%s)",
os.sprintf("%lu.%lu.%lu %s",
static_cast<unsigned long>(major),
static_cast<unsigned long>(minor),
static_cast<unsigned long>(bugfix),
buildno ? buildno : "unknown");
#ifdef Q_OS_LINUX
QProcess qp;

0 comments on commit 72ef902

Please sign in to comment.
You can’t perform that action at this time.