automatic tests.
OS=BSD | Linux
-If you're building for a NOMMU system where fork() does not work, you should
-add -DTHERE_IS_NO_FORK to your CPPFLAGS.
+If you're building for an MMU-less system where fork() does not work, you
+should add -DTHERE_IS_NO_FORK to your CPPFLAGS.
dhcpcd will try and use a monotonic clock when possible.
Some libc implementations do not correctly report that they have a monotonic
clock, but they have the headers to make it work. dhcpcd will warn about this.
+Without a monotonic clock, we fall victim of the year 2038 time_t bug on
+32-bit platforms AND the timers will be sufer from clock skew if the system
+clock changes.
To force the use of a monotonic clock you can add -DFORCE_MONOTONIC
to your CPPFLAGS.
else if (iface->arp_fd != -1 && FD_ISSET(iface->arp_fd, &fds))
*fd = iface->arp_fd;
} else {
- /* select and poll are CAN timeout BEFORE the timeout.
+ /* select and poll CAN timeout BEFORE the timeout.
* This is a sad state of affairs, so we need to reduce the
* lowest timeout to -1 so it REALLY has timed out. */
ref = get_lowest_timer(state);
* Which is why we use CLOCK_MONOTONIC, but it is not available on all
* platforms.
*/
+#define NO_MONOTONIC "host does not support a montonic clock - timing can skew"
int
get_monotonic(struct timeval *tp)
{
+ static int posix_clock_set = 0;
#if defined(_POSIX_MONOTONIC_CLOCK) && defined(CLOCK_MONOTONIC)
struct timespec ts;
static clockid_t posix_clock;
- static int posix_clock_set = 0;
#ifdef FORCE_MONOTONIC
if (!posix_clock_set) {
clock_monotonic = 1;
} else {
posix_clock = CLOCK_REALTIME;
- logger(LOG_WARNING, "host does not support a monotonic clock");
+ logger(LOG_WARNING, NO_MONOTONIC);
}
posix_clock_set = 1;
tp->tv_usec = ts.tv_nsec / 1000;
return 0;
#else
+
+ if (!posix_clock_set) {
+ logger(LOG_WARNING, NO_MONOTONIC);
+ posix_clock_set = 1;
+ }
return gettimeofday(tp, NULL);
#endif
}