Comments (6)
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 epoll
.
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 EPOLLHUP
event.
Most of the actual epoll implementation is hidden within tokio / mio so it might not be super easy to extract this.
from libseccomp-rs.
Note: io_safety for ScmpFd
.
from libseccomp-rs.
The correct type for ScmpFd
would be BorrowedFd<'static>
I think. Even if 'static
is wrong, it is a BorrowedFd with a long lifetime.
from libseccomp-rs.
The correct type for
ScmpFd
would beBorrowedFd<'static>
I think. Even if'static
is wrong, it is a BorrowedFd with a long lifetime.
It means that for safety you want to prevent users from accidentally closing the fd, isn't it?
from libseccomp-rs.
It we use OwnedFd
it will be closed when OwnedFd
gets dropped. Which would be the wrong think for a shared FD.
from libseccomp-rs.
Okay, is it necessary for us to make the lifetime 'static
?
I think there seems to be no problem even if the lifetime is same as struct Rotify
.
from libseccomp-rs.
Related Issues (20)
- Add safety notes regarding "external memory safety"
- Add new syscalls for the libseccomp v2.5.4 HOT 1
- Rust 2021 edition HOT 1
- Builder like interface for ScmpFilterContext HOT 6
- CI Warnings and use of actions-rs actions HOT 5
- Incorrect `socket` arg comparison example HOT 1
- Update bitflags dependency
- -
- Reconsider SeccompErrno design for `ScmpFilterAttr::ApiSysRawRc` HOT 1
- Rename some functions HOT 2
- RFC: Drop libseccomp < 2.5.0 support HOT 2
- Const syscall names for new arches in 0.4.0
- Update CHANGELOG for new syscalls
- Add a31a53d063d54b57428bc292e25a40d981d60537 to CHANGELOG.md
- Cherry-pick suggestion for release/v0.3.v branch HOT 1
- Build only fails at linker stage if libsseccomp is missing HOT 2
- [Release] Prepare for v0.3.1 HOT 1
- [Bug] Test failure on several arches
- [Bug] Test failure on several arches HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libseccomp-rs.