SD_EVENT_SOURCE_SET_RATELIMIT - Online Linux Manual PageSection : 3
Updated :
Source : systemd 250
Note : sd_event_source_set_ratelimit
NAMEsd_event_source_set_ratelimit, sd_event_source_get_ratelimit, sd_event_source_is_ratelimited, sd_event_source_set_ratelimit_expire_callback − Configure rate limiting on event sources
SYNOPSIS#include <systemd/sd−event.h>int sd_event_source_set_ratelimit(sd_event_source *source, uint64_t interval_usec, unsigned burst); int sd_event_source_get_ratelimit(sd_event_source *source, uint64_t* ret_interval_usec, unsigned* ret_burst); int sd_event_source_is_ratelimited(sd_event_source *source); int sd_event_source_set_ratelimit_expire_callback(sd_event_source *source, sd_event_handler_tcallback);
DESCRIPTIONsd_event_source_set_ratelimit() may be used to enforce rate limiting on an event source. When used an event source will be temporarily turned off when it fires more often then a specified burst number within a specified time interval. This is useful as simple mechanism to avoid event source starvation if high priority event sources fire very frequently. Pass the event source to operate on as first argument, a time interval in microseconds as second argument and a maximum dispatch limit ("burst") as third parameter. Whenever the event source is dispatched more often than the specified burst within the specified interval it is placed in a mode similar to being disabled with sd_event_source_set_enabled(3) and the SD_EVENT_OFF parameter. However it is disabled only temporarily – once the specified interval is over regular operation resumes. It is again disabled temporarily once the specified rate limiting is hit the next time. If either the interval or the burst value are specified as zero, rate limiting is turned off. By default event sources do not have rate limiting enabled. Note that rate limiting and disabling via sd_event_source_set_enabled() are independent of each other, and an event source will only effect event loop wake−ups and is dispatched while it both is enabled and rate limiting is not in effect. sd_event_source_get_ratelimit() may be used to query the current rate limiting parameters set on the event source object source. The previously set interval and burst vales are returned in the second and third argument. sd_event_source_is_ratelimited() may be used to query whether the event source is currently affected by rate limiting, i.e. it has recently hit the rate limit and is currently temporarily disabled due to that. sd_event_source_set_ratelimit_expire_callback may be used to set a callback function that is invoked every time the event source leaves rate limited state. Note that function is called in the same event loop iteration in which state transition occurred. Rate limiting is currently implemented for I/O, timer, signal, defer and inotify event sources.
RETURN VALUEOn success, sd_event_source_set_ratelimit(), sd_event_source_set_ratelimit_expire_callback and sd_event_source_get_ratelimit() return a non−negative integer. On failure, they return a negative errno−style error code. sd_event_source_is_ratelimited returns zero if rate limiting is currently not in effect and greater than zero if it is in effect; it returns a negative errno−style error code on failure.
ErrorsReturned errors may indicate the following problems: −EINVAL source is not a valid pointer to an sd_event_source object. −ECHILD The event loop has been created in a different process. −EDOM It was attempted to use the rate limiting feature on an event source type that does not support rate limiting. −ENOEXEC sd_event_source_get_ratelimit() was called on an event source that doesn't have rate limiting configured.
NOTESThese APIs are implemented as a shared library, which can be compiled and linked to with the libsystemd pkg-config(1) file.
SEE ALSOsd-event(3), sd_event_add_io(3), sd_event_add_time(3), sd_event_add_signal(3), sd_event_add_inotify(3), sd_event_add_defer(3), sd_event_source_set_enabled(3) 0
Johanes Gumabo
Data Size : 12,902 byte
man-sd_event_source_is_ratelimited.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 202,783
Visitor ID : :
Visitor IP : 18.118.195.30 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.