RATECHECK(9)
π RATECHECK(9) β event rate limiting, bestie π
Hiii! Welcome to the Kernel Developer's Manual, RATECHECK(9) edition. This page is all about ratecheck and ppsratecheck, aka your rate-limiting duo. It's giving "please don't let your events do too much too fast" energy, and honestly? Obsessed. π
πΈ NAME πΈ
ratecheck, ppsratecheck β event rate limiting. Yes bestie, both of them, same iconic mission. β¨
π SYNOPSIS π
#include <sys/time.h>
int
ratecheck(struct timeval *lasttime, const struct timeval *mininterval);
int
ppsratecheck(struct timeval *lasttime, int *curpps, int maxpps);
π¦ DESCRIPTION π¦
Okay so the ratecheck and ppsratecheck functions are literally here to facilitate rate-limiting of arbitrary events. The former enforces a minimum interval between events, while the latter enforces a maximum number of events per second. Two different girlies, two different jobs, both slaying. π
The ratecheck function compares the current time to the value pointed to by lasttime. If the difference is equal to or greater than mininterval, it returns a non-zero value and updates lasttime to the current time. Otherwise, it returns zero. No cap, that's the whole vibe check. β¨
The ppsratecheck function first compares the current time to lasttime. If at least a full second has passed, the value pointed to by the curpps argument is reset to 1 and lasttime is updated to the current time. Otherwise, curpps is incremented and lasttime is left untouched. In either case, ppsratecheck returns a non-zero value if and only if the updated curpps is less than or equal to maxpps or maxpps is negative. Periodt. π
π SEE ALSO π
π HISTORY π
The ratecheck and ppsratecheck functions first appeared in FreeBSD 5.1. Iconic behavior, honestly. π«Ά
Mwah π this page came from Debian, dated March 11, 2022, and it's RATECHECK(9) β byeee bestie! ππβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2017 Dag-Erling SmΓΈrgrav
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms