Skip to content

Return std::io::Results from the low level APi and restructure the high level API to take bitflags for the fanotify mark mode, fanotify init flags, and the fd flags for the returned fanotify fd.#16

Open
pantsman0 wants to merge 2 commits into
masterfrom
libc_eagain

Conversation

@pantsman0
Copy link
Copy Markdown
Collaborator

This started as a debugging session where I was getting errors that were not getting handled properly (os error 13 on fanotify_read) which made me realise the libc::read error handling was completely incorrect.

This fixes that error handling, as well as wrapping some of the low level constants into bitflags in the high level API. Theoretically, it should now only be possible to call the high level functions with valid bits in the parameters.

The new structs and functions need docs, but I wanted to get the API here for review @Percivalll .

…high level API to take bitflags for the fanotify mark mode, fanotify init flags, and the fd flags for the returned fanotify fd.
@Percivalll
Copy link
Copy Markdown
Owner

@pantsman0 Thanks for your work! This looks great overall, but since there are quite a few changes, I'll need some more time to review it thoroughly.

@pantsman0
Copy link
Copy Markdown
Collaborator Author

Yeah, no worries at all. I was debugging an issue where fanotify seems to break in weird ways when used on an nfsv4 mount with kerberos auth, and I figured I needed to get a patch in. The handling of extra flags was a bonus due to #12, and the nix crate doesn't support additional records so getting them in here is great.

Just some notes. I made the high-level API a feature purely so that I could make the bitfields dependency optional and consumers can opt out. Additionally, the extra records are using Vecs in Vecs - would you prefer if I started using something like the slice_dst so we can just have a Vec of Boxed DSTs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants