summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Taeleman <ktaeleman@mozilla.com>2020-05-28 22:40:26 +0200
committerKris Taeleman <ktaeleman@mozilla.com>2020-05-28 22:40:26 +0200
commit1c5a11ff8193e5f25d3bec8bbfda0055d99989e2 (patch)
treefcb99cf98bf380605a306a77aa1fc1aba1ecda15
parentfd4b8f570c9844104fdd69eaf6797e2be3b0dc44 (diff)
downloadnspr-hg-1c5a11ff8193e5f25d3bec8bbfda0055d99989e2.tar.gz
Bug 1641677 - Add PR_SI_RELEASE_BUILD to PR_GetSystemInfo. r=kaie
-rw-r--r--pr/include/prsystem.h3
-rw-r--r--pr/src/md/unix/unix.c6
-rw-r--r--pr/src/md/windows/ntmisc.c24
-rw-r--r--pr/src/misc/prsystem.c13
4 files changed, 41 insertions, 5 deletions
diff --git a/pr/include/prsystem.h b/pr/include/prsystem.h
index 1b9c7ed8..577e60e0 100644
--- a/pr/include/prsystem.h
+++ b/pr/include/prsystem.h
@@ -43,8 +43,9 @@ typedef enum {
PR_SI_SYSNAME,
PR_SI_RELEASE,
PR_SI_ARCHITECTURE,
- PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured
+ PR_SI_HOSTNAME_UNTRUNCATED, /* the hostname exactly as configured
* on the system */
+ PR_SI_RELEASE_BUILD
} PRSysInfo;
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index a8862a4c..56b58aa7 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -3481,7 +3481,8 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen)
{
struct utsname info;
- PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE));
+ PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) ||
+ (cmd == PR_SI_RELEASE_BUILD));
if (uname(&info) == -1) {
_PR_MD_MAP_DEFAULT_ERROR(errno);
@@ -3493,6 +3494,9 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen)
else if (PR_SI_RELEASE == cmd) {
(void)PR_snprintf(name, namelen, info.release);
}
+ else if (PR_SI_RELEASE_BUILD == cmd) {
+ (void)PR_snprintf(name, namelen, info.version);
+ }
else {
return PR_FAILURE;
}
diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c
index 1ec6c2a5..839e3de8 100644
--- a/pr/src/md/windows/ntmisc.c
+++ b/pr/src/md/windows/ntmisc.c
@@ -812,7 +812,8 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
{
OSVERSIONINFO osvi;
- PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE));
+ PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) ||
+ (cmd == PR_SI_RELEASE_BUILD));
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -827,9 +828,13 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
if (PR_SI_SYSNAME == cmd) {
(void)PR_snprintf(name, namelen, "Windows_NT");
}
- else if (PR_SI_RELEASE == cmd)
+ else if (PR_SI_RELEASE == cmd) {
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
osvi.dwMinorVersion);
+ }
+ else if (PR_SI_RELEASE_BUILD == cmd) {
+ (void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber);
+ }
break;
case VER_PLATFORM_WIN32_WINDOWS:
if (PR_SI_SYSNAME == cmd) {
@@ -843,6 +848,8 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
} else if (PR_SI_RELEASE == cmd) {
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
osvi.dwMinorVersion);
+ } else if (PR_SI_RELEASE_BUILD == cmd) {
+ (void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber);
}
break;
#ifdef VER_PLATFORM_WIN32_CE
@@ -850,9 +857,15 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
if (PR_SI_SYSNAME == cmd) {
(void)PR_snprintf(name, namelen, "Windows_CE");
}
- else if (PR_SI_RELEASE == cmd)
+ else if (PR_SI_RELEASE == cmd) {
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
osvi.dwMinorVersion);
+ }
+ else if (PR_SI_RELEASE_BUILD == cmd) {
+ if (namelen) {
+ *name = 0;
+ }
+ }
break;
#endif
default:
@@ -862,6 +875,11 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
else if (PR_SI_RELEASE == cmd) {
(void)PR_snprintf(name, namelen, "%d.%d",0,0);
}
+ else if (PR_SI_RELEASE_BUILD == cmd) {
+ if (namelen) {
+ *name = 0;
+ }
+ }
break;
}
return PR_SUCCESS;
diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c
index 825d3be0..109f1ed2 100644
--- a/pr/src/misc/prsystem.c
+++ b/pr/src/misc/prsystem.c
@@ -152,6 +152,19 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle
#endif /* OS2 */
break;
+ case PR_SI_RELEASE_BUILD:
+ /* Return the version of the operating system */
+#if defined(XP_UNIX) || defined(WIN32)
+ if (PR_FAILURE == _PR_MD_GETSYSINFO(cmd, buf, (PRUintn)buflen)) {
+ return PR_FAILURE;
+ }
+#else
+ if (buflen) {
+ *buf = 0;
+ }
+#endif /* XP_UNIX || WIN32 */
+ break;
+
case PR_SI_ARCHITECTURE:
/* Return the architecture of the machine (ie. x86, mips, alpha, ...)*/
(void)PR_snprintf(buf, buflen, _PR_SI_ARCHITECTURE);