Date: Mon, 11 Jun 2012 07:11:35 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r236875 - in stable: 7/usr.sbin/inetd 8/usr.sbin/inetd 9/usr.sbin/inetd Message-ID: <201206110711.q5B7BZwm049456@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Jun 11 07:11:34 2012 New Revision: 236875 URL: http://svn.freebsd.org/changeset/base/236875 Log: MFC r236572: Replace the use of wall clock time with monotonically increasing clock. In general, gettimeofday() is not appropriate interface when accounting for elasped time because it can go backward, in which case the policy code could errornously consider the limit as exceeded. Reported by: Mahesh Arumugam Submitted by: Dorr H. Clark via gnn Sponsored by: Citrix / NetScaler Modified: stable/8/usr.sbin/inetd/inetd.c stable/8/usr.sbin/inetd/inetd.h Directory Properties: stable/8/usr.sbin/inetd/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.sbin/inetd/inetd.c stable/7/usr.sbin/inetd/inetd.h stable/9/usr.sbin/inetd/inetd.c stable/9/usr.sbin/inetd/inetd.h Directory Properties: stable/7/usr.sbin/inetd/ (props changed) stable/9/usr.sbin/inetd/ (props changed) Modified: stable/8/usr.sbin/inetd/inetd.c ============================================================================== --- stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:11:34 2012 (r236875) @@ -688,11 +688,11 @@ main(int argc, char **argv) */ if (dofork) { if (sep->se_count++ == 0) - (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &sep->se_time); else if (toomany > 0 && sep->se_count >= toomany) { - struct timeval now; + struct timespec now; - (void)gettimeofday(&now, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &now); if (now.tv_sec - sep->se_time.tv_sec > CNT_INTVL) { sep->se_time = now; Modified: stable/8/usr.sbin/inetd/inetd.h ============================================================================== --- stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:11:34 2012 (r236875) @@ -109,7 +109,7 @@ struct servtab { u_int se_rpc_lowvers; /* RPC low version */ u_int se_rpc_highvers; /* RPC high version */ int se_count; /* number started since se_time */ - struct timeval se_time; /* start of se_count */ + struct timespec se_time; /* start of se_count */ struct servtab *se_next; struct se_flags { u_int se_nomapped : 1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206110711.q5B7BZwm049456>