I am trying to map all the files created and opened by my program. To do this, I have implemented my own open()
function, which writes the filepath parameter to an output file and then calls the original open()
function.
Using LD_PRELOAD
, I am successfully hooking the proc file system open()
call, but not the direct open()
call in my code.
For example, this code is successfully hooked by LD_PRELOAD
:
system("echo text > /user/prog");
However, this code, which is located right next to it, is not hooked:
open("/user/prog", O_RDWR, O_CREAT);
What could be the reason for this?