summaryrefslogtreecommitdiff
path: root/scripts/ver_linux
diff options
context:
space:
mode:
authorAlexander Kapshuk <alexander.kapshuk@gmail.com>2020-02-09 17:00:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-11 00:35:15 +0300
commitff5cd9accbc724a793904c6e401040c85be89748 (patch)
tree31e4b06f076761f4208ee81eacb1775a40f009d2 /scripts/ver_linux
parentbb6d3fb354c5ee8d6bde2d576eb7220ea09862b9 (diff)
downloadlinux-ff5cd9accbc724a793904c6e401040c85be89748.tar.xz
ver_linux: Query ld cache for versions of libc/libcpp run-time
Query ld cache for versions of both libc and libcpp run-time, instead of querying /proc/self/maps for libc run-time, and ld cache for libcpp run-time, thus reducing code size and complexity. Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com> Link: https://lore.kernel.org/r/20200209140057.20181-1-alexander.kapshuk@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/ver_linux')
-rwxr-xr-xscripts/ver_linux24
1 files changed, 7 insertions, 17 deletions
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 85005d6b7f10..0968a3070eff 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -14,6 +14,8 @@ BEGIN {
printf("\n")
vernum = "[0-9]+([.]?[0-9]+)+"
+ libc = "libc[.]so[.][0-9]+$"
+ libcpp = "(libg|stdc)[+]+[.]so[.][0-9]+$"
printversion("GNU C", version("gcc -dumpversion"))
printversion("GNU Make", version("make --version"))
@@ -35,26 +37,14 @@ BEGIN {
printversion("Bison", version("bison --version"))
printversion("Flex", version("flex --version"))
- while (getline <"/proc/self/maps" > 0) {
- if (/libc.*\.so$/) {
- n = split($0, procmaps, "/")
- if (match(procmaps[n], vernum)) {
- ver = substr(procmaps[n], RSTART, RLENGTH)
- printversion("Linux C Library", ver)
- break
- }
- }
+ while ("ldconfig -p 2>/dev/null" | getline > 0) {
+ if ($NF ~ libc && !seen[ver = version("readlink " $NF)]++)
+ printversion("Linux C Library", ver)
+ else if ($NF ~ libcpp && !seen[ver = version("readlink " $NF)]++)
+ printversion("Linux C++ Library", ver)
}
printversion("Dynamic linker (ldd)", version("ldd --version"))
-
- while ("ldconfig -p 2>/dev/null" | getline > 0) {
- if (/(libg|stdc)[+]+\.so/) {
- libcpp = $NF
- break
- }
- }
- printversion("Linux C++ Library", version("readlink " libcpp))
printversion("Procps", version("ps --version"))
printversion("Net-tools", version("ifconfig --version"))
printversion("Kbd", version("loadkeys -V"))