Add support for multiple Debug lines per program. Callers may

register arbitrary debug facilities or use built-in defaults.  We
now use separate Debug statements for plugins and programs.
This commit is contained in:
Todd C. Miller
2014-10-22 13:23:05 -06:00
parent a7e724b75d
commit 866cfc4fc3
100 changed files with 1509 additions and 949 deletions

View File

@@ -56,7 +56,7 @@ int
sudo_ev_base_alloc_impl(struct sudo_event_base *base)
{
int i;
debug_decl(sudo_ev_base_alloc_impl, SUDO_DEBUG_EVENT)
debug_decl(sudo_ev_base_alloc_impl, SUDO_DEBUG_EVENT, SUDO_DEBUG_INSTANCE_DEFAULT)
base->pfd_high = -1;
base->pfd_max = 32;
@@ -71,7 +71,7 @@ sudo_ev_base_alloc_impl(struct sudo_event_base *base)
void
sudo_ev_base_free_impl(struct sudo_event_base *base)
{
debug_decl(sudo_ev_base_free_impl, SUDO_DEBUG_EVENT)
debug_decl(sudo_ev_base_free_impl, SUDO_DEBUG_EVENT, SUDO_DEBUG_INSTANCE_DEFAULT)
sudo_efree(base->pfds);
debug_return;
}
@@ -80,7 +80,7 @@ int
sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
{
struct pollfd *pfd;
debug_decl(sudo_ev_add_impl, SUDO_DEBUG_EVENT)
debug_decl(sudo_ev_add_impl, SUDO_DEBUG_EVENT, SUDO_DEBUG_INSTANCE_DEFAULT)
/* If out of space in pfds array, realloc. */
if (base->pfd_free == base->pfd_max) {
@@ -119,7 +119,7 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
int
sudo_ev_del_impl(struct sudo_event_base *base, struct sudo_event *ev)
{
debug_decl(sudo_ev_del_impl, SUDO_DEBUG_EVENT)
debug_decl(sudo_ev_del_impl, SUDO_DEBUG_EVENT, SUDO_DEBUG_INSTANCE_DEFAULT)
/* Mark pfd entry unused, add to free list and adjust high slot. */
base->pfds[ev->pfd_idx].fd = -1;
@@ -137,7 +137,7 @@ sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
struct sudo_event *ev;
int nready, timeout;
struct timeval now;
debug_decl(sudo_ev_scan_impl, SUDO_DEBUG_EVENT)
debug_decl(sudo_ev_scan_impl, SUDO_DEBUG_EVENT, SUDO_DEBUG_INSTANCE_DEFAULT)
if ((ev = TAILQ_FIRST(&base->timeouts)) != NULL) {
struct timeval *timo = &ev->timeout;