/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-1999 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* ev_timers.c - implement timers for the eventlib
* vix 09sep95 [initial]
*/
#if !defined(LINT) && !defined(CODECENTER)
#endif
/* Import. */
#include "port_before.h"
#include "fd_setsize.h"
#include <errno.h>
#include <isc/assertions.h>
#include <isc/eventlib.h>
#include "eventlib_p.h"
#include "port_after.h"
/* Constants. */
/* Forward. */
static int due_sooner(void *, void *);
static void set_index(void *, int);
static void free_timer(void *, void *);
static void print_timer(void *, void *);
/* Private type. */
typedef struct {
void * uap;
} idle_timer;
/* Public. */
struct timespec
struct timespec x;
return (x);
}
struct timespec
struct timespec x;
x.tv_sec++;
}
return (x);
}
struct timespec
struct timespec x;
else {
x.tv_sec--;
}
return (x);
}
int
if (x == 0L)
return (x < 0L ? (-1) : x > 0L ? (1) : (0));
}
struct timespec
evNowTime() {
#ifdef CLOCK_REALTIME
int m = CLOCK_REALTIME;
#ifdef CLOCK_MONOTONIC
if (__evOptMonoTime)
m = CLOCK_MONOTONIC;
#endif
if (clock_gettime(m, &tsnow) == 0)
return (tsnow);
#endif
return (evConsTime(0, 0));
return (evTimeSpec(now));
}
struct timespec
evUTCTime() {
#ifdef CLOCK_REALTIME
return (tsnow);
#endif
return (evConsTime(0, 0));
return (evTimeSpec(now));
}
struct timespec
return (ctx->lastEventTime);
}
struct timespec
return (ts);
}
struct timeval
return (tv);
}
int
void *uap,
) {
"evSetTimer(ctx %p, func %p, uap %p, due %ld.%09ld, inter %ld.%09ld)\n",
#ifdef __hpux
/*
* tv_sec and tv_nsec are unsigned.
*/
#else
#endif
/* due={0,0} is a magic cookie meaning "now." */
/* Allocate and fill. */
return (-1);
/* Remember the ID if the caller provided us a place for it. */
if (opaqueID)
}
return (0);
}
int
/*
* Setting the interval to zero ensures that evDrop() will
* clean up the timer.
*/
return (0);
}
return (-1);
}
return (0);
}
int
const char *param,
int value
) {
int result=0;
else
return (result);
}
int
void *uap,
) {
int result=0;
#ifdef __hpux
/*
* tv_sec and tv_nsec are unsigned.
*/
#else
#endif
case -1:
break;
case 0:
result = 0;
break;
case 1:
break;
}
}
return (result);
}
int
void *uap,
) {
/* Allocate and fill. */
return (-1);
}
return (0);
}
int
}
int
void *uap,
) {
max_idle));
}
int
return (0);
}
/* Public to the rest of eventlib. */
}
void
}
/* Private. */
static int
due_sooner(void *a, void *b) {
a_timer = a;
b_timer = b;
}
static void
}
static void
FREE(t);
}
static void
" func %p, uap %p, due %ld.%09ld, inter %ld.%09ld\n",
}
static void
void *uap,
) {
/*
* Setting the interval to zero will cause the timer to
* be cleaned up in evDrop().
*/
} else {
/* evDrop() will reschedule the timer. */
}
}
/*! \file */