Code Monkey home page Code Monkey logo

Comments (6)

not-jan avatar not-jan commented on May 20, 2024 1

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.

rusty-snake avatar rusty-snake commented on May 20, 2024

Note: io_safety for ScmpFd.

from libseccomp-rs.

rusty-snake avatar rusty-snake commented on May 20, 2024

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.

ManaSugi avatar ManaSugi commented on May 20, 2024

The correct type for ScmpFd would be BorrowedFd<'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.

rusty-snake avatar rusty-snake commented on May 20, 2024

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.

ManaSugi avatar ManaSugi commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.