2

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?

dromodel
  • 9,581
  • 12
  • 47
  • 65

3 Answers3

3

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

Community
  • 1
  • 1
  • 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++. – dromodel Mar 12 '10 at 19:52
  • @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. –  Mar 12 '10 at 19:56
0

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

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • 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. – dromodel Mar 12 '10 at 19:50
0

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

fungusakafungus
  • 227
  • 1
  • 10