diff --git a/src/libs/compat/freebsd_network/callout.c b/src/libs/compat/freebsd_network/callout.c index 7c7c0be1fa..f9374392f7 100644 --- a/src/libs/compat/freebsd_network/callout.c +++ b/src/libs/compat/freebsd_network/callout.c @@ -27,6 +27,9 @@ handle_callout(struct net_timer *timer, void *data) } +// #pragma mark - + + void callout_init_mtx(struct callout *c, struct mtx *mtx, int flags) { @@ -63,3 +66,17 @@ _callout_stop_safe(struct callout *c, int safe) return gStack->cancel_timer(&c->c_timer) ? 1 : 0; } + +int +callout_pending(struct callout *c) +{ + return gStack->is_timer_active(&c->c_timer); +} + + +int +callout_active(struct callout *c) +{ + return gStack->is_timer_running(&c->c_timer); +} + diff --git a/src/libs/compat/freebsd_network/compat/sys/callout.h b/src/libs/compat/freebsd_network/compat/sys/callout.h index f6c5a67d02..cf8b0ccfd2 100644 --- a/src/libs/compat/freebsd_network/compat/sys/callout.h +++ b/src/libs/compat/freebsd_network/compat/sys/callout.h @@ -22,16 +22,14 @@ struct callout { #define CALLOUT_MPSAFE 0x0001 void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags); -int callout_reset(struct callout *, int, void (*)(void *), void *); +int callout_reset(struct callout *c, int, void (*func)(void *), void *arg); +int callout_pending(struct callout *c); +int callout_active(struct callout *c); #define callout_drain(c) _callout_stop_safe(c, 1) #define callout_stop(c) _callout_stop_safe(c, 0) int _callout_stop_safe(struct callout *, int); -#define callout_pending(c) ((c)->c_timer.due > 0) -#define callout_active(c) ((c)->c_timer.due == -1) - // TODO: there is currently no way to find out about this! - static inline void callout_init(struct callout *c, int mpsafe)