When the same error condition occurs over and over, like in a DoS attack, or catastrophic networking
failure, or bad system configuration, or software botch, there is a risk that a PCP application could
generate a large number of identical diagnostic messages, filling up a log file and hence a filesystem.
__pmNotifyThrottle is intended to be used as a guard that can detect repeated calls for the same error
condition and allow the caller to stop issuing messages when repeated badness happens.
The error condition is identified by key and subkey, and the most common use case would be for these to
be __FILE__ and __LINE__ at the point where __pmNotifyThrottle is called.
For each unique key and subkey pair __pmNotifyThrottle maintains a count of the number of times it has
been called in the life of the calling process.
The return values are 0 if the throttle limit for key and subkey has not been reached, else 1 if the
throttle limit has been reached, else 2 if the throttle limit has been exceeded.
The same throttle limit as applied across all error conditions and set by the environment variable
PCP_NOTIFY_THROTTLE else a default of 10 if the environment variable is not set, although this can be
subsequently modified by calling __pmResetNotifyThrottle.
__pmResetNotifyThrottle may be used to reset the counter for an error condition to zero, so that
diagnostic output can be resumed if the caller determines it is safe to do so. If limit is greater than
zero then the limit for the error condition is also reset, otherwise the limit is unchanged.
Calling __pmResetNotifyThrottle with a key value of NULL will reset the counters (and possibly limits)
for all error conditions, and in this case if limit is greater than zero the default limit for any new
error conditions is also set (over-riding the default setting or the value initialized from the
PCP_NOTIFY_THROTTLE environment variable).
__pmResetNotifyThrottle will return -ENOENT if key and subkey does not match an existing error condition,
else the return value is the sum of the number of times the limit has been exceeded across all selected
error conditions.