Giter Club home page Giter Club logo

Comments (2)

pwaller avatar pwaller commented on August 22, 2024

Additionally the poll types have a type of i32, but the fields on pollfd_t which use those bits are an i16, so you have to cast the constants unnecessarily currently:

/// These are specified by `iBCS2`
pub const POLLIN: i32 = 0x0001;
pub const POLLPRI: i32 = 0x0002;
pub const POLLOUT: i32 = 0x0004;
pub const POLLERR: i32 = 0x0008;
pub const POLLHUP: i32 = 0x0010;
pub const POLLNVAL: i32 = 0x0020;
/// The rest seem to be more-or-less nonstandard. Check them!
pub const POLLRDNORM: i32 = 0x0040;
pub const POLLRDBAND: i32 = 0x0080;
pub const POLLWRNORM: i32 = 0x0100;
pub const POLLWRBAND: i32 = 0x0200;
pub const POLLMSG: i32 = 0x0400;
pub const POLLREMOVE: i32 = 0x1000;
pub const POLLRDHUP: i32 = 0x2000;

from nc.

pwaller avatar pwaller commented on August 22, 2024

And the poll function returns a useful integer:

pub unsafe fn poll(fds: &mut [pollfd_t], timeout: i32) -> Result<(), Errno> {

Manpage:

Upon successful completion, poll() shall return a non-negative value. A positive value indicates the total number of pollfd structures that have selected events (that is, those for which the revents member is non-zero). A value of 0 indicates that the call timed out and no file descriptors have been selected.

from nc.

Related Issues (15)

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.