We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

libvpoll: create synthetic events for poll, select and friends

Formal Metadata

Title
libvpoll: create synthetic events for poll, select and friends
Title of Series
Number of Parts
779
Author
License
CC Attribution 2.0 Belgium:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Many programs use poll/select system calls to wait for events that are triggered by file descriptor I/O events. For instance, to write a library able to behave like a network stack (e.g. lwip and picoTCP) or a device, it's possible to implement functions like my_socket, my_accept, my_open and my_ioctl, as drop-in replacement of the system call counterparts. Additionally, it's possible to use dynamic library magic to rename/divert the system call requests to use their virtual implementation provided by the library. Unfortunately this approach cannot be applied to poll/select system calls because Linux doesn't have a system call that permits to generate synthetic generic events for a file descriptor, so it is not possible for libraries to provide file descriptors suitable for select/poll system calls. libvpoll permits to define file descriptors whose I/O events can be generated at user level. This permits to generate synthetic events for poll, select, ppoll, pselect, epoll, etc. The libvpoll library can use two different supports: a module that provides a virtual device and a kernel patch extending the eventfd system call. When neither are availables, a feature-limited emulation is provided as a fallback: based on pipe it manages only POLLIN and POLLOUT. This approach allows mixing real file descriptors with others provided by libraries as parameters of poll/select system calls. For example libvpoll has been used in picoxnet, a user-level network stack implemented as a library for the Internet of Threads. libvpoll, as well as the kernel device module, are already available in Debian.