forked from OSchip/llvm-project
[libc] Add a few missing deps, includes, and fix a few typos.
This allows us to enable rmdir, mkdir, mkdirat, unlink and unlinkat for aarch64.
This commit is contained in:
parent
3b8ffe668d
commit
be7c865af1
libc
config/linux/aarch64
src
test/src
|
@ -81,10 +81,17 @@ set(TARGET_LIBC_ENTRYPOINTS
|
|||
libc.src.stdlib.strtoul
|
||||
libc.src.stdlib.strtoull
|
||||
|
||||
# sys/stat.h entrypoints
|
||||
libc.src.sys.stat.mkdir
|
||||
libc.src.sys.stat.mkdirat
|
||||
|
||||
# unistd.h entrypoints
|
||||
libc.src.unistd.close
|
||||
libc.src.unistd.fsync
|
||||
libc.src.unistd.read
|
||||
libc.src.unistd.rmdir
|
||||
libc.src.unistd.unlink
|
||||
libc.src.unistd.unlinkat
|
||||
libc.src.unistd.write
|
||||
)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ add_entrypoint_object(
|
|||
HDRS
|
||||
../mkdir.h
|
||||
DEPENDS
|
||||
libc.include.fcntl
|
||||
libc.include.sys_stat
|
||||
libc.include.sys_syscall
|
||||
libc.src.__support.OSUtil.osutil
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "src/__support/common.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h> // For syscall numbers.
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ add_entrypoint_object(
|
|||
HDRS
|
||||
../rmdir.h
|
||||
DEPENDS
|
||||
libc.include.fcntl
|
||||
libc.include.unistd
|
||||
libc.include.sys_syscall
|
||||
libc.src.__support.OSUtil.osutil
|
||||
|
@ -57,6 +58,7 @@ add_entrypoint_object(
|
|||
HDRS
|
||||
../unlink.h
|
||||
DEPENDS
|
||||
libc.include.fcntl
|
||||
libc.include.unistd
|
||||
libc.include.sys_syscall
|
||||
libc.src.__support.OSUtil.osutil
|
||||
|
@ -70,6 +72,7 @@ add_entrypoint_object(
|
|||
HDRS
|
||||
../unlinkat.h
|
||||
DEPENDS
|
||||
libc.include.fcntl
|
||||
libc.include.unistd
|
||||
libc.include.sys_syscall
|
||||
libc.src.__support.OSUtil.osutil
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "src/__support/common.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h> // For syscall numbers.
|
||||
|
||||
namespace __llvm_libc {
|
||||
|
@ -20,7 +21,7 @@ LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) {
|
|||
#ifdef SYS_rmdir
|
||||
long ret = __llvm_libc::syscall(SYS_rmdir, path);
|
||||
#elif defined(SYS_unlinkat)
|
||||
long ret = __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, path, 0);
|
||||
long ret = __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
|
||||
#else
|
||||
#error "rmdir and unlinkat syscalls not available."
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "src/__support/common.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h> // For syscall numbers.
|
||||
|
||||
namespace __llvm_libc {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "src/__support/common.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h> // For syscall numbers.
|
||||
|
||||
namespace __llvm_libc {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "utils/testutils/FDReader.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
TEST(LlvmLibcUniStd, OpenAndReadTest) {
|
||||
using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
TEST(LlvmLibcMkdiratTest, CreateAndRemove) {
|
||||
using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
|
||||
constexpr const char *TEST_DIR = "testdata/rmdir.testdir";
|
||||
constexpr const char *TEST_DIR = "testdata/mkdirat.testdir";
|
||||
ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0));
|
||||
ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue