.Nm event_base_loop ,
.Nm event_base_loopexit ,
.Nm event_base_set ,
+.Nm event_base_free ,
.Nm event_add ,
.Nm event_del ,
.Nm event_once ,
.Fd #include <sys/time.h>
.Fd #include <event.h>
.Ft "struct event_base *"
-.Fn "event_init"
+.Fn "event_init" "void"
.Ft int
-.Fn "event_dispatch"
+.Fn "event_dispatch" "void"
.Ft int
.Fn "event_loop" "int flags"
.Ft int
.Fn "event_base_loopexit" "struct event_base *base" "struct timeval *tv"
.Ft int
.Fn "event_base_set" "struct event_base *base" "struct event *"
+.Ft void
+.Fn "event_base_free" "struct event_base *base"
.Ft int
.Fn "event_add" "struct event *ev" "struct timeval *tv"
.Ft int
.Ft void
.Fn "evbuffer_free" "struct evbuffer *buf"
.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
.Fn "evbuffer_add_buffer" "struct evbuffer *dst" "struct evbuffer *src"
.Ft int
-.Fn "evbuffer_add_printf" "struct evbuffer *buf" "char *fmt" "..."
+.Fn "evbuffer_add_printf" "struct evbuffer *buf" "const char *fmt" "..."
.Ft int
.Fn "evbuffer_add_vprintf" "struct evbuffer *buf" "const char *fmt" "va_list ap"
.Ft void
.Ft int
.Fn "evbuffer_read" "struct evbuffer *buf" "int fd" "int size"
.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 *"
.Fn "evbuffer_readline" "struct evbuffer *buf"
.Ft "struct evhttp *"
.Fn "evhttp_free" "struct evhttp* http"
.Ft int
.Fa (*event_sigcb)(void) ;
-.Ft int
+.Ft volatile sig_atomic_t
.Fa event_gotsig ;
.Sh DESCRIPTION
The
.Nm event_dispatch
will execute the callback function to process received signals.
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
library, causing
.Fn event_dispatch
.Fn event_base_dispatch ,
.Fn event_base_loop ,
.Fn event_base_loopexit ,
+.Fn bufferevent_base_set
and
-.Fn bufferevent_base_set .
+.Fn event_base_free .
.Fn event_base_set
should be called after preparing an event with
.Fn event_set ,
.Fn bufferevent_base_set
should be called after preparing a bufferevent with
.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
.Nm libevent
provides an abstraction on top of the regular event callbacks.
The error callback has to be always provided.
.Pp
Once initialized, the bufferevent structure can be used repeatedly with
-bufferevent_enable() and bufferevent_disable(). The flags parameter can
-be a combination of
+bufferevent_enable() and bufferevent_disable().
+The flags parameter can be a combination of
.Va EV_READ
and
.Va EV_WRITE .
-When read enabled the bufferevent will try to read from the file
-descriptor and call the read callback. The write callback is executed
-whenever the output buffer is drained below the write low watermark,
+When read enabled the bufferevent will try to read from the file
+descriptor and call the read callback.
+The write callback is executed
+whenever the output buffer is drained below the write low watermark,
which is
.Va 0
by default.
function can be used to write data to the file descriptor.
The data is appended to the output buffer and written to the descriptor
automatically as it becomes available for writing.
+.Fn bufferevent_write
+returns 0 on success or \-1 on failure.
The
.Fn bufferevent_read
-function is used to read data from the input buffer.
-Both functions return the amount of data written or read.
+function is used to read data from the input buffer,
+returning the amount of data read.
.Pp
If multiple bases are in use, bufferevent_base_set() must be called before
enabling the bufferevent for the first time.
The second argument is the URI for which a callback is being registered.
The corresponding callback will receive an
.Va struct evhttp_request
-object that contains all information about the request.
+object that contains all information about the request.
.Pp
-This section does not document all the possible function calls, please
+This section does not document all the possible function calls; please
check
.Va event.h
for the public interfaces.
.Xr kqueue 2 ,
.Xr poll 2 ,
.Xr select 2 ,
+.Xr evdns 3 ,
.Xr timeout 9
.Sh HISTORY
The