mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
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>
This commit is contained in:
parent
bb6d3fb354
commit
ff5cd9accb
@ -14,6 +14,8 @@ BEGIN {
|
|||||||
printf("\n")
|
printf("\n")
|
||||||
|
|
||||||
vernum = "[0-9]+([.]?[0-9]+)+"
|
vernum = "[0-9]+([.]?[0-9]+)+"
|
||||||
|
libc = "libc[.]so[.][0-9]+$"
|
||||||
|
libcpp = "(libg|stdc)[+]+[.]so[.][0-9]+$"
|
||||||
|
|
||||||
printversion("GNU C", version("gcc -dumpversion"))
|
printversion("GNU C", version("gcc -dumpversion"))
|
||||||
printversion("GNU Make", version("make --version"))
|
printversion("GNU Make", version("make --version"))
|
||||||
@ -35,26 +37,14 @@ BEGIN {
|
|||||||
printversion("Bison", version("bison --version"))
|
printversion("Bison", version("bison --version"))
|
||||||
printversion("Flex", version("flex --version"))
|
printversion("Flex", version("flex --version"))
|
||||||
|
|
||||||
while (getline <"/proc/self/maps" > 0) {
|
while ("ldconfig -p 2>/dev/null" | getline > 0) {
|
||||||
if (/libc.*\.so$/) {
|
if ($NF ~ libc && !seen[ver = version("readlink " $NF)]++)
|
||||||
n = split($0, procmaps, "/")
|
printversion("Linux C Library", ver)
|
||||||
if (match(procmaps[n], vernum)) {
|
else if ($NF ~ libcpp && !seen[ver = version("readlink " $NF)]++)
|
||||||
ver = substr(procmaps[n], RSTART, RLENGTH)
|
printversion("Linux C++ Library", ver)
|
||||||
printversion("Linux C Library", ver)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printversion("Dynamic linker (ldd)", version("ldd --version"))
|
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("Procps", version("ps --version"))
|
||||||
printversion("Net-tools", version("ifconfig --version"))
|
printversion("Net-tools", version("ifconfig --version"))
|
||||||
printversion("Kbd", version("loadkeys -V"))
|
printversion("Kbd", version("loadkeys -V"))
|
||||||
|
Loading…
Reference in New Issue
Block a user