Cross platform file-access tracking,
I’d like to be able to track file read/writes of specific program invocations. No information about the actual transactions is required, just the file names involved.
Is there a cross platform solution to this?
What are various platform specific methods?
On Linux I know there’s strace/ptrace (if there are faster methods that’d be good too).
I think on mac os there’s ktrace.
What about Windows?
Also, it would be amazing if it would be possible to block (stall out) file accesses until some later time.
The short answer is no. There are plenty of platform specific solutions which all probably have similar interfaces, but they aren’t inherently cross platform since file systems tend to be platform specific.
How do I do it well on each platform?
Again, it will depend on the platform 🙂 For Windows, if you want to track reads/writes in flight, you might have to go with IFS. If you just want to get notified of changes, you can use
ReadDirectoryChangesW or the NTFS change journal.
I’d recommend using the NTFS change journal only because it tends to be more reliable.
That’s the answer Cross platform file-access tracking, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.
The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you