Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: fusl/src/linux/prlimit.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/linux/prctl.c ('k') | fusl/src/linux/process_vm.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #define _GNU_SOURCE
2 #include <sys/resource.h>
3 #include "syscall.h"
4 #include "libc.h"
5
6 #define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0)
7
8 int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlim it *old_limit)
9 {
10 struct rlimit tmp;
11 int r;
12 if (new_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
13 tmp = *new_limit;
14 FIX(tmp.rlim_cur);
15 FIX(tmp.rlim_max);
16 new_limit = &tmp;
17 }
18 r = syscall(SYS_prlimit64, pid, resource, new_limit, old_limit);
19 if (!r && old_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
20 FIX(old_limit->rlim_cur);
21 FIX(old_limit->rlim_max);
22 }
23 return r;
24 }
25
26 #undef prlimit64
27 LFS64(prlimit);
OLDNEW
« no previous file with comments | « fusl/src/linux/prctl.c ('k') | fusl/src/linux/process_vm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698