拦截STAT() [英] Intercepting stat()

查看:144
本文介绍了拦截STAT()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我successfuly截获通话<$c$c>read(),<$c$c>write(),<$c$c>open(),<$c$c>unlink(),<$c$c>rename(), 科瑞(),但不知何故有同样的语义拦截 STAT()未发生。我一直在使用LD_ preLOAD改变执行environmnet。

我缺少的东西吗?

在code是相当庞大,其中的一部分将是最有帮助的张贴,所以你能帮忙吗?

感谢。

编辑:我不停的插STAT()包装简单,检查是否正常工作

 内部统计(为const char *路径,结构统计* BUFF)
{
    的printf(客户端调用:统计%的,路径);
    返回1;
}


解决方案

编译调用一个函数 STAT();看什么引用(S)生成(纳米-g stat.o )。然后,您可以使用的功能(S)的一个更好的主意干预。提示:它可能不叫 STAT()

I have successfuly intercepted calls to read(),write(),open(),unlink(),rename(), creat() but somehow with exactly the same semantics intercepting stat() is not taking place. I have changed the execution environmnet using LD_PRELOAD.

Am I missing something?

The code is quite huge, which part of it will be most helpful to post so you can help?

Thanks.

Edit: I kept the interposed stat() wrapper simple to check if it works.

int stat(const char *path,struct stat *buff)
{
    printf("client invoke: stat %s",path);
    return 1;
}

解决方案

Compile a function that calls stat(); see what reference(s) are generated (nm -g stat.o). Then you'll have a better idea of which function(s) to interpose. Hint: it probably isn't called stat().

这篇关于拦截STAT()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