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

Unified Diff: fusl/src/linux/prlimit.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: fusl/src/linux/prlimit.c
diff --git a/fusl/src/linux/prlimit.c b/fusl/src/linux/prlimit.c
index 0fe28e10664e9047b1ca1a75bdab78c3e0407723..5d2097a82c773760564d92d05965dc287bc29c5e 100644
--- a/fusl/src/linux/prlimit.c
+++ b/fusl/src/linux/prlimit.c
@@ -3,24 +3,30 @@
#include "syscall.h"
#include "libc.h"
-#define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0)
+#define FIX(x) \
+ do { \
+ if ((x) >= SYSCALL_RLIM_INFINITY) \
+ (x) = RLIM_INFINITY; \
+ } while (0)
-int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit)
-{
- struct rlimit tmp;
- int r;
- if (new_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
- tmp = *new_limit;
- FIX(tmp.rlim_cur);
- FIX(tmp.rlim_max);
- new_limit = &tmp;
- }
- r = syscall(SYS_prlimit64, pid, resource, new_limit, old_limit);
- if (!r && old_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
- FIX(old_limit->rlim_cur);
- FIX(old_limit->rlim_max);
- }
- return r;
+int prlimit(pid_t pid,
+ int resource,
+ const struct rlimit* new_limit,
+ struct rlimit* old_limit) {
+ struct rlimit tmp;
+ int r;
+ if (new_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
+ tmp = *new_limit;
+ FIX(tmp.rlim_cur);
+ FIX(tmp.rlim_max);
+ new_limit = &tmp;
+ }
+ r = syscall(SYS_prlimit64, pid, resource, new_limit, old_limit);
+ if (!r && old_limit && SYSCALL_RLIM_INFINITY != RLIM_INFINITY) {
+ FIX(old_limit->rlim_cur);
+ FIX(old_limit->rlim_max);
+ }
+ return r;
}
#undef prlimit64

Powered by Google App Engine
This is Rietveld 408576698