Comment by quibono

Comment by quibono a day ago

1 reply

I'm assuming epoll is covered implicitly by the section on kqueue. Are there any differences between the two besides the name?

toast0 a day ago

epoll returns a single value for events, and kqueue returns a struct.

   typedef union epoll_data {
       void    *ptr;
       int      fd;
       uint32_t u32;
       uint64_t u64;
   } epoll_data_t;
vs

   struct kevent {
       uintptr_t  ident;       /* identifier for this event */
       short  filter;       /* filter for event */
       u_short  flags;        /* action flags for kqueue */
       u_int  fflags;       /* filter flag value */
       int64_t  data;        /* filter data value */
       void  *udata;       /* opaque user data identifier */
       uint64_t  ext[4];       /* extensions */
   };
For read/write events, ident is the FD and data is the number of bytes that can be read or written.