1iopause(3) Library Functions Manual iopause(3)
2
3
4
6 iopause -
7
9 #include <iopause.h>
10
11 int iopause(iopause_fd** x,unsigned int len,
12 struct taia deadline,struct taia stamp);
13
15 iopause checks for file descriptor readability or writability as speci‐
16 fied by x[0].fd, x[0].events, x[1].fd, x[1].events, ..., x[len-1].fd,
17 x[len-1].events. If x[i].events includes the bit IOPAUSE_READ, iopause
18 checks for readability of the descriptor x[i].fd; if x[i].events
19 includes the bit IOPAUSE_WRITE, iopause checks for writability of the
20 descriptor x[i].fd; other bits in x[i].events have undefined effects.
21
22 iopause sets the IOPAUSE_READ bit in x[i].revents if it finds that
23 x[i].fd is readable, and it sets the IOPAUSE_WRITE bit in x[i].revents
24 if it finds that x[i].fd is writable. Beware that readability and
25 writability may be destroyed at any moment by other processes with
26 access to the same ofile that x[i].fd refers to.
27
28 If there is no readability or writability to report, iopause waits
29 until deadline for something to happen. iopause will return before
30 deadline if a descriptor becomes readable or writable, or an interrupt‐
31 ing signal arrives, or some system-defined amount of time passes.
32 iopause sets revents in any case.
33
34 You must put a current timestamp into stamp before calling iopause.
35
37 The current implementation of iopause uses the poll function if that is
38 available. On some systems, poll needs to dynamically allocate kernel
39 memory; when not much memory is available, iopause will return immedi‐
40 ately, and will report (often incorrectly) that no descriptors are
41 readable or writable. This is a kernel bug, and I encourage vendors to
42 fix it.
43
44 If poll is not available, iopause uses the select function. This func‐
45 tion cannot see descriptor numbers past a system-defined limit, typi‐
46 cally 256 or 1024; iopause will artificially pretend that those
47 descriptors are never readable or writable.
48
49 Future implementations of iopause may work around these problems on
50 some systems, at the expense of chewing up all available CPU time.
51
52 Both poll and select use relative timeouts rather than absolute dead‐
53 lines. Some kernels round the timeout down to a multiple of 10 mil‐
54 liseconds; this can burn quite a bit of CPU time as the deadline
55 approaches. iopause compensates for this by adding 20 milliseconds to
56 the timeout.
57
59 select(2), poll(3), taia_now(3)
60
61
62
63 iopause(3)