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

Side by Side Diff: fusl/src/unistd/dup2.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 unified diff | Download patch
OLDNEW
1 #include <unistd.h> 1 #include <unistd.h>
2 #include <errno.h> 2 #include <errno.h>
3 #include <fcntl.h> 3 #include <fcntl.h>
4 #include "syscall.h" 4 #include "syscall.h"
5 5
6 int dup2(int old, int new) 6 int dup2(int old, int new) {
7 { 7 int r;
8 » int r;
9 #ifdef SYS_dup2 8 #ifdef SYS_dup2
10 » while ((r=__syscall(SYS_dup2, old, new))==-EBUSY); 9 while ((r = __syscall(SYS_dup2, old, new)) == -EBUSY)
10 ;
11 #else 11 #else
12 » if (old==new) { 12 if (old == new) {
13 » » r = __syscall(SYS_fcntl, old, F_GETFD); 13 r = __syscall(SYS_fcntl, old, F_GETFD);
14 » » if (r >= 0) return old; 14 if (r >= 0)
15 » } else { 15 return old;
16 » » while ((r=__syscall(SYS_dup3, old, new, 0))==-EBUSY); 16 } else {
17 » } 17 while ((r = __syscall(SYS_dup3, old, new, 0)) == -EBUSY)
18 ;
19 }
18 #endif 20 #endif
19 » return __syscall_ret(r); 21 return __syscall_ret(r);
20 } 22 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698