File/Calls substitution like LD_PRELOAD
Does there is usual utility which makes a substitution on some calls like execve and open? Like LD_PRELOAD for calls.
usual solution is the next:
$: mv /usr/bin/prog_b /usr/bin/prog_B.new $: ln -s /usr/bin/prog_b.old /usr/bin/prog_b $: ./prog_a # now run
but sometimes it's uncomfortably and dirty solution. In some stories the correct way to do so:
$: util "execve+open+stat:/usr/bin/prog_b=/usr/bin/prog_b.old" ./prog_a
where execve,open & stat are system calls. What is the name of this util?
I just write a special FILE_PRELOAD utility to solve my problem.
$: FILE_PRELOAD -C "execve+open+stat:/usr/bin/prog_b:/usr/bin/prog_b.old" ./prog_a
it generates c++ code, then compiles it and then LD_PRELOAD the result lib.so file before run ./prog_a.
Using it you can hook the next calls:
Please, run docs/tut.sh firstly (it's a tutorial for FP utility).