Commit Graph

15 Commits

Author SHA1 Message Date
Todd C. Miller
9d4a92b9b4 Handle the possibility of the siginfo parameter in sa_sigaction
handler being NULL.
2017-05-12 10:02:17 -06:00
Todd C. Miller
2a55808775 Add support for signal events in sudo's event subsystem 2017-05-12 10:02:17 -06:00
Todd C. Miller
05a01d4c5d Avoid using a leading underbar in defines as they are reserved in
ISO C.
2015-05-21 11:13:20 -06:00
Todd C. Miller
2b849b2687 Don't allow sudo_ev_loopcont() to override sudo_ev_loopexit() 2014-08-29 09:47:08 -06:00
Todd C. Miller
e9370718f9 Add some internal convenience functions. 2014-08-29 09:44:08 -06:00
Todd C. Miller
844a285391 Version the functions in libsudo_util 2014-07-22 11:26:17 -06:00
Todd C. Miller
b45727cefa Rename queue.h -> sudo_queue.h to avoid collisions with the system
version.
2014-07-21 14:37:27 -06:00
Todd C. Miller
088edcb6f5 Add exported libsudo_util functions to util.exp and mark in headers
using __dso_public.
2014-06-26 15:51:15 -06:00
Todd C. Miller
adef363d00 Make a copy of readfds/writefds before calling select() instead
of calculating it each time.  Keep track of high fd in the base.
2013-10-31 16:13:15 -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
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
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