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

Unified Diff: fusl/src/fcntl/open.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/fcntl/fcntl.c ('k') | fusl/src/fcntl/openat.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/fcntl/open.c
diff --git a/fusl/src/fcntl/open.c b/fusl/src/fcntl/open.c
new file mode 100644
index 0000000000000000000000000000000000000000..3928a6e6696f05106e81bfd70a84210ce431e62a
--- /dev/null
+++ b/fusl/src/fcntl/open.c
@@ -0,0 +1,24 @@
+#include <fcntl.h>
+#include <stdarg.h>
+#include "syscall.h"
+#include "libc.h"
+
+int open(const char *filename, int flags, ...)
+{
+ mode_t mode = 0;
+
+ if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
+ va_list ap;
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
+
+ int fd = __sys_open_cp(filename, flags, mode);
+ if (fd>=0 && (flags & O_CLOEXEC))
+ __syscall(SYS_fcntl, fd, F_SETFD, FD_CLOEXEC);
+
+ return __syscall_ret(fd);
+}
+
+LFS64(open);
« no previous file with comments | « fusl/src/fcntl/fcntl.c ('k') | fusl/src/fcntl/openat.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698