diff --git a/src/corelib/global/qsysinfo.cpp b/src/corelib/global/qsysinfo.cpp index 79cb76b2366..0ca04154e65 100644 --- a/src/corelib/global/qsysinfo.cpp +++ b/src/corelib/global/qsysinfo.cpp @@ -709,7 +709,8 @@ QString QSysInfo::kernelType() Returns the release version of the operating system kernel. On Windows, it returns the version of the NT kernel. On Unix systems, including Android and \macos, it returns the same as the \c{uname -r} - command would return. + command would return. On VxWorks, it returns the numeric part of the string + reported by kernelVersion(). If the version could not be determined, this function may return an empty string. @@ -724,8 +725,17 @@ QString QSysInfo::kernelVersion() osver.majorVersion(), osver.minorVersion(), osver.microVersion()); #else struct utsname u; - if (uname(&u) == 0) + if (uname(&u) == 0) { +# ifdef Q_OS_VXWORKS + // The string follows the pattern "Core Kernel version: w.x.y.z" + auto versionStr = QByteArrayView(u.kernelversion); + if (auto lastSpace = versionStr.lastIndexOf(' '); lastSpace != -1) { + return QString::fromLatin1(versionStr.sliced(lastSpace + 1)); + } +# else return QString::fromLatin1(u.release); +# endif + } return QString(); #endif } @@ -762,6 +772,8 @@ QString QSysInfo::kernelVersion() \b{Windows note}: this function return "windows" + \b{VxWorks note}: this function return "vxworks" + For other Unix-type systems, this function usually returns "unknown". \sa QFileSelector, kernelType(), kernelVersion(), productVersion(), prettyProductName() @@ -792,6 +804,8 @@ QString QSysInfo::productType() return QStringLiteral("darwin"); #elif defined(Q_OS_WASM) return QStringLiteral("wasm"); +#elif defined(Q_OS_VXWORKS) + return QStringLiteral("vxworks"); #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX QUnixOSVersion unixOsVersion; @@ -808,7 +822,7 @@ QString QSysInfo::productType() Returns the product version of the operating system in string form. If the version could not be determined, this function returns "unknown". - It will return the Android, iOS, \macos, Windows full-product + It will return the Android, iOS, \macos, VxWorks, Windows full-product versions on those systems. Typical returned values are (note: list not exhaustive): @@ -821,6 +835,7 @@ QString QSysInfo::productType() \li "8.6" (watchOS 8.6) \li "11" (Windows 11) \li "Server 2022" (Windows Server 2022) + \li "24.03" (VxWorks 7 - 24.03) \endlist On Linux systems, it will try to determine the distribution version and will @@ -849,6 +864,12 @@ QString QSysInfo::productVersion() } // fall through +#elif defined(Q_OS_VXWORKS) + utsname u; + if (uname(&u) == 0) + return QString::fromLatin1(u.releaseversion); + // fall through + #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX QUnixOSVersion unixOsVersion; findUnixOsVersion(unixOsVersion);