When I run the following make
command in a build directory it's almost empty (file in question is absolutely certainly not there)
strace -f -e trace=execve,vfork,open,creat -s 1024 make <target>
After it finishes, the file is totally there. So it must have been created by make
or one of its child processes (or children of their children and so on).
However when I grep the strace
log for either the name of the file or for creat
I cannot find the system call responsible for creation of this file.
What am I missing? Are there other system calls I should be monitoring?
EDIT:
It turns out the mistake was in both my strace comamnd and my grepping. All the answers were helpful, thank you, everyone, for your time.
I actually failed to communicate that the file was in a subdir and I was grepping using the name of a file along with the subdir's name. But since strace does not provide info on current working directory this approach didn't work so well (I ended up stracing chdir
and rename
calls to get the desired effect).
So PaulHaldane's first suggestion was right and to the point. As well as larsks's answer in which he has actually guessed how the file got created.
-e trace=file
? That should pick up anything that acts on a file name. – Paul Haldane Aug 27 '16 at 10:15strace
. One of them:ln -s foo bar; strace -ologs touch bar; grep foo logs
. – Satō Katsura Aug 27 '16 at 10:33