ping(8): don't round timeouts up to HZ

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ping(8): don't round timeouts up to HZ

Scott Cheloha
ping(8) doesn't know the value of HZ and shouldn't round the timeout
up.  The kernel will do the right thing anyway.

Not sure if the warning here is useful either.  If the period is too
small it will just fire less often.  We could add a warning about it
in CAVEATS in ping.8...

Preferences?

Index: ping.c
===================================================================
RCS file: /cvs/src/sbin/ping/ping.c,v
retrieving revision 1.236
diff -u -p -r1.236 ping.c
--- ping.c 28 Jun 2019 13:32:45 -0000 1.236
+++ ping.c 19 Jul 2019 15:19:49 -0000
@@ -343,11 +343,6 @@ main(int argc, char *argv[])
     (long)((intval - interval.tv_sec) * 1000000);
  if (interval.tv_sec < 0)
  errx(1, "illegal timing interval %s", optarg);
- /* less than 1/Hz does not make sense */
- if (interval.tv_sec == 0 && interval.tv_usec < 10000) {
- warnx("too small interval, raised to 0.01");
- interval.tv_usec = 10000;
- }
  options |= F_INTERVAL;
  break;
  case 'L':

Reply | Threaded
Open this post in threaded view
|

Re: ping(8): don't round timeouts up to HZ

Todd C. Miller-3
On Fri, 19 Jul 2019 10:29:11 -0500, Scott Cheloha wrote:

> ping(8) doesn't know the value of HZ and shouldn't round the timeout
> up.  The kernel will do the right thing anyway.
>
> Not sure if the warning here is useful either.  If the period is too
> small it will just fire less often.  We could add a warning about it
> in CAVEATS in ping.8...

I'm fine with removing that code; I don't think a CAVEAT in the
manual is needed.

 - todd