| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <sys/resource.h> /* IWYU pragma: export */ |
| 5 |
|
| 6 |
#include "basic-forward.h" |
| 7 |
|
| 8 |
#define _RLIMIT_MAX RLIMIT_NLIMITS |
| 9 |
|
| 10 |
DECLARE_STRING_TABLE_LOOKUP(rlimit, int); |
| 11 |
int rlimit_from_string_harder(const char *s) _pure_; |
| 12 |
void rlimits_list(const char *prefix); |
| 13 |
|
| 14 |
int setrlimit_closest(int resource, const struct rlimit *rlim); |
| 15 |
int setrlimit_closest_all(const struct rlimit * const *rlim, int *which_failed); |
| 16 |
|
| 17 |
int rlimit_parse_one(int resource, const char *val, rlim_t *ret); |
| 18 |
int rlimit_parse(int resource, const char *val, struct rlimit *ret); |
| 19 |
|
| 20 |
int rlimit_format(const struct rlimit *rl, char **ret); |
| 21 |
|
| 22 |
int rlimit_copy_all(struct rlimit* target[static _RLIMIT_MAX], struct rlimit* const source[static _RLIMIT_MAX]); |
| 23 |
void rlimit_free_all(struct rlimit **rl); |
| 24 |
|
| 25 |
#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim }) |
| 26 |
|
| 27 |
int rlimit_nofile_bump(int limit); |
| 28 |
int rlimit_nofile_safe(void); |
| 29 |
|
| 30 |
int pid_getrlimit(pid_t pid, int resource, struct rlimit *ret); |