Warning: That file was not part of the compilation database. It may have many parsing errors.
| 1 | /* SPDX-License-Identifier: LGPL-2.1 OR MIT */ |
|---|---|
| 2 | /* |
| 3 | * Resource definitions for NOLIBC |
| 4 | * Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu> |
| 5 | */ |
| 6 | |
| 7 | /* make sure to include all global symbols */ |
| 8 | #include "../nolibc.h" |
| 9 | |
| 10 | #ifndef _NOLIBC_SYS_RESOURCE_H |
| 11 | #define _NOLIBC_SYS_RESOURCE_H |
| 12 | |
| 13 | #include "../sys.h" |
| 14 | |
| 15 | #include <linux/resource.h> |
| 16 | |
| 17 | /* |
| 18 | * int getrlimit(int resource, struct rlimit *rlim); |
| 19 | * int setrlimit(int resource, const struct rlimit *rlim); |
| 20 | */ |
| 21 | |
| 22 | static __attribute__((unused)) |
| 23 | int sys_prlimit64(pid_t pid, int resource, |
| 24 | const struct rlimit64 *new_limit, struct rlimit64 *old_limit) |
| 25 | { |
| 26 | return my_syscall4(__NR_prlimit64, pid, resource, new_limit, old_limit); |
| 27 | } |
| 28 | |
| 29 | static __attribute__((unused)) |
| 30 | int getrlimit(int resource, struct rlimit *rlim) |
| 31 | { |
| 32 | struct rlimit64 rlim64; |
| 33 | int ret; |
| 34 | |
| 35 | ret = __sysret(sys_prlimit64(0, resource, NULL, &rlim64)); |
| 36 | rlim->rlim_cur = rlim64.rlim_cur; |
| 37 | rlim->rlim_max = rlim64.rlim_max; |
| 38 | |
| 39 | return ret; |
| 40 | } |
| 41 | |
| 42 | static __attribute__((unused)) |
| 43 | int setrlimit(int resource, const struct rlimit *rlim) |
| 44 | { |
| 45 | struct rlimit64 rlim64 = { |
| 46 | .rlim_cur = rlim->rlim_cur, |
| 47 | .rlim_max = rlim->rlim_max, |
| 48 | }; |
| 49 | |
| 50 | return __sysret(sys_prlimit64(0, resource, &rlim64, NULL)); |
| 51 | } |
| 52 | |
| 53 | #endif /* _NOLIBC_SYS_RESOURCE_H */ |
| 54 |
Warning: That file was not part of the compilation database. It may have many parsing errors.
