Deleted Added
full compact
rpoll.man (156803) rpoll.man (165009)
1'\"
1'\"
2'\" Copyright (c)1996-2002 by Hartmut Brandt
2'\" Copyright (c)1996-2006 by Hartmut Brandt
3'\" All rights reserved.
4'\"
3'\" All rights reserved.
4'\"
5'\" Author: Hartmut Brandt
5'\" Author: harti@freebsd.org <Hartmut Brandt>
6'\"
7'\" Redistribution of this software and documentation and use in source and
8'\" binary forms, with or without modification, are permitted provided that
9'\" the following conditions are met:
10'\"
11'\" 1. Redistributions of source code or documentation must retain the above
12'\" copyright notice, this list of conditions and the following disclaimer.
13'\" 2. Redistributions in binary form must reproduce the above copyright

--- 9 unchanged lines hidden (view full) ---

23'\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24'\" OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25'\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26'\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27'\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28'\"
29'\" $Begemot: libbegemot/rpoll.man,v 1.4 2004/09/21 15:59:00 brandt Exp $
30'\"
6'\"
7'\" Redistribution of this software and documentation and use in source and
8'\" binary forms, with or without modification, are permitted provided that
9'\" the following conditions are met:
10'\"
11'\" 1. Redistributions of source code or documentation must retain the above
12'\" copyright notice, this list of conditions and the following disclaimer.
13'\" 2. Redistributions in binary form must reproduce the above copyright

--- 9 unchanged lines hidden (view full) ---

23'\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24'\" OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25'\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26'\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27'\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28'\"
29'\" $Begemot: libbegemot/rpoll.man,v 1.4 2004/09/21 15:59:00 brandt Exp $
30'\"
31.TH rpoll 3 "21 Oct 1996" "BEGEMOT" "BEGEMOT Library"
31.TH rpoll 3 "8 Dec 2006" "BEGEMOT" "BEGEMOT Library"
32.SH NAME
33rpoll - callback functions for file descriptors and timers
34.SH SYNOPSIS
35.LP
36.B "# include <rpoll.h>"
37.LP
32.SH NAME
33rpoll - callback functions for file descriptors and timers
34.SH SYNOPSIS
35.LP
36.B "# include <rpoll.h>"
37.LP
38.BR "typedef void (*poll_f)(int " "fd" ", int " "mask" ", void *" "arg);"
38.BR "typedef void (*poll_f)(int " "fd" ", int " "mask" ", void *" "arg" ");"
39.br
39.br
40.BR "typedef void (*timer_f)(int " "tid" ", void *" "arg);"
40.BR "typedef void (*timer_f)(int " "tid" ", void *" "arg" ");"
41.LP
42.BR "int poll_register(int " "fd" ", poll_f "
43.RB "func" ", void *" "arg" ", int " "mask" ");"
44.LP
45.BR "void poll_unregister(int " "handle" ");"
46.LP
41.LP
42.BR "int poll_register(int " "fd" ", poll_f "
43.RB "func" ", void *" "arg" ", int " "mask" ");"
44.LP
45.BR "void poll_unregister(int " "handle" ");"
46.LP
47.BR "int poll_start_timer(u_int " "msecs" ", int " "repeat" ", timer_f " "func,"
47.BR "int poll_start_timer(u_int " "msecs" ", int " "repeat" ", timer_f " "func" ","
48.if n .ti +.5i
48.if n .ti +.5i
49.BR "void *" "arg);"
49.BR "void *" "arg" ");"
50.LP
51.BR "void poll_stop_timer(int " "handle" ");"
52.LP
50.LP
51.BR "void poll_stop_timer(int " "handle" ");"
52.LP
53.BR "int poll_start_utimer(unsigned long long " "usecs" ", int " "repeat" ",
54.if n .ti +.5i
55.BR "timer_f " "func" ", void *" "arg" ");"
56.LP
53.BR "void poll_dispatch(int " "wait" ");"
54.SH DESCRIPTION
55Many programs need to read from several file descriptors at the same time.
56Typically in these programs one of
57.BR select (3c)
58or
59.BR poll (2)
60is used.

