I have a small command-line application written in C that acts as a wrapper/launcher for other programs (think: xargs). The application is written to compile on FreeBSD/Linux (via fork()/exec()) and Windows (CreateProcess()). In addition to being able to intercept, inject, or otherwise manipulate the command-line arguments for the child application, I was wondering if there is an easy way to intercept the child program's filesystem activity (or it's children, and so forth). I'm mainly interested in just the filenames accessed for either read or write, but not the contents of said files, and would like the interception to be as lightweight as possible.
In googling some relevant keywords from above, it seems there are many ways to do this in Win32. From file system filter drivers to tampering with PE import table headers. None of these seem trivial or something I could self-contain within my wrapper program's executable (e.g. most would require extra DLLs or driver files alongside the main executable.) Also, I'd like this to work on Windows XP through 7, if possible, without having to hack around UAC or other platform deltas. It's my child process, so I figure I should be able to securely monitor its activity :)
On Linux, there is inotify(), but it monitors general filesystem access without regard to ONLY my child process/es. Same thing goes for FreeBSD's kqueue(). These also break down in SMP cases where multiple instances of the wrapper might be running different programs, and each needs to disambiguate their own child's filesystem activity from one another.
I'd certainly appreciate any suggestions that the SO community might have to offer.