Commit Graph

11 Commits

Author SHA1 Message Date
Todd C. Miller
27598bc0ab Update copyright year. 2014-01-07 10:43:31 -07:00
Todd C. Miller
5a6d211d67 Fix infinite loop that could be triggered by sudo_ev_loopbreak()
and sudo_ev_loopcontinue().
2014-01-06 11:20:38 -07:00
Todd C. Miller
1a548a5dda Don't call sudo_ev_{add,del}_impl() for timeout-only events. This
makes it possible to pass sudo_ev_alloc() an fd of -1 for events
only use SUDO_EV_TIMEOUT.
2013-11-01 16:54:49 -06:00
Todd C. Miller
449c4a290a Add sudo_ev_get_timeleft() to get the amount of time left before
an event times out and use it in sudoreplay.
2013-10-29 08:16:42 -06:00
Todd C. Miller
1bc2901a26 Fix sudo_ev_scan_impl() return value in event_poll.c.
Make sure we clear active flag from unprocessed events if
sudo_ev_loopbreak() or sudo_ev_loopcontinue() are used.
Remove bogus optimization when the timeout is zero or negative; it
could prevent an I/O event from being triggered.
2013-10-28 16:40:04 -06:00
Todd C. Miller
4d1f912746 Get rid of cur and pending pointers in struct sudo_event_base. We
now pop the first event off the active queue instead of using a
foreach loop with deferred removal of the event.
Add SUDO_EVQ_INSERTED and SUDO_EVQ_TIMEOUTS flags to indicate that
the event on the event queue and timeouts queue respectively.
No longer need to compare the timeout to {0,0} or compare the
event's base pointer to NULL to determine queue membership.
2013-10-28 11:13:45 -06:00
Todd C. Miller
8861e01d16 Add support for libevent-style timed events. Adding a timed event
is currently O(n).  The only consumer of timed events is sudoreplay
which only used a singled one so O(n) == O(1) for now.  This also
allows us to remove the nanosleep compat function as we now use a
timeout event instead.
2013-10-28 10:00:09 -06:00
Todd C. Miller
e16c99cd2a Add a list of active events in the base that the back end sets when
it calls poll or select.  This allows the front end to iterate over
the events instead of having that code in both back ends.  It will
also simplify support for timeout events.  Also make sure we can't
touch freed memory if a callback frees its own event.
2013-10-26 06:55:23 -06:00
Todd C. Miller
f68ca0168b Remove any existing events before freeing the event base. 2013-10-26 06:55:15 -06:00
Todd C. Miller
923edabe6c Convert sudo to use BSD TAILQ macros instead of home ground tail
queue functions.  This includes a private queue.h header derived
from FreeBSD.  It is simpler to just use our own header rather than
try to deal with macros that may or may not be present in various
queue.h incarnations.
2013-10-22 09:00:37 -06:00
Todd C. Miller
79acd5db49 Simple event subsystem that uses poll() or select(). Basically a
simplied subset of libevent2.  Currently only fd events are supported
(since that's all we need).  The poll() backend is used by default,
except on Mac OS X where poll() is broken for devices (including
/dev/tty and ptys).
2013-10-12 05:53:43 -06:00