I would like to develop a command line program that worked like so:
myprogram /c [some_executable_here]
Which launched the command specified by the user and "watched" the process (and any sub-processes) for read I/O and when that program exits, print a listing of files that were "read" (ultimately resulted in a read() system call).
My initial OS for implementation is Windows, but I'd like to do the same kind of thing on Linux as well.
All the FileSystem watch-like APIs I've seen so far are geared towards watching directories (or individual files) though, and not processes, so I'm not sure what the best way to go about this is.
EDIT: I'm looking for code examples of how to ultimately implement this (or at least pointers to APIs that I could follow) to do this on Windows and Linux.
Also to be clear, it can't use a method like OpendFilesView, procmon or grepping strings from some system-level tool that can't definitively identify the process by ID (and any sub-processes) from the beginning and end of its execution; IOW there can't be any timing issues involved and possibility of a false positive by searching for "foo.exe" and getting the wrong one.