Commit Graph

29 Commits

Author SHA1 Message Date
Todd C. Miller
985af422d2 Rename __dso_public -> sudo_dso_public and move to config.h. 2020-08-12 09:57:42 -06:00
Todd C. Miller
0cf2e09e0c Apply spelling fixes.
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -06:00
Todd C. Miller
85fe30e49b The timeout parameter of sudo_ev_add() should be const. 2020-04-29 11:27:30 -06:00
Todd C. Miller
d83c09fb66 Add SUDO_EV_MASK to mask off invalid event values.
Now used by sudo_ev_init() to avoid bogus events.
2020-03-12 14:00:15 -06:00
Todd C. Miller
c321b3e609 Add forward declaration of struct timeval for deprecated APIs. 2019-12-25 11:20:34 -07:00
Todd C. Miller
22ffffe12b Add sudo_ev_pending(), used to check whether an event is pending. 2019-12-07 08:42:08 -07:00
Todd C. Miller
dae0da2fe3 Include time.h for struct timespec. 2019-11-15 16:32:45 -07:00
Todd C. Miller
5793023ffd Add a plugin interface to sudo main event loop. 2019-11-15 13:36:01 -07:00
Todd C. Miller
1e1ef61902 Add SPDX-License-Identifier to files. 2019-04-29 07:21:51 -06:00
Todd C. Miller
63f7aa8fcf Backward ABI compatibility for even functions that use a timeval. 2018-08-25 21:02:07 -06:00
Todd C. Miller
04d1f56d90 Use struct timespec, not struct timeval in the event subsystem.
Use ppoll() or pselect() if avaialble which use timespec.
2018-08-25 21:02:05 -06:00
Todd C. Miller
42fe0409f6 Add sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
Similar the dispatch function in libevent.
2018-02-19 11:00:10 -07:00
Todd C. Miller
48fba3c2cc update my email to Todd.Miller@sudo.ws 2017-12-03 17:53:40 -07:00
Todd C. Miller
d2a0bfbb12 Add the ability to set a default event base, to be used by plugins
which don't have access to the event base.
2017-07-13 13:59:31 -06:00
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