diff options
author | Siva Chandra <sivachandra@google.com> | 2022-01-28 11:41:26 -0800 |
---|---|---|
committer | Siva Chandra <sivachandra@google.com> | 2022-01-28 12:06:08 -0800 |
commit | 0e91c48df0a2351a82bde2d9cb350872914bddce (patch) | |
tree | b434d7071c15d52eddc864f2d2b4435bfa85c177 /libc/src/fcntl | |
parent | 86797fdb6f51d32f285e48b6d3e0fc5b8b852734 (diff) | |
download | llvm-0e91c48df0a2351a82bde2d9cb350872914bddce.zip llvm-0e91c48df0a2351a82bde2d9cb350872914bddce.tar.gz llvm-0e91c48df0a2351a82bde2d9cb350872914bddce.tar.bz2 |
[libc] Enable creat, fsync, open, openat, read and write for aarch64.
Diffstat (limited to 'libc/src/fcntl')
-rw-r--r-- | libc/src/fcntl/linux/creat.cpp | 6 | ||||
-rw-r--r-- | libc/src/fcntl/linux/open.cpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp index 50b5d5e..9bca317 100644 --- a/libc/src/fcntl/linux/creat.cpp +++ b/libc/src/fcntl/linux/creat.cpp @@ -18,8 +18,14 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { +#ifdef SYS_open int fd = __llvm_libc::syscall(SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); +#else + int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, path, + O_CREAT | O_WRONLY | O_TRUNC, mode_flags); +#endif + if (fd > 0) return fd; diff --git a/libc/src/fcntl/linux/open.cpp b/libc/src/fcntl/linux/open.cpp index 71872b2..3b8e08a 100644 --- a/libc/src/fcntl/linux/open.cpp +++ b/libc/src/fcntl/linux/open.cpp @@ -29,7 +29,11 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { va_end(varargs); } +#ifdef SYS_open int fd = __llvm_libc::syscall(SYS_open, path, flags, mode_flags); +#else + int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, path, flags, mode_flags); +#endif if (fd > 0) return fd; |