tags:

views:

42

answers:

3

I'm writing a program to be run from the Linux user space which spawns another process. How can it determine which files were modified by the spawned process after it completes?

A: 

Inject your own replacement for fopen(3) that records the names and modes.

Ignacio Vazquez-Abrams
I think the proper jargon here is "library interposition". It's not a bad idea but doesn't seem to work for some reason on the program that I'm trying to monitor (g++). I'm only seeing accesses to files in /tmp.
balor123
+2  A: 

Call it under strace and parse the output you care about.

Roger Pate
Didn't know about this program - thanks for the hint! Shows a lot more than wrapping fopen() but still doesn't catch writes from g++.
balor123
@balor: What are you doing with g++ that you don't know what files it writes? Normally it only modifies a single file and you can give the name on the command line.
Roger Pate
A: 

Maybe g++ itself spawns other processes? Than "strace -fF -efile program" plus some filtering will probably help you.

fungusakafungus