I started writing a program yesterday. I've now written about 870 lines of code. It's coming along. :-)
So far:
- It has code to access Linux's fanotify kernel facility, including a graceful shutdown mechanism that sends the polling thread SIGINT to interrupt its blocking read operation.
- It contains a (not yet well-tested) wrapper of the lsof utility, using its -F option to get machine-parseable output.
- It contains code to enumerate mount points using the setmntent/getmntent/endmntent API.
- It has the start of a wrapper of the ZFS utility, including a basic structure for scoped objects representing snapshots (so I can use 'using' on them and when they go out of scope, the snapshot is automatically removed).
- It has a STRATEGY document writing up (in English) the long-term strategy I'm working toward. The STRATEGY document isn't counted in the line count.
It builds without warnings with dotnet build and runs with dotnet run, successfully getting notifications of file accesses.
The source code is in GitHub.
Programming is good. Programming is life. :-)
Turns out the signal mechanism wasn't actually working. So now it uses a pipe to signal shutdown and poll to avoid uninterruptible blocking. 🙂
ReplyDelete[This comment was originally written on Facebook on May 6 at 8:40 PM.]