X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Fisrv.c;h=1c6491eddad624fbc5d0e706f55287a5353218e8;hb=a38f9faa9fa230eb3753381c4f626acf029379fb;hp=f0df2229cd2de233ae24ecdb6aaf8c4dd8dfbc96;hpb=91f20ab510a6ddab49dd89f8c8876912d4537be0;p=oweals%2Fbusybox.git diff --git a/networking/isrv.c b/networking/isrv.c index f0df2229c..1c6491edd 100644 --- a/networking/isrv.c +++ b/networking/isrv.c @@ -3,12 +3,12 @@ * Generic non-forking server infrastructure. * Intended to make writing telnetd-type servers easier. * - * Copyright (C) 2007 Denis Vlasenko + * Copyright (C) 2007 Denys Vlasenko * - * Licensed under GPL version 2, see file LICENSE in this tarball for details. + * Licensed under GPLv2, see file LICENSE in this source tree. */ -#include "busybox.h" +#include "libbb.h" #include "isrv.h" #define DEBUG 0 @@ -21,20 +21,6 @@ /* Helpers */ -/* Even if _POSIX_MONOTONIC_CLOCK is defined, this - * may require librt */ -#if 0 /*def _POSIX_MONOTONIC_CLOCK*/ -static time_t monotonic_time(void) -{ - struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) - time(&ts.tv_sec); - return ts.tv_sec; -} -#else -#define monotonic_time() (time(NULL)) -#endif - /* Opaque structure */ struct isrv_state_t { @@ -258,7 +244,7 @@ static void handle_fd_set(isrv_state_t *state, fd_set *fds, int (*h)(int, void * /* this peer is gone */ remove_peer(state, peer); } else if (TIMEOUT) { - TIMEO_TBL[peer] = monotonic_time(); + TIMEO_TBL[peer] = monotonic_sec(); } } } @@ -301,7 +287,7 @@ void isrv_run( isrv_want_rd(state, listen_fd); /* remember flags to make blocking<->nonblocking switch faster */ /* (suppress gcc warning "cast from ptr to int of different size") */ - PARAM_TBL[0] = (void*)(ptrdiff_t)(fcntl(listen_fd, F_GETFL, 0)); + PARAM_TBL[0] = (void*)(ptrdiff_t)(fcntl(listen_fd, F_GETFL)); while (1) { struct timeval tv; @@ -335,7 +321,7 @@ void isrv_run( break; if (timeout) { - time_t t = monotonic_time(); + time_t t = monotonic_sec(); if (t != CURTIME) { CURTIME = t; handle_timeout(state, do_timeout);