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;
121 if (status == ISC_R_RELOAD) {
129 status = ISC_R_RELOAD;
133 if (status == ISC_R_TIMESHIFTED){
136 status = ISC_R_RELOAD;
137 log_info (
"System time has been changed. Unable to use existing leases. Restarting");
141 }
while (status == ISC_R_RELOAD);
143 log_fatal (
"Dispatch routine failed: %s -- exiting",
144 isc_result_totext (status));
155 gettimeofday (&
cur_tv, (
struct timezone *)0);
163 for (q = timeouts; q; q = q->
next) {
187 q->
next = free_timeouts;
196 log_error(
"Error finding timer structure");
199 isc_event_free(&eventp);
204 #define USEC_MAX 1000000
207 struct timeval *
when;
208 void (*where) (
void *);
218 isc_interval_t interval;
227 for (q = timeouts; q; q = q->
next) {
228 if ((where == NULL || q->
func == where) &&
245 free_timeouts = q->
next;
253 memset(q, 0,
sizeof *q);
280 sec = when->tv_sec -
cur_tv.tv_sec;
281 usec = when->tv_usec -
cur_tv.tv_usec;
283 if ((when->tv_usec != 0) && (usec < 0)) {
293 "reducing to: %lu (TIME_MAX - 1)",
297 }
else if (usec < 0) {
309 q->
when.tv_usec = usec;
311 #if defined (TRACING)
325 if (!timeouts || (timeouts->
when.tv_sec > q-> when.tv_sec) ||
326 ((timeouts->
when.tv_sec == q->
when.tv_sec) &&
327 (timeouts->
when.tv_usec > q->
when.tv_usec))) {
334 for (t = timeouts; t->
next; t = t->
next) {
359 isc_interval_set(&interval, sec, usec * 1000);
360 status = isc_time_nowplusinterval(&expires, &interval);
367 isc_result_totext(status));
372 isc_timertype_once, &expires,
378 isc_timertype_once, &expires,
384 log_fatal(
"Unable to add timeout to isclib\n");
391 void (*where) (
void *);
398 for (q = timeouts; q; q = q ->
next) {
399 if (q->
func == where && q->
what == what) {
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)
log_fatal("no memory for uname information.")
void relinquish_timeouts(void)
isc_timer_t * isc_timeout
void(* tvref_t)(void *, void *, const char *, int)
int int log_info(const char *,...) __attribute__((__format__(__printf__
void * dmalloc(size_t, const char *, int)
void(* tvunref_t)(void *, 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