• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Vibra
V2EX  ›  程序员

[求助]如何查看一个动态库被多少进程所使用

  •  
  •   Vibra · Apr 25, 2022 · 2847 views
    This topic created in 1657 days ago, the information mentioned may be changed or developed.

    公司部署业务, 因为 libc 库不匹配, 所以把这个库降级了, 要求查看会不会影响别的进程, 这个怎么看, 求大佬们赐教

    8 replies  •  2022-04-26 14:37:41 +08:00
    lovelylain
    lovelylain
    Apr 25, 2022 via Android
    1
    为什么不 docker
    yanqiyu
    yanqiyu
    Apr 25, 2022❤️1
    2
    libc 的话大概可以认为影响所有动态连接的程序
    Vibra
    Vibra
    OP
    Apr 25, 2022
    3
    @jobmailcn 因为影响的是 apt
    lesismal
    lesismal
    Apr 25, 2022❤️1
    4
    遍历下 /proc 下所有进程的 /pid/maps ,grep 每个进程的内存空间看看哪些打开了这个 so ,细节楼主自己完善下:

    find ./ -type d -maxdepth 1 | awk '{if(substr($0,3) ~ /^[0-9]+$/) print $0"/maps";}' | awk '{if(-f $0) print $0}'| xargs grep "your absolute path of .so" | awk '{split($0,a,"/"); print a[2]}' | uniq | awk '{if($0 ~/^[0-9]+$/) print "./"$0"/exe"}' | xargs ls -l | awk '{split($0,a," "); print a[11]}'
    hhhfhhf
    hhhfhhf
    Apr 25, 2022 via iPhone
    5
    ldd 挨个看看二进制的依赖?
    Brian1900
    Brian1900
    Apr 26, 2022
    6
    好问题
    hxndg
    hxndg
    Apr 26, 2022
    7
    我理解 libc 是对过去兼容的,怎么确定降级能解决问题?
    而且降级可太危险
    Kasumi20
    Kasumi20
    Apr 26, 2022
    8
    不匹配哪个程序,就把哪个程序静态编译一遍呗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1355 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 16:17 · PVG 00:17 · LAX 08:17 · JFK 11:17
    ♥ Do have faith in what you're doing.