Skip to content

Commit

Permalink
report: disambiguate glibc versions
Browse files Browse the repository at this point in the history
- Give the glibc version entries more specific names.
- Group all of the glibc version reporting together.

PR-URL: #25781
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig committed Jan 31, 2019
1 parent 973c223 commit 5d4b085
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ is provided below for reference.
"child"
],
"nodejsVersion": "v12.0.0-pre",
"glibcVersion": "2.17",
"glibcVersionRuntime": "2.17",
"glibcVersionCompiler": "2.17",
"wordSize": "64 bit",
"componentVersions": {
"node": "12.0.0-pre",
Expand All @@ -55,7 +56,6 @@ is provided below for reference.
"release": "node"
},
"osVersion": "Linux 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018",
"glibc": "2.17",
"machine": "Linux 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018test_machine x86_64"
},
"javascriptStack": {
Expand Down
20 changes: 12 additions & 8 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,22 @@ static void PrintVersionInformation(JSONWriter* writer) {
buf << "v" << NODE_VERSION_STRING;
writer->json_keyvalue("nodejsVersion", buf.str());
buf.str("");

#ifndef _WIN32
// Report compiler and runtime glibc versions where possible.
const char* (*libc_version)();
*(reinterpret_cast<void**>(&libc_version)) =
dlsym(RTLD_DEFAULT, "gnu_get_libc_version");
if (libc_version != nullptr)
writer->json_keyvalue("glibcVersionRuntime", (*libc_version)());
#endif /* _WIN32 */

#ifdef __GLIBC__
buf << __GLIBC__ << "." << __GLIBC_MINOR__;
writer->json_keyvalue("glibcVersion", buf.str());
writer->json_keyvalue("glibcVersionCompiler", buf.str());
buf.str("");
#endif

// Report Process word size
writer->json_keyvalue("wordSize", sizeof(void*) * 8);

Expand Down Expand Up @@ -433,13 +444,6 @@ static void PrintVersionInformation(JSONWriter* writer) {
buf.str("");
buf << os_info.nodename << " " << os_info.machine;
writer->json_keyvalue("machine", buf.str());

const char* (*libc_version)();
*(reinterpret_cast<void**>(&libc_version)) =
dlsym(RTLD_DEFAULT, "gnu_get_libc_version");
if (libc_version != nullptr) {
writer->json_keyvalue("glibc", (*libc_version)());
}
}
#endif
}
Expand Down

0 comments on commit 5d4b085

Please sign in to comment.