--- 47 unchanged lines hidden (view full) ---

108is changed to reflect the new mask.
109.LP
110A registered file descriptor may be de-registered by calling
111.B poll_unregister
112with the handle returned by
113.BR poll_register .
114.LP
115A timer is created with
57.BR "void poll_dispatch(int " "wait" ");"
58.SH DESCRIPTION
59Many programs need to read from several file descriptors at the same time.
60Typically in these programs one of
61.BR select (3c)
62or
63.BR poll (2)
64is used.

--- 47 unchanged lines hidden (view full) ---

112is changed to reflect the new mask.
113.LP
114A registered file descriptor may be de-registered by calling
115.B poll_unregister
116with the handle returned by
117.BR poll_register .
118.LP
119A timer is created with
116.BR poll_start_timer .
120.BR poll_start_timer
121or
122.BR poll_start_utimer .
117.I msecs
123.I msecs
118is the number of milliseconds, after which the timer event will be generated.
124is the number of milliseconds in
125.BR poll_start_timer
126while
127.I usecs
128is the number of microseconds in
129.BR poll_start_utimer ,
130after which the timer event will be generated.
131If the functions use the
132.BR poll (2)
133system call, then
134.I usecs
135is rounded to milliseconds and
136.BR poll_start_timer
137is called.
119.I repeat
120selects one-short behavior (if 0) or a repeatable timer (if not 0). A one-short timer
121will automatically unregistered after expiry.
122.I func
123is the user function which will be called with a timer id and the user supplied
124.IR arg .
125.B poll_start_timer
138.I repeat
139selects one-short behavior (if 0) or a repeatable timer (if not 0). A one-short timer
140will automatically unregistered after expiry.
141.I func
142is the user function which will be called with a timer id and the user supplied
143.IR arg .
144.B poll_start_timer
126returnes a timer id, which may be used to cancel the timer with
145and
146.B poll_start_utimer
147return a timer id, which may be used to cancel the timer with
127.BR poll_stop_timer .
128A one-short timer should be canceled only if it has not yet fired.
129.LP
130.B poll_dispatch
131must be called to actually dispatch events.
132.I wait
133is a flag, which should be 0, if only a poll should be done. In this case, the function returns,
134after polling the registered file descriptors and timers. If

--- 11 unchanged lines hidden (view full) ---

146while(1)
147 poll_dispatch(1);
148.ft 1
149.fi
150.RE
151.SH "SEE ALSO"
152.BR poll (2), select (3C)
153.SH "RETURN VALUES"
148.BR poll_stop_timer .
149A one-short timer should be canceled only if it has not yet fired.
150.LP
151.B poll_dispatch
152must be called to actually dispatch events.
153.I wait
154is a flag, which should be 0, if only a poll should be done. In this case, the function returns,
155after polling the registered file descriptors and timers. If

--- 11 unchanged lines hidden (view full) ---

167while(1)
168 poll_dispatch(1);
169.ft 1
170.fi
171.RE
172.SH "SEE ALSO"
173.BR poll (2), select (3C)
174.SH "RETURN VALUES"
154.B poll_register
155and
175.B poll_register ,
156.B poll_start_timer
176.B poll_start_timer
157return a handle which may be used to unregister the file descriptor or cancel the timer.
177and
178.B poll_start_utimer
179return a handle which may be used to unregister the file descriptor or
180cancel the timer.
158.LP
159Both functions and
160.B poll_dispatch
161call
162.BR xrealloc (l)
163and can end in
164.BR panic (l).
165.SH "ERRORS"

--- 23 unchanged lines hidden ---
181.LP
182Both functions and
183.B poll_dispatch
184call
185.BR xrealloc (l)
186and can end in
187.BR panic (l).
188.SH "ERRORS"

--- 23 unchanged lines hidden ---