libsudo_util: make more bit flags unsigned.
This commit is contained in:
@@ -136,6 +136,14 @@ struct sudo_conf_debug_file_list;
|
||||
return sudo_debug_ret; \
|
||||
} while (0)
|
||||
|
||||
#define debug_return_uint(ret) \
|
||||
do { \
|
||||
unsigned int sudo_debug_ret = (ret); \
|
||||
sudo_debug_exit_uint(__func__, __FILE__, __LINE__, sudo_debug_subsys, \
|
||||
sudo_debug_ret); \
|
||||
return sudo_debug_ret; \
|
||||
} while (0)
|
||||
|
||||
#define debug_return_id_t(ret) \
|
||||
do { \
|
||||
id_t sudo_debug_ret = (ret); \
|
||||
@@ -260,6 +268,7 @@ sudo_dso_public void sudo_debug_execve2_v1(unsigned int level, const char *path,
|
||||
sudo_dso_public void sudo_debug_exit_v1(const char *func, const char *file, int line, unsigned int subsys);
|
||||
sudo_dso_public void sudo_debug_exit_bool_v1(const char *func, const char *file, int line, unsigned int subsys, bool ret);
|
||||
sudo_dso_public void sudo_debug_exit_int_v1(const char *func, const char *file, int line, unsigned int subsys, int ret);
|
||||
sudo_dso_public void sudo_debug_exit_uint_v1(const char *func, const char *file, int line, unsigned int subsys, unsigned int ret);
|
||||
sudo_dso_public void sudo_debug_exit_long_v1(const char *func, const char *file, int line, unsigned int subsys, long ret);
|
||||
sudo_dso_public void sudo_debug_exit_ptr_v1(const char *func, const char *file, int line, unsigned int subsys, const void *ret);
|
||||
sudo_dso_public void sudo_debug_exit_id_t_v1(const char *func, const char *file, int line, unsigned int subsys, id_t ret);
|
||||
@@ -291,6 +300,7 @@ sudo_dso_public bool sudo_debug_needed_v1(unsigned int level);
|
||||
#define sudo_debug_exit(_a, _b, _c, _d) sudo_debug_exit_v1((_a), (_b), (_c), (_d))
|
||||
#define sudo_debug_exit_bool(_a, _b, _c, _d, _e) sudo_debug_exit_bool_v1((_a), (_b), (_c), (_d), (_e))
|
||||
#define sudo_debug_exit_int(_a, _b, _c, _d, _e) sudo_debug_exit_int_v1((_a), (_b), (_c), (_d), (_e))
|
||||
#define sudo_debug_exit_uint(_a, _b, _c, _d, _e) sudo_debug_exit_uint_v1((_a), (_b), (_c), (_d), (_e))
|
||||
#define sudo_debug_exit_long(_a, _b, _c, _d, _e) sudo_debug_exit_long_v1((_a), (_b), (_c), (_d), (_e))
|
||||
#define sudo_debug_exit_ptr(_a, _b, _c, _d, _e) sudo_debug_exit_ptr_v1((_a), (_b), (_c), (_d), (_e))
|
||||
#define sudo_debug_exit_id_t(_a, _b, _c, _d, _e) sudo_debug_exit_id_t_v1((_a), (_b), (_c), (_d), (_e))
|
||||
|
@@ -37,22 +37,22 @@ struct timeval; /* for deprecated APIs */
|
||||
#define SUDO_EV_MASK (SUDO_EV_READ|SUDO_EV_WRITE|SUDO_EV_PERSIST|SUDO_EV_SIGNAL|SUDO_EV_SIGINFO)
|
||||
|
||||
/* Event flags (internal) */
|
||||
#define SUDO_EVQ_INSERTED 0x01 /* event is on the event queue */
|
||||
#define SUDO_EVQ_ACTIVE 0x02 /* event is on the active queue */
|
||||
#define SUDO_EVQ_TIMEOUTS 0x04 /* event is on the timeouts queue */
|
||||
#define SUDO_EVQ_INSERTED 0x01U /* event is on the event queue */
|
||||
#define SUDO_EVQ_ACTIVE 0x02U /* event is on the active queue */
|
||||
#define SUDO_EVQ_TIMEOUTS 0x04U /* event is on the timeouts queue */
|
||||
|
||||
/* Event loop flags */
|
||||
#define SUDO_EVLOOP_ONCE 0x01 /* Only run once through the loop */
|
||||
#define SUDO_EVLOOP_NONBLOCK 0x02 /* Do not block in event loop */
|
||||
#define SUDO_EVLOOP_ONCE 0x01U /* Only run once through the loop */
|
||||
#define SUDO_EVLOOP_NONBLOCK 0x02U /* Do not block in event loop */
|
||||
|
||||
/* Event base flags (internal) */
|
||||
#define SUDO_EVBASE_LOOPONCE SUDO_EVLOOP_ONCE
|
||||
#define SUDO_EVBASE_LOOPEXIT 0x02
|
||||
#define SUDO_EVBASE_LOOPBREAK 0x04
|
||||
#define SUDO_EVBASE_LOOPCONT 0x08
|
||||
#define SUDO_EVBASE_GOT_EXIT 0x10
|
||||
#define SUDO_EVBASE_GOT_BREAK 0x20
|
||||
#define SUDO_EVBASE_GOT_MASK 0xf0
|
||||
#define SUDO_EVBASE_LOOPEXIT 0x02U
|
||||
#define SUDO_EVBASE_LOOPBREAK 0x04U
|
||||
#define SUDO_EVBASE_LOOPCONT 0x08U
|
||||
#define SUDO_EVBASE_GOT_EXIT 0x10U
|
||||
#define SUDO_EVBASE_GOT_BREAK 0x20U
|
||||
#define SUDO_EVBASE_GOT_MASK 0xf0U
|
||||
|
||||
/* Must match sudo_plugin_ev_callback_t in sudo_plugin.h */
|
||||
typedef void (*sudo_ev_callback_t)(int fd, int what, void *closure);
|
||||
@@ -76,7 +76,7 @@ struct sudo_event {
|
||||
int fd; /* fd/signal we are interested in */
|
||||
short events; /* SUDO_EV_* flags (in) */
|
||||
short revents; /* SUDO_EV_* flags (out) */
|
||||
short flags; /* internal event flags */
|
||||
unsigned short flags; /* internal event flags */
|
||||
short pfd_idx; /* index into pfds array (XXX) */
|
||||
sudo_ev_callback_t callback;/* user-provided callback */
|
||||
struct timespec timeout; /* for SUDO_EV_TIMEOUT */
|
||||
@@ -150,7 +150,7 @@ sudo_dso_public int sudo_ev_dispatch_v1(struct sudo_event_base *head);
|
||||
#define sudo_ev_dispatch(_a) sudo_ev_dispatch_v1((_a))
|
||||
|
||||
/* Main event loop, returns SUDO_CB_SUCCESS, SUDO_CB_BREAK or SUDO_CB_ERROR */
|
||||
sudo_dso_public int sudo_ev_loop_v1(struct sudo_event_base *head, int flags);
|
||||
sudo_dso_public int sudo_ev_loop_v1(struct sudo_event_base *head, unsigned int flags);
|
||||
#define sudo_ev_loop(_a, _b) sudo_ev_loop_v1((_a), (_b))
|
||||
|
||||
/* Return pending event types, fills in ts if non-NULL and there is a timeout */
|
||||
@@ -208,6 +208,6 @@ int sudo_ev_base_alloc_impl(struct sudo_event_base *base);
|
||||
void sudo_ev_base_free_impl(struct sudo_event_base *base);
|
||||
int 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);
|
||||
int sudo_ev_scan_impl(struct sudo_event_base *base, int flags);
|
||||
int sudo_ev_scan_impl(struct sudo_event_base *base, unsigned int flags);
|
||||
|
||||
#endif /* SUDO_EVENT_H */
|
||||
|
@@ -627,7 +627,7 @@ sudo_ev_dispatch_v1(struct sudo_event_base *base)
|
||||
* Returns 0 on success, 1 if no events registered and -1 on error
|
||||
*/
|
||||
int
|
||||
sudo_ev_loop_v1(struct sudo_event_base *base, int flags)
|
||||
sudo_ev_loop_v1(struct sudo_event_base *base, unsigned int flags)
|
||||
{
|
||||
struct timespec now;
|
||||
struct sudo_event *ev;
|
||||
|
@@ -178,7 +178,7 @@ sudo_ev_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timo)
|
||||
#endif /* HAVE_PPOLL */
|
||||
|
||||
int
|
||||
sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
|
||||
sudo_ev_scan_impl(struct sudo_event_base *base, unsigned int flags)
|
||||
{
|
||||
struct timespec now, ts, *timeout;
|
||||
struct sudo_event *ev;
|
||||
|
@@ -185,7 +185,7 @@ sudo_ev_select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
#endif /* HAVE_PSELECT */
|
||||
|
||||
int
|
||||
sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
|
||||
sudo_ev_scan_impl(struct sudo_event_base *base, unsigned int flags)
|
||||
{
|
||||
struct timespec now, ts, *timeout;
|
||||
struct sudo_event *ev;
|
||||
|
@@ -519,6 +519,14 @@ sudo_debug_exit_int_v1(const char *func, const char *file, int line,
|
||||
"<- %s @ %s:%d := %d", func, file, line, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_uint_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, unsigned int ret)
|
||||
{
|
||||
sudo_debug_printf2(NULL, NULL, 0, subsys | SUDO_DEBUG_TRACE,
|
||||
"<- %s @ %s:%d := %u", func, file, line, ret);
|
||||
}
|
||||
|
||||
void
|
||||
sudo_debug_exit_long_v1(const char *func, const char *file, int line,
|
||||
unsigned int subsys, long ret)
|
||||
|
@@ -31,6 +31,7 @@ sudo_debug_exit_ssize_t_v1
|
||||
sudo_debug_exit_str_masked_v1
|
||||
sudo_debug_exit_str_v1
|
||||
sudo_debug_exit_time_t_v1
|
||||
sudo_debug_exit_uint_v1
|
||||
sudo_debug_exit_v1
|
||||
sudo_debug_fork_v1
|
||||
sudo_debug_get_active_instance_v1
|
||||
|
Reference in New Issue
Block a user