34 static struct timeout *free_timeouts;
39 if (
cur_tv . tv_sec != t) {
54 if ((timeouts ->
when . tv_sec <
cur_tv . tv_sec) ||
55 ((timeouts ->
when . tv_sec ==
cur_tv . tv_sec) &&
56 (timeouts ->
when . tv_usec <=
cur_tv . tv_usec))) {
58 timeouts = timeouts ->
next;
62 t ->
next = free_timeouts;
67 tvp -> tv_sec = timeouts ->
when . tv_sec;
68 tvp -> tv_usec = timeouts ->
when . tv_usec;
72 return (
struct timeval *)0;
122 if (status == ISC_R_RELOAD) {
129 if (status == ISC_R_SUCCESS)
130 status = ISC_R_RELOAD;
132 }
while (status == ISC_R_RELOAD);
134 log_fatal (
"Dispatch routine failed: %s -- exiting",
135 isc_result_totext (status));
146 gettimeofday (&
cur_tv, (
struct timezone *)0);
154 for (q = timeouts; q; q = q->
next) {
178 q->
next = free_timeouts;
187 log_error(
"Error finding timer structure");
190 isc_event_free(&eventp);
195 #define USEC_MAX 1000000 196 #define DHCP_SEC_MAX 0xFFFFFFFF 199 struct timeval *when;
200 void (*where) (
void *);
210 isc_interval_t interval;
219 for (q = timeouts; q; q = q->
next) {
220 if ((where == NULL || q->
func == where) &&
237 free_timeouts = q->
next;
245 memset(q, 0,
sizeof *q);
271 if ((
when->tv_usec != 0) && (usec < 0)) {
281 "reducing to 2^^32-1");
284 }
else if (usec < 0) {
296 q->
when.tv_usec = usec;
298 #if defined (TRACING) 312 if (!timeouts || (timeouts->
when.tv_sec > q->
when.tv_sec) ||
313 ((timeouts->
when.tv_sec == q->
when.tv_sec) &&
314 (timeouts->
when.tv_usec > q->
when.tv_usec))) {
321 for (t = timeouts; t->
next; t = t->
next) {
359 isc_interval_set(&interval, sec, usec * 1000);
360 status = isc_time_nowplusinterval(&expires, &interval);
361 if (status != ISC_R_SUCCESS) {
367 isc_result_totext(status));
372 isc_timertype_once, &expires,
378 isc_timertype_once, &expires,
383 if (status != ISC_R_SUCCESS) {
384 log_fatal(
"Unable to add timeout to isclib\n");
391 void (*where) (
void *);
398 for (q = timeouts; q; q = q ->
next) {
415 #if defined (TRACING) 419 #if defined (TRACING) 425 q->
next = free_timeouts;
430 #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) 434 for (t = timeouts; t; t = n) {
439 t->
next = free_timeouts;
447 for (t = free_timeouts; t; t = n) {
void cancel_timeout(void(*)(void *) where, void *what)
dhcp_context_t dhcp_gbl_ctx
isc_timermgr_t * timermgr
struct timeval * process_outstanding_timeouts(struct timeval *tvp)
int log_error(const char *,...) __attribute__((__format__(__printf__
void cancel_all_timeouts(void)
void add_timeout(struct timeval *when, void(*)(void *) where, void *what, tvref_t ref, tvunref_t unref)
void(* tvunref_t)(void *, const char *, int)
void(* tvref_t)(void *, void *, const char *, int)
void log_fatal(const char *,...) __attribute__((__format__(__printf__
void relinquish_timeouts(void)
isc_timer_t * isc_timeout
void dfree(void *, const char *, int)
void * dmalloc(size_t, const char *, int)
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
void isclib_timer_callback(isc_task_t *taskp, isc_event_t *eventp)
struct timeout * timeouts