summaryrefslogtreecommitdiffstats
path: root/lib/libevent
AgeCommit message (Collapse)AuthorFilesLines
2019-06-28When system calls indicate an error they return -1, not some arbitraryderaadt1-2/+2
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-05-08Fixed integer overflow with an excessively large amount of events.tobias1-10/+15
While at it: KNF and switch from reallocarray to recallocarray. ok tedu
2019-05-03Fixed endless loop/ OOB write on 64 bit systems with large buffers.tobias1-3/+3
If a buffer exceeds UINT_MAX (which is only possible on 64 bit systems) an endless loop or OOB write can occur in buffer-specific readline functions. Switching variables in function scope to size_t solves these issue because relevant fields in struct buffer are already size_t. ok cheloha, deraadt, nicm, tedu
2019-05-01Tweaks previous: gettime() can be void, use TIMESPEC_TO_TIMEVALjca1-9/+5
ok nicm@ tobias@ cheloha@
2019-05-01Require clock_gettime(CLOCK_MONOTONIC) and remove fallback codejca1-66/+8
If clock_gettime(CLOCK_MONOTONIC) fails here, something is really wrong. Lots of userland already require it anyway. Removing the fallback code means less code, less global state and less fiddling with the timeheap internals. ok nicm@ tedu@ tobias@ cheloha@
2019-04-29Switched min_heap to size_t to prevent integer overflows.tobias3-27/+28
Also, as deraadt suggested, switched realloc to recallocarray to at least prevent uninitialized memory to be used as pointers in case of other programming errors. A proper solution (not using an array) needs more work. This change occured in sync with upstream libevent 2.2. with input by and ok bluhm, jca, tedu
2019-04-20knf, ok bluhmtedu1-98/+125
2019-04-18unfold some compound operations to make this easier to followtedu1-6/+11
2018-09-23Document bufferevent_setwatermark(). Initial diff from Geoff Hill on tech@ withanton1-2/+30
some tweaks. With feedback and ok jmc@
2018-07-26Mention some missing libevent macros.rob2-6/+31
ok jmc@, benno@, "yes" deraadt@
2017-08-01add missing and correct misspelled names, most in NAME sections;schwarze1-3/+4
found with regress/usr.bin/mandoc/db/dbm_dump; OK jmc@
2017-07-10if there are no changes for kevent, pass in NULL instead.tedu1-2/+2
this has no effect except to make ktrace output prettier. ok bluhm mpi
2017-06-29take const off the timeval argument in the pending functions.dlg1-5/+5
event_pending, evtimer_pending, and signal_pending all write to the timeval because that's how they tell the caller when the event is meant to fire. ok deraadt@ millert@ jmc@ schwarze@
2017-03-18Use recallocarray() to avoid leaving detritus in memory when resizingderaadt1-2/+3
the string buffer. ok jsing millert
2016-09-03Remove NULL pointer checks before calls to free().nayden4-30/+17
OK bluhm@ nicm@
2016-07-17Talk about event API instead of libeventstefan1-6/+8
Avoids inconsistent capitalization of libevent at start of sentence suggested by and ok jmc@, ok bluhm@
2016-03-30for some time now mandoc has not required MLINKS to functionjmc1-56/+1
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-03-20Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])krw1-2/+2
idioms. Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0) where it is obvious further investigation will not yield and even better way. Obviousness evaluation and ok guenther@
2015-12-25revert change to call kevent immediately.tedu1-6/+65
tcpbench (at a minimum) relies on the old behavior of changes all happening after all event handlers run. in particular, it resets the event for the listening socket *before* calling accept(), when it is still readable. kevent then (correctly) says it is readable on the next go through the loop. silly, subtle, and stupid. problem reported by kettenis
2015-12-16change the kqueue backend to call kevent() as events are added insteadtedu1-65/+6
of deferring until the dispatch loop. kqueue support for various types of files and filesystems has been historically incomplete, and kevent handles this condition by returning an error. the libevent dispatch loop has no way to recover from this error and fails catastrophically, bringing down the entire process because one file went bad. now, instead of all that happending, event_add will return an error. the application can choose to handle or ignore this error, but at least the band will play on. ok nicm
2015-12-11Libraries should not print to stderr, ok tedu beck deraadtnicm1-22/+1
2015-11-10update NAME section to include all documented functions,jmc1-3/+3
or otherwise change Dt to reflect the name of an existing function; feedback/ok schwarze
2015-04-14Another couple of commas in the wrong place, ok jmcnicm1-2/+2
2015-04-14Remove an extra comma pointed out by jmc@.nicm1-2/+2
2015-04-14Reorder prototypes to better match manpage layout and add some missingnicm2-74/+74
argument names, from Fabian Raetz. ok deraadt
2015-02-05Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert1-2/+2
2015-01-06Backout revision 1.37. Setting ev->ev_pncalls to NULL results inbluhm1-5/+2
a use after free if the callback has freed the ev. With F in malloc.conf both tmux and the regression tests triggered a segmentation fault. OK nicm@
2015-01-06Apply commit e0e6958aa074a7714cd7c4aa779a1dfede3a03b1 from upstream.bluhm1-14/+8
- Avoid deadlock when activating signals. Fixes bug 3048812. Based on patch by Nicholas Marriott. The deadlock was ultimately fixed in a different way (by disabling reinit - see event.c r1.25). Add it now for consistency but without the Windows compatibility code. Convert the fnctl() calls to SOCK_CLOEXEC | SOCK_NONBLOCK to simplify the code. OK nicm@
2015-01-06Apply commit 2d8cf0b720cdd5f9f292f174a10ff74e62a380ec from upstream.bluhm1-2/+5
- Defensive programming to prevent (hopefully impossible) stack-stomping OK nicm@
2015-01-05Fix CVE-2014-6272 in Libevent 1.4 from upstream:bluhm2-11/+25
- https://github.com/libevent/libevent/commit/7b21c4eabf1f3946d3f63cce1319c490caab8ecf - For this fix, we need to make sure that passing too-large inputs to the evbuffer functions can't make us do bad things with the heap. On top of that do: - Update libevent version to 1.4.15-stable. - Use SIZE_MAX from limits.h instead of a private define. - Do not declare 'size_t need' twice to avoid a compiler warning. OK sthen
2014-11-21libraries shouldnt print to stderr when things dont go their way.dlg1-3/+3
switch fprintf(stderr) over to event_warn() on malloc failure. fix up an errant newline in an existing event_warn while there. originally i just wanted to delete the fprintf diff from nicm@ who is away from a keyboard right now so cant commit guenther@ agrees with the idea
2014-11-21evbuffer_read will return 0 one an end of file condition.dlg1-2/+3
2014-11-20zap some stray commas;jmc1-3/+3
2014-11-20add evbuffer_expand to NAME;jmc1-1/+2
2014-11-20put MLINKS in the order they appear in the man page, so i don;t go blindjmc1-32/+32
trying to check what's missing;
2014-11-20document the only macro i find useful when working with evbuffers.dlg1-1/+10
2014-11-20might help to Xr evbuffer_new 3dlg1-2/+3
2014-11-20im not good at grammar things.dlg1-2/+2
from schwarze@
2014-11-20use .Va to say errno is a variable.dlg1-6/+14
from schwarze@
2014-11-19fix erroneous capitalisation of a word in the middle of a sentence.dlg1-2/+2
from schwarze again
2014-11-19less worse escapes for \ from ingo. im sure there's a much nicer way todlg1-2/+2
represent newlines still.
2014-11-19use .In to specify includes.dlg2-5/+5
2014-11-19ingo also points out we're documenting things that work withdlg1-2/+2
evbuffers, not evbufbuffers.
2014-11-19ingo points outdlg1-3/+11
.Fo evbuffer_readln .Fa "struct evbuffer *buf" .Fa "size_t *read_out" .Fa "enum evbuffer_eol_style eol_style" .Fc is more readable mdoc for very long prototypes than lines like .Fn "evbuffer_readln" "struct evbuffer *buf" "size_t *read_out" "enum evbuffer_eol_style eol_style"
2014-11-19i got sick of having to read the source code to know what thedlg3-48/+261
evbuffer_foo functions do. reyk, nicm, jmc, and schwarze seem to support a manpage as a reasonable solution to this problem. im putting this in a separate manpage because i find they get too cumbersome when they get too big. ingo agrees (and suggests even this might be too big). the file is evbuffer_new.3 rather than evbuffer.3 because we document functions. ok reyk@ nicm@ jmc@ schwarze@ this is rough, everyone has tweaks coming.
2014-11-19BUGS is no longer relevant, according to nicm;jmc1-8/+2
2014-10-31Libevent has compatibilty wrappers in evutil. OpenBSD does not usebluhm1-3/+6
them anymore, but evutil is still part of libevent's interface. Separate the API of evutil from libevent and do not include evutil.h from event.h automatically. A version bump is not necessary as the library itself does not change. Bulk ports build done by landry@ had no fallout. OK nicm@ deraadt@
2014-10-31Use CDIAGFLAGS from bsd.own.mk and append additional warning flags.bluhm1-11/+10
All warnings have been fixed in libevent. OK nicm@
2014-10-30Fix whitespace errors in libevent.bluhm9-63/+63
OK nicm@
2014-10-30The fdsz and n_events variables contain unsigned values that arebluhm1-6/+6
derived from size_t and passed to functions as size_t parameters. Change them from int to size_t to avoid compiler warnings. OK doug@ nicm@