diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1098,21 +1098,21 @@ } /* - * ppsratecheck(): packets (or events) per second limitation. + * eventratecheck(): events per second limitation. * * Return 0 if the limit is to be enforced (e.g. the caller - * should drop a packet because of the rate limitation). + * should ignore the event because of the rate limitation). * - * maxpps of 0 always causes zero to be returned. maxpps of -1 + * maxeps of 0 always causes zero to be returned. maxeps of -1 * always causes 1 to be returned; this effectively defeats rate * limiting. * * Note that we maintain the struct timeval for compatibility * with other bsd systems. We reuse the storage and just monitor - * clock ticks for minimal overhead. + * clock ticks for minimal overhead. */ int -ppsratecheck(struct timeval *lasttime, int *curpps, int maxpps) +eventratecheck(struct timeval *lasttime, int *cureps, int maxeps) { int now; @@ -1124,11 +1124,11 @@ now = ticks; if (lasttime->tv_sec == 0 || (u_int)(now - lasttime->tv_sec) >= hz) { lasttime->tv_sec = now; - *curpps = 1; - return (maxpps != 0); + *cureps = 1; + return (maxeps != 0); } else { - (*curpps)++; /* NB: ignore potential overflow */ - return (maxpps < 0 || *curpps <= maxpps); + (*cureps)++; /* NB: ignore potential overflow */ + return (maxeps < 0 || *cureps <= maxeps); } } diff --git a/sys/sys/time.h b/sys/sys/time.h --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -578,7 +578,8 @@ /* Other functions */ int itimerdecr(struct itimerval *itp, int usec); int itimerfix(struct timeval *tv); -int ppsratecheck(struct timeval *, int *, int); +int eventratecheck(struct timeval *, int *, int); +#define ppsratecheck(t, c, m) eventratecheck(t, c, m) int ratecheck(struct timeval *, const struct timeval *); void timevaladd(struct timeval *t1, const struct timeval *t2); void timevalsub(struct timeval *t1, const struct timeval *t2);