summaryrefslogtreecommitdiffstats
path: root/src/journal/journald-rate-limit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-9/+11
|
* basic/util: rename u64log2 to log2u64Zbigniew Jędrzejewski-Szmek2021-11-261-1/+1
| | | | | u64log2 was strangely named. We even have log2i and log2u right below in that file.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* journald: specifying _pure_ on static functions is unnecessary, compiler can ↵Lennart Poettering2020-01-311-1/+1
| | | | figure that out on its own
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: say "ratelimit" not "rate_limit"Zbigniew Jędrzejewski-Szmek2019-09-201-13/+13
| | | | | | "ratelimit" is a real word, so we don't need to use the other form anywhere. We had both forms in various places, let's standarize on the shorter and more correct one.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-1/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* core: implement per unit journal rate limitingAnita Zhang2018-10-181-19/+19
| | | | | | | | | Add LogRateLimitIntervalSec= and LogRateLimitBurst= options for services. If provided, these values get passed to the journald client context, and those values are used in the rate limiting function in the journal over the the journald.conf values. Part of #10230
* siphash24: add helper for calculating the hash value for a stringLennart Poettering2018-10-161-8/+2
| | | | Let's shorten some code.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* journald: add comment explaining journal rate limit return codesLennart Poettering2017-07-311-0/+7
| | | | This is not obvious, hence let's add a comment.
* journald, ratelimit: fix inaccurate message suppression in ↵Yuki Inoguchi2016-10-061-1/+1
| | | | | | | | journal_rate_limit_test() (#4291) Currently, the ratelimit does not handle the number of suppressed messages accurately. Even though the number of messages reaches the limit, it still allows to add one extra messages to journal. This patch fixes the problem.
* journald,ratelimit: fix wrong calculation of burst_modulate() (#4218)HATAYAMA Daisuke2016-09-261-1/+1
| | | | | | | | | | | | | | | | This patch fixes wrong calculation of burst_modulate(), which now calculates the values smaller than really expected ones if available disk space is strictly more than 1MB. In particular, if available disk space is strictly more than 1MB and strictly less than 16MB, the resulted value becomes smaller than its original one. >>> (math.log2(1*1024**2)-16) / 4 1.0 >>> (math.log2(16*1024**2)-16) / 4 2.0 >>> (math.log2(256*1024**2)-16) / 4 3.0 → This matches the comment in the function.
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2016-02-231-2/+2
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* Merge pull request #1923 from zonque/siphashLennart Poettering2015-11-171-2/+2
|\ | | | | siphash24: let siphash24_finalize() and siphash24() return the result…
| * siphash24: let siphash24_finalize() and siphash24() return the result directlyDaniel Mack2015-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | Rather than passing a pointer to return the result, return it directly from the function calls. Also, return the result in native endianess, and let the callers care about the conversion. For hash tables and bloom filters, we don't care, but in order to keep MAC addresses and DHCP client IDs stable, we explicitly convert to LE.
* | tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-1/+1
|/ | | | Sort the includes accoding to the new coding style.
* siphash24: change result argument to uint64_tMartin Pitt2015-11-161-2/+2
| | | | | | | | | | | | Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which enforce pointer alignment this fixes crashes when we previously cast an unaligned array to uint64_t*, and on others this should at least improve performance as the compiler now aligns these properly. This also simplifies the code in most cases by getting rid of typecasts. The only place which we can't change is struct duid's en.id, as that is _packed_ and public API, so we can't enforce alignment of the "id" field and have to use memcpy instead.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-4/+5
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* siphash24: unify APITom Gundersen2015-10-061-6/+6
| | | | | | | Make the API of the new helpers more similar to the old wrapper. In particular we now return the hash as a byte string to avoid any endianness problems.
* hashmap: refactor hash_funcTom Gundersen2015-10-051-2/+8
| | | | | | | | | | | | All our hash functions are based on siphash24(), factor out siphash_init() and siphash24_finalize() and pass the siphash state to the hash functions rather than the hash key. This simplifies the hash functions, and in particular makes composition simpler as calling siphash24_compress() repeatedly on separate chunks of input has the same effect as first concatenating the input and then calling siphash23_compress() on the result.
* shared: add random-util.[ch]Ronny Chevalier2015-04-111-0/+1
|
* shared: switch our hash table implementation over to SipHashLennart Poettering2013-12-221-4/+8
| | | | | SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
* list: make our list macros a bit easier to use by not requring type spec on ↵Lennart Poettering2013-10-141-4/+4
| | | | | | | each invocation We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
* Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek2013-05-031-1/+1
| | | | | | | | I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
* journal: u64log2 can be expressed just as __builtin_clzll(n) ^ 63UCristian Rodríguez2013-04-051-15/+0
|
* journal: the ratelimiter is part of journaldLennart Poettering2012-08-221-0/+275