Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

iopause(3) [debian man page]

iopause(3)						     Library Functions Manual							iopause(3)

NAME
iopause - check for file descriptor readability or writability SYNTAX
#include <iopause.h> int iopause(iopause_fd** x,unsigned int len, struct taia deadline,struct taia stamp); DESCRIPTION
iopause checks for file descriptor readability or writability as specified by x[0].fd, x[0].events, x[1].fd, x[1].events, ..., x[len-1].fd, x[len-1].events. If x[i].events includes the bit IOPAUSE_READ, iopause checks for readability of the descriptor x[i].fd; if x[i].events includes the bit IOPAUSE_WRITE, iopause checks for writability of the descriptor x[i].fd; other bits in x[i].events have undefined effects. iopause sets the IOPAUSE_READ bit in x[i].revents if it finds that x[i].fd is readable, and it sets the IOPAUSE_WRITE bit in x[i].revents if it finds that x[i].fd is writable. Beware that readability and writability may be destroyed at any moment by other processes with access to the same ofile that x[i].fd refers to. If there is no readability or writability to report, iopause waits until deadline for something to happen. iopause will return before dead- line if a descriptor becomes readable or writable, or an interrupting signal arrives, or some system-defined amount of time passes. iopause sets revents in any case. You must put a current timestamp into stamp before calling iopause. IMPLEMENTATION NOTES
The current implementation of iopause uses the poll function if that is available. On some systems, poll needs to dynamically allocate ker- nel memory; when not much memory is available, iopause will return immediately, and will report (often incorrectly) that no descriptors are readable or writable. This is a kernel bug, and I encourage vendors to fix it. If poll is not available, iopause uses the select function. This function cannot see descriptor numbers past a system-defined limit, typi- cally 256 or 1024; iopause will artificially pretend that those descriptors are never readable or writable. Future implementations of iopause may work around these problems on some systems, at the expense of chewing up all available CPU time. Both poll and select use relative timeouts rather than absolute deadlines. Some kernels round the timeout down to a multiple of 10 mil- liseconds; this can burn quite a bit of CPU time as the deadline approaches. iopause compensates for this by adding 20 milliseconds to the timeout. SEE ALSO
select(2), poll(3), taia_now(3) iopause(3)

Check Out this Related Man Page

POLL(2) 						     Linux Programmer's Manual							   POLL(2)

NAME
poll - wait for some event on a file descriptor SYNOPSIS
#include <sys/poll.h> int poll(struct pollfd *ufds, unsigned int nfds, int timeout); DESCRIPTION
poll is a variation on the theme of select. It specifies an array of nfds structures of type struct pollfd { int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; and a timeout in milliseconds. A negative value means infinite timeout. The field fd contains a file descriptor for an open file. The field events is an input parameter, a bitmask specifying the events the application is interested in. The field revents is an output parameter, filled by the kernel with the events that actually occurred, either of the type requested, or of one of the types POLLERR or POLLHUP or POLLNVAL. (These three bits are meaningless in the events field, and will be set in the revents field whenever the correspond- ing condition is true.) If none of the events requested (and no error) has occurred for any of the file descriptors, the kernel waits for timeout milliseconds for one of these events to occur. The following possible bits in these masks are defined in <sys/poll.h> #define POLLIN 0x0001 /* There is data to read */ #define POLLPRI 0x0002 /* There is urgent data to read */ #define POLLOUT 0x0004 /* Writing now will not block */ #define POLLERR 0x0008 /* Error condition */ #define POLLHUP 0x0010 /* Hung up */ #define POLLNVAL 0x0020 /* Invalid request: fd not open */ In <asm/poll.h> also the values POLLRDNORM, POLLRDBAND, POLLWRNORM, POLLWRBAND and POLLMSG are defined. RETURN VALUE
On success, a positive number is returned, where the number returned is the number of structures which have non-zero revents fields (in other words, those descriptors with events or errors reported). A value of 0 indicates that the call timed out and no file descriptors have been selected. On error, -1 is returned, and errno is set appropriately. ERRORS
EBADF An invalid file descriptor was given in one of the sets. ENOMEM There was no space to allocate file descriptor tables. EFAULT The array given as argument was not contained in the calling program's address space. EINTR A signal occurred before any requested event. CONFORMING TO
XPG4-UNIX. AVAILABILITY
The poll() systemcall was introduced in Linux 2.1.23. The poll() library call was introduced in libc 5.4.28 (and provides emulation using select if your kernel does not have a poll syscall). SEE ALSO
select(2), select_tut(2) Linux 2.1.23 1997-12-07 POLL(2)
Man Page