-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ideas for a higher level notification API #181
Comments
Note: io_safety for |
The correct type for |
It means that for safety you want to prevent users from accidentally closing the fd, isn't it? |
It we use |
Okay, is it necessary for us to make the lifetime |
Hi, I've been working on a similar functionality and since I'm depending on tokio I've published it as an external crate: https://github.com/not-jan/seccomp-stream Maybe you can take some inspiration / ideas from my implementation. I ended up implementing a non-blocking version as opposed to the normal blocking version by utilizing If epoll signals that the fd is readable it guarantees that the ioctl won't block. This way you can also react to the fd closing because epoll will send a Most of the actual epoll implementation is hidden within tokio / mio so it might not be super easy to extract this. |
Discussed in #163
Originally posted by rusty-snake June 5, 2022
This are my experiments for a saner unotify API.
The API will be build around the notify-fd. Currently you pass the fd as an integer to the receive/response function. This has little type safety and is a bit odd because you can only have one notify fd.
You then use receive/response methods on this type:
The response type is an enum instead of an struct with logical invariants:
The request type looks close to the current one but the types of the fields are structs. This allows more type-safety and to implement helper methods.
As a second step the usual "receive, take action and decide, send response"-loop can be abstracted too:
ScmpNotifCookie
type #152The text was updated successfully, but these errors were encountered: