man page fixes from todd miller

svn:r352
This commit is contained in:
Niels Provos 2007-03-22 15:09:30 +00:00
parent 41b7cbc381
commit f5aa65c9b3

39
event.3
View File

@ -39,6 +39,7 @@
.Nm event_base_loop , .Nm event_base_loop ,
.Nm event_base_loopexit , .Nm event_base_loopexit ,
.Nm event_base_set , .Nm event_base_set ,
.Nm event_base_free ,
.Nm event_add , .Nm event_add ,
.Nm event_del , .Nm event_del ,
.Nm event_once , .Nm event_once ,
@ -84,9 +85,9 @@
.Fd #include <sys/time.h> .Fd #include <sys/time.h>
.Fd #include <event.h> .Fd #include <event.h>
.Ft "struct event_base *" .Ft "struct event_base *"
.Fn "event_init" .Fn "event_init" "void"
.Ft int .Ft int
.Fn "event_dispatch" .Fn "event_dispatch" "void"
.Ft int .Ft int
.Fn "event_loop" "int flags" .Fn "event_loop" "int flags"
.Ft int .Ft int
@ -101,6 +102,8 @@
.Fn "event_base_loopexit" "struct event_base *base" "struct timeval *tv" .Fn "event_base_loopexit" "struct event_base *base" "struct timeval *tv"
.Ft int .Ft int
.Fn "event_base_set" "struct event_base *base" "struct event *" .Fn "event_base_set" "struct event_base *base" "struct event *"
.Ft void
.Fn "event_base_free" "struct event_base *base"
.Ft int .Ft int
.Fn "event_add" "struct event *ev" "struct timeval *tv" .Fn "event_add" "struct event *ev" "struct timeval *tv"
.Ft int .Ft int
@ -160,11 +163,11 @@
.Ft void .Ft void
.Fn "evbuffer_free" "struct evbuffer *buf" .Fn "evbuffer_free" "struct evbuffer *buf"
.Ft int .Ft int
.Fn "evbuffer_add" "struct evbuffer *buf" "u_char *data" "size_t size" .Fn "evbuffer_add" "struct evbuffer *buf" "const void *data" "size_t size"
.Ft int .Ft int
.Fn "evbuffer_add_buffer" "struct evbuffer *dst" "struct evbuffer *src" .Fn "evbuffer_add_buffer" "struct evbuffer *dst" "struct evbuffer *src"
.Ft int .Ft int
.Fn "evbuffer_add_printf" "struct evbuffer *buf" "char *fmt" "..." .Fn "evbuffer_add_printf" "struct evbuffer *buf" "const char *fmt" "..."
.Ft int .Ft int
.Fn "evbuffer_add_vprintf" "struct evbuffer *buf" "const char *fmt" "va_list ap" .Fn "evbuffer_add_vprintf" "struct evbuffer *buf" "const char *fmt" "va_list ap"
.Ft void .Ft void
@ -174,7 +177,7 @@
.Ft int .Ft int
.Fn "evbuffer_read" "struct evbuffer *buf" "int fd" "int size" .Fn "evbuffer_read" "struct evbuffer *buf" "int fd" "int size"
.Ft "u_char *" .Ft "u_char *"
.Fn "evbuffer_find" "struct evbuffer *buf" "u_char *data" "size_t size" .Fn "evbuffer_find" "struct evbuffer *buf" "const u_char *data" "size_t size"
.Ft "char *" .Ft "char *"
.Fn "evbuffer_readline" "struct evbuffer *buf" .Fn "evbuffer_readline" "struct evbuffer *buf"
.Ft "struct evhttp *" .Ft "struct evhttp *"
@ -183,7 +186,7 @@
.Fn "evhttp_free" "struct evhttp* http" .Fn "evhttp_free" "struct evhttp* http"
.Ft int .Ft int
.Fa (*event_sigcb)(void) ; .Fa (*event_sigcb)(void) ;
.Ft int .Ft volatile sig_atomic_t
.Fa event_gotsig ; .Fa event_gotsig ;
.Sh DESCRIPTION .Sh DESCRIPTION
The The
@ -220,7 +223,7 @@ After the signal handler sets
.Nm event_dispatch .Nm event_dispatch
will execute the callback function to process received signals. will execute the callback function to process received signals.
The callback returns 1 when no events are registered any more. The callback returns 1 when no events are registered any more.
It can return -1 to indicate an error to the It can return \-1 to indicate an error to the
.Nm event .Nm event
library, causing library, causing
.Fn event_dispatch .Fn event_dispatch
@ -456,8 +459,9 @@ This event base can be used in conjunction with calls to
.Fn event_base_dispatch , .Fn event_base_dispatch ,
.Fn event_base_loop , .Fn event_base_loop ,
.Fn event_base_loopexit , .Fn event_base_loopexit ,
.Fn bufferevent_base_set
and and
.Fn bufferevent_base_set . .Fn event_base_free .
.Fn event_base_set .Fn event_base_set
should be called after preparing an event with should be called after preparing an event with
.Fn event_set , .Fn event_set ,
@ -467,6 +471,9 @@ assigns the provided event to the most recently created event base.
.Fn bufferevent_base_set .Fn bufferevent_base_set
should be called after preparing a bufferevent with should be called after preparing a bufferevent with
.Fn bufferevent_new . .Fn bufferevent_new .
.Fn event_base_free
should be used to free memory associated with the event base
when it is no longer needed.
.Sh BUFFERED EVENTS .Sh BUFFERED EVENTS
.Nm libevent .Nm libevent
provides an abstraction on top of the regular event callbacks. provides an abstraction on top of the regular event callbacks.
@ -500,13 +507,14 @@ Both the read and the write callback may be NULL.
The error callback has to be always provided. The error callback has to be always provided.
.Pp .Pp
Once initialized, the bufferevent structure can be used repeatedly with Once initialized, the bufferevent structure can be used repeatedly with
bufferevent_enable() and bufferevent_disable(). The flags parameter can bufferevent_enable() and bufferevent_disable().
be a combination of The flags parameter can be a combination of
.Va EV_READ .Va EV_READ
and and
.Va EV_WRITE . .Va EV_WRITE .
When read enabled the bufferevent will try to read from the file When read enabled the bufferevent will try to read from the file
descriptor and call the read callback. The write callback is executed descriptor and call the read callback.
The write callback is executed
whenever the output buffer is drained below the write low watermark, whenever the output buffer is drained below the write low watermark,
which is which is
.Va 0 .Va 0
@ -517,10 +525,12 @@ The
function can be used to write data to the file descriptor. function can be used to write data to the file descriptor.
The data is appended to the output buffer and written to the descriptor The data is appended to the output buffer and written to the descriptor
automatically as it becomes available for writing. automatically as it becomes available for writing.
.Fn bufferevent_write
returns 0 on success or \-1 on failure.
The The
.Fn bufferevent_read .Fn bufferevent_read
function is used to read data from the input buffer. function is used to read data from the input buffer,
Both functions return the amount of data written or read. returning the amount of data read.
.Pp .Pp
If multiple bases are in use, bufferevent_base_set() must be called before If multiple bases are in use, bufferevent_base_set() must be called before
enabling the bufferevent for the first time. enabling the bufferevent for the first time.
@ -542,7 +552,7 @@ The corresponding callback will receive an
.Va struct evhttp_request .Va struct evhttp_request
object that contains all information about the request. object that contains all information about the request.
.Pp .Pp
This section does not document all the possible function calls, please This section does not document all the possible function calls; please
check check
.Va event.h .Va event.h
for the public interfaces. for the public interfaces.
@ -558,6 +568,7 @@ set to indicate the error.
.Xr kqueue 2 , .Xr kqueue 2 ,
.Xr poll 2 , .Xr poll 2 ,
.Xr select 2 , .Xr select 2 ,
.Xr evdns 3 ,
.Xr timeout 9 .Xr timeout 9
.Sh HISTORY .Sh HISTORY
The The