/* On EINTR try a couple of times more, but protect against busy looping
* (not more than 16 times per 10s) */
- rl = (RateLimit) { 10 * USEC_PER_SEC, 16 };
+ rl = (const RateLimit) { 10 * USEC_PER_SEC, 16 };
while (ratelimit_below(&rl)) {
r = posix_fallocate(fd, offset, size);
if (r != EINTR)
}
/* Reboot immediately if the user hits C-A-D more often than 7x per 2s */
- m->ctrl_alt_del_ratelimit = (RateLimit) { .interval = 2 * USEC_PER_SEC, .burst = 7 };
+ m->ctrl_alt_del_ratelimit = (const RateLimit) { .interval = 2 * USEC_PER_SEC, .burst = 7 };
r = manager_default_environment(m);
if (r < 0)
u->last_section_private = -1;
u->start_ratelimit = (RateLimit) { m->default_start_limit_interval, m->default_start_limit_burst };
- u->auto_start_stop_ratelimit = (RateLimit) { 10 * USEC_PER_SEC, 16 };
+ u->auto_start_stop_ratelimit = (const RateLimit) { 10 * USEC_PER_SEC, 16 };
return u;
}
(void) mkdir_parents_label(dest, 0700);
- progress.limit = (RateLimit) { 200*USEC_PER_MSEC, 1 };
+ progress.limit = (const RateLimit) { 200*USEC_PER_MSEC, 1 };
{
BLOCK_SIGNALS(SIGINT, SIGTERM);
#define IDLE_TIMEOUT_USEC (30*USEC_PER_SEC)
-#define FAILED_TO_WRITE_ENTRY_RATELIMIT ((RateLimit) { .interval = 1 * USEC_PER_SEC, .burst = 1 })
+#define FAILED_TO_WRITE_ENTRY_RATELIMIT ((const RateLimit) { .interval = 1 * USEC_PER_SEC, .burst = 1 })
static int determine_path_usage(
Server *s,
#include "time-util.h"
#include "varlink.h"
-#define JOURNALD_LOG_RATELIMIT ((RateLimit) { .interval = 60 * USEC_PER_SEC, .burst = 3 })
+#define JOURNALD_LOG_RATELIMIT ((const RateLimit) { .interval = 60 * USEC_PER_SEC, .burst = 3 })
typedef enum Storage {
STORAGE_AUTO,
/* Ideally this would be a function parameter but initializers for static fields have to be compile
* time constants so we hardcode the interval instead. */
-#define LOG_RATELIMIT ((RateLimit) { .interval = 60 * USEC_PER_SEC, .burst = 3 })
+#define LOG_RATELIMIT ((const RateLimit) { .interval = 60 * USEC_PER_SEC, .burst = 3 })
bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log_level) {
assert(f);
log_debug("New scope on link %s, protocol %s, family %s", l ? l->ifname : "*", dns_protocol_to_string(protocol), family == AF_UNSPEC ? "*" : af_to_name(family));
/* Enforce ratelimiting for the multicast protocols */
- s->ratelimit = (RateLimit) { MULTICAST_RATELIMIT_INTERVAL_USEC, MULTICAST_RATELIMIT_BURST };
+ s->ratelimit = (const RateLimit) { MULTICAST_RATELIMIT_INTERVAL_USEC, MULTICAST_RATELIMIT_BURST };
*ret = s;
return 0;
for (i = 0; i < 10; i++)
assert_se(ratelimit_below(&ratelimit));
- ratelimit = (RateLimit) { 0, 10 };
+ ratelimit = (const RateLimit) { 0, 10 };
for (i = 0; i < 10000; i++)
assert_se(ratelimit_below(&ratelimit));
}
.server_socket = -1,
- .ratelimit = (RateLimit) {
+ .ratelimit = (const RateLimit) {
RATELIMIT_INTERVAL_USEC,
RATELIMIT_BURST
},