Linux 使用 LD_PRELOAD 指定多个文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8474363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Specifying multiple files with LD_PRELOAD
提问by MetallicPriest
I know how to override one library with LD_PRELOAD, for example, as follows.
例如,我知道如何使用 LD_PRELOAD 覆盖一个库,如下所示。
LD_PRELOAD=./getpid.so ./testpid
Now my question is how to override multiple files. Say I want to override both getpid and getid, how would I specify that?
现在我的问题是如何覆盖多个文件。假设我想覆盖 getpid 和 getid,我该如何指定?
回答by codaddict
One option is to have the overridden version of both getpid
and getid
in a single .so
which you give to LD_PRELOAD
.
一种选择是将两者的覆盖版本放在一个单独的版本中,getpid
并提供给.getid
.so
LD_PRELOAD