summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-04-22 01:01:18 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-04-22 01:01:18 +0000
commitc202a353397bd69ae8b0eefa44c4264ec1735574 (patch)
treee6a4ea33c28048c50befc936366175b9f69c0218
parent9657663ceec9fe6a3be90c6e4bf3ea973058e65a (diff)
update to libevent 1.0c; keep local changes
no shared lib so no ABI/API check is necessary thanks to Alexander von Gernler for submitting another diff in an attempt to update libevent and for a use-after-free fix. ok henning@ deraadt@
-rw-r--r--lib/libevent/Makefile22
-rw-r--r--lib/libevent/event.379
2 files changed, 89 insertions, 12 deletions
diff --git a/lib/libevent/Makefile b/lib/libevent/Makefile
index c4bd89e6364..dfbc16d2f86 100644
--- a/lib/libevent/Makefile
+++ b/lib/libevent/Makefile
@@ -1,13 +1,15 @@
-# $OpenBSD: Makefile,v 1.11 2005/04/19 08:07:45 deraadt Exp $
+# $OpenBSD: Makefile,v 1.12 2005/04/22 01:01:17 brad Exp $
LIB= event
-SRCS= buffer.c evbuffer.c event.c kqueue.c poll.c select.c signal.c
+SRCS= buffer.c evbuffer.c event.c kqueue.c log.c poll.c select.c signal.c
HDRS= event.h
MAN= event.3
MLINKS= event.3 event_init.3 event.3 event_dispatch.3 event.3 event_loop.3 \
- event.3 event_loopexit.3 event.3 event_set.3 event.3 event_add.3 event.3 \
+ event.3 event_loopexit.3 event.3 event_base_loop.3 event.3 \
+ event_base_loopexit.3 event.3 event_set.3 event.3 event_add.3 event.3 \
event_del.3 event.3 event_once.3 event.3 event_pending.3 event.3 \
- event_initialized.3 event.3 evtimer_set.3 event.3 evtimer_add.3 event.3 \
+ event_initialized.3 event.3 event_priority_init.3 event.3 \
+ ievent_priority_set.3 event.3 evtimer_set.3 event.3 evtimer_add.3 event.3 \
evtimer_del.3 event.3 evtimer_pending.3 event.3 evtimer_initialized.3 \
event.3 signal_set.3 event.3 signal_add.3 event.3 signal_del.3 \
event.3 signal_pending.3 event.3 signal_initialized.3 event.3 \
@@ -20,12 +22,16 @@ MLINKS= event.3 event_init.3 event.3 event_dispatch.3 event.3 event_loop.3 \
event.3 evbuffer_read.3 event.3 evbuffer_find.3
CFLAGS+= -I${.CURDIR} \
- -DHAVE_WORKING_KQUEUE \
- -DHAVE_SELECT \
+ -DHAVE_FCNTL_H \
-DHAVE_POLL \
- -DHAVE_SYS_TIME_H \
+ -DHAVE_SELECT \
+ -DHAVE_SETFD \
-DHAVE_STDARG_H \
- -DHAVE_UNISTD_H
+ -DHAVE_SYS_IOCTL_H \
+ -DHAVE_SYS_TIME_H \
+ -DHAVE_UNISTD_H \
+ -DHAVE_VASPRINTF \
+ -DHAVE_WORKING_KQUEUE
NOPIC=
diff --git a/lib/libevent/event.3 b/lib/libevent/event.3
index 4d5a52fb90d..98347bb196e 100644
--- a/lib/libevent/event.3
+++ b/lib/libevent/event.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: event.3,v 1.16 2005/04/19 08:07:45 deraadt Exp $
+.\" $OpenBSD: event.3,v 1.17 2005/04/22 01:01:17 brad Exp $
.\"
.\" Copyright (c) 2000 Artur Grabowski <art@openbsd.org>
.\" All rights reserved.
@@ -31,12 +31,16 @@
.Nm event_dispatch ,
.Nm event_loop ,
.Nm event_loopexit ,
+.Nm event_base_loop ,
+.Nm event_base_loopexit ,
.Nm event_set ,
.Nm event_add ,
.Nm event_del ,
.Nm event_once ,
.Nm event_pending ,
.Nm event_initialized ,
+.Nm event_priority_init ,
+.Nm event_priority_set ,
.Nm evtimer_set ,
.Nm evtimer_add ,
.Nm evtimer_del ,
@@ -68,7 +72,7 @@
.Sh SYNOPSIS
.Fd #include <sys/time.h>
.Fd #include <event.h>
-.Ft void
+.Ft "struct event_base *"
.Fn "event_init"
.Ft int
.Fn "event_dispatch"
@@ -76,6 +80,10 @@
.Fn "event_loop" "int flags"
.Ft int
.Fn "event_loopexit" "struct timeval *tv"
+.Ft int
+.Fn "event_base_loop" "struct event_base *" "int flags"
+.Ft int
+.Fn "event_base_loopexit" "struct event_base *" "struct timeval *tv"
.Ft void
.Fn "event_set" "struct event *ev" "int fd" "short event" "void (*fn)(int, short, void *)" "void *arg"
.Ft int
@@ -88,6 +96,10 @@
.Fn "event_pending" "struct event *ev" "short event" "struct timeval *tv"
.Ft int
.Fn "event_initialized" "struct event *ev"
+.Ft int
+.Fn "event_priority_init" "int npriorities"
+.Ft int
+.Fn "event_priority_set" "struct event *ev" "int priority"
.Ft void
.Fn "evtimer_set" "struct event *ev" "void (*fn)(int, short, void *)" "void *arg"
.Ft void
@@ -262,6 +274,20 @@ and
.Fn event_del
and does not need to be reinitialized unless the function called and/or
the argument to it are to be changed.
+However, when an
+.Fa ev
+structure has been added to libevent using
+.Fn event_add
+the structure must persist until the event occurs (assuming
+.Fa EV_PERSIST
+is not set) or is removed
+using
+.Fn event_del .
+You may not reuse the same
+.Fa ev
+structure for multiple monitored descriptors; each descriptor
+needs its own
+.Fa ev .
.Pp
The function
.Fn event_add
@@ -356,17 +382,62 @@ adds
.Va EV_PERSIST .
.Pp
It is possible to disable support for
-.Va epoll , kqueue , poll ,
+.Va kqueue , poll ,
or
.Va select
by setting the environment variable
-.Va EVENT_NOEPOLL , EVENT_NOKQUEUE , EVENT_NOPOLL ,
+.Va EVENT_NOKQUEUE , EVENT_NOPOLL ,
or
.Va EVENT_NOSELECT .
By setting the environment variable
.Va EVENT_SHOW_METHOD ,
.Nm libevent
displays the kernel notification method that it uses.
+.Pp
+.Sh EVENT PRIORITIES
+By default
+.Nm libevent
+schedules all active events with the same priority.
+However, sometime it is desirable to process some events with a higher
+priority than others.
+For that reason,
+.Nm libevent
+supports strict priority queues.
+Active events with a lower priority are always processed before events
+with a higher priority.
+.Pp
+The number of different priorities can be set initially with the
+.Fn event_priority_init
+function.
+This function should be called before the first call to
+.Fn event_dispatch .
+The
+.Fn event_priority_set
+function can be used to assign a priority to an event.
+By default,
+.Nm libevent
+assigns the middle priority to all events unless their priority
+is explicitly set.
+.Pp
+.Sh THREAD SAFE EVENTS
+.Nm Libevent
+has experimental support for thread-safe events.
+When initializing the library via
+.Fn event_init ,
+an event base is returned.
+This event base can be used in conjunction with calls to
+.Fn event_base_set ,
+.Fn event_base_dispatch ,
+.Fn event_base_loop ,
+and
+.Fn event_base_loopexit .
+.Fn event_base_set
+should be called after preparing an event with
+.Fn event_set ,
+as
+.Fn event_set
+assigns the provided event to the most recently created event base.
+.Pp
.Sh BUFFERED EVENTS
.Nm libevent
provides an abstraction on top of the regular event callbacks.