Skip to content

Conversation

mleleszi
Copy link
Contributor

@mleleszi mleleszi commented Sep 28, 2025

#160404

  • Implement POSIX function "faccessat"
  • Remove redundant param in facessat syscall in access implementation, faccessat syscall does not take a flags arg

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@mleleszi mleleszi marked this pull request as ready for review September 28, 2025 09:42
@llvmbot llvmbot added the libc label Sep 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2025

@llvm/pr-subscribers-libc

Author: Marcell Leleszi (mleleszi)

Changes

#160404

  • Implement POSIX function "faccessat"
  • Remove redundant param in facessat syscall in access implementation, faccessat syscall does not take a flags arg

Full diff: https://github.com/llvm/llvm-project/pull/161065.diff

11 Files Affected:

  • (modified) libc/config/linux/aarch64/entrypoints.txt (+1)
  • (modified) libc/config/linux/x86_64/entrypoints.txt (+1)
  • (modified) libc/include/llvm-libc-macros/linux/fcntl-macros.h (+3)
  • (modified) libc/include/unistd.yaml (+9)
  • (modified) libc/src/unistd/CMakeLists.txt (+7)
  • (added) libc/src/unistd/faccessat.h (+21)
  • (modified) libc/src/unistd/linux/CMakeLists.txt (+14)
  • (modified) libc/src/unistd/linux/access.cpp (+1-1)
  • (added) libc/src/unistd/linux/faccessat.cpp (+38)
  • (modified) libc/test/src/unistd/CMakeLists.txt (+22)
  • (added) libc/test/src/unistd/faccessat_test.cpp (+172)
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index ae8deabc97407..cfb77911f3c2d 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -325,6 +325,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.dup2
     libc.src.unistd.dup3
     libc.src.unistd.execve
+    libc.src.unistd.faccessat
     libc.src.unistd.fchdir
     libc.src.unistd.fpathconf
     libc.src.unistd.fsync
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index bf2ad4a40ca11..87b78a337b875 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -331,6 +331,7 @@ set(TARGET_LIBC_ENTRYPOINTS
     libc.src.unistd.dup2
     libc.src.unistd.dup3
     libc.src.unistd.execve
+    libc.src.unistd.faccessat
     libc.src.unistd.fchdir
     libc.src.unistd.fpathconf
     libc.src.unistd.fsync
diff --git a/libc/include/llvm-libc-macros/linux/fcntl-macros.h b/libc/include/llvm-libc-macros/linux/fcntl-macros.h
index aec8a0d2da0b5..74d406f742f38 100644
--- a/libc/include/llvm-libc-macros/linux/fcntl-macros.h
+++ b/libc/include/llvm-libc-macros/linux/fcntl-macros.h
@@ -61,6 +61,9 @@
 // Allow empty relative pathname.
 #define AT_EMPTY_PATH 0x1000
 
+// Perform access checks using the effective user and group IDs.
+#define AT_EACCESS 0x200
+
 // Values of SYS_fcntl commands.
 #define F_DUPFD 0
 #define F_GETFD 1
diff --git a/libc/include/unistd.yaml b/libc/include/unistd.yaml
index 3ba3ec71c25ce..2ff86eafaf550 100644
--- a/libc/include/unistd.yaml
+++ b/libc/include/unistd.yaml
@@ -96,6 +96,15 @@ functions:
       - type: const char *
       - type: __exec_argv_t
       - type: __exec_envp_t
+  - name: faccessat
+    standards:
+      - POSIX
+    return_type: int
+    arguments:
+      - type: int
+      - type: const char *
+      - type: int
+      - type: int
   - name: fchdir
     standards:
       - POSIX
diff --git a/libc/src/unistd/CMakeLists.txt b/libc/src/unistd/CMakeLists.txt
index c66a3a4d0ed76..78c3bf8442fab 100644
--- a/libc/src/unistd/CMakeLists.txt
+++ b/libc/src/unistd/CMakeLists.txt
@@ -55,6 +55,13 @@ add_entrypoint_object(
     .${LIBC_TARGET_OS}.dup3
 )
 
+add_entrypoint_object(
+  faccessat
+  ALIAS
+  DEPENDS
+    .${LIBC_TARGET_OS}.faccessat
+)
+
 add_entrypoint_object(
   fchdir
   ALIAS
diff --git a/libc/src/unistd/faccessat.h b/libc/src/unistd/faccessat.h
new file mode 100644
index 0000000000000..578c22faff258
--- /dev/null
+++ b/libc/src/unistd/faccessat.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for faccessat ------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_UNISTD_FACCESSAT_H
+#define LLVM_LIBC_SRC_UNISTD_FACCESSAT_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int faccessat(int fd, const char *path, int amode, int flag);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_UNISTD_FACCESSAT_H
diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt
index 2d510f32d287d..0b67417475b71 100644
--- a/libc/src/unistd/linux/CMakeLists.txt
+++ b/libc/src/unistd/linux/CMakeLists.txt
@@ -80,6 +80,20 @@ add_entrypoint_object(
     libc.src.errno.errno
 )
 
+add_entrypoint_object(
+  faccessat
+  SRCS
+    faccessat.cpp
+  HDRS
+    ../faccessat.h
+  DEPENDS
+    libc.hdr.fcntl_macros
+    libc.include.unistd
+    libc.include.sys_syscall
+    libc.src.__support.OSUtil.osutil
+    libc.src.errno.errno
+)
+
 add_entrypoint_object(
   fchdir
   SRCS
diff --git a/libc/src/unistd/linux/access.cpp b/libc/src/unistd/linux/access.cpp
index 55cd6adca779d..f06eec5a8db6a 100644
--- a/libc/src/unistd/linux/access.cpp
+++ b/libc/src/unistd/linux/access.cpp
@@ -23,7 +23,7 @@ LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) {
   int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_access, path, mode);
 #elif defined(SYS_faccessat)
   int ret =
-      LIBC_NAMESPACE::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode, 0);
+      LIBC_NAMESPACE::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode);
 #else
 #error "access and faccessat syscalls not available."
 #endif
diff --git a/libc/src/unistd/linux/faccessat.cpp b/libc/src/unistd/linux/faccessat.cpp
new file mode 100644
index 0000000000000..f6efd9a887999
--- /dev/null
+++ b/libc/src/unistd/linux/faccessat.cpp
@@ -0,0 +1,38 @@
+//===-- Linux implementation of faccessat
+//------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/unistd/faccessat.h"
+
+#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/common.h"
+
+#include "hdr/fcntl_macros.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/config.h"
+#include <sys/syscall.h> // For syscall numbers.
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, faccessat,
+                   (int fd, const char *path, int amode, int flag)) {
+#ifdef SYS_faccessat2
+  int ret =
+      LIBC_NAMESPACE::syscall_impl<int>(SYS_faccessat2, fd, path, amode, flag);
+#else
+#error "faccessat2 syscall is not available."
+#endif
+
+  if (ret < 0) {
+    libc_errno = -ret;
+    return -1;
+  }
+  return 0;
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/unistd/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt
index 6630a7ef15e53..e03e4be7b0936 100644
--- a/libc/test/src/unistd/CMakeLists.txt
+++ b/libc/test/src/unistd/CMakeLists.txt
@@ -93,6 +93,28 @@ add_libc_unittest(
     libc.test.UnitTest.ErrnoSetterMatcher
 )
 
+add_libc_unittest(
+  faccessat_test
+  SUITE
+    libc_unistd_unittests
+  SRCS
+    faccessat_test.cpp
+  DEPENDS
+    libc.include.unistd
+    libc.src.__support.CPP.string
+    libc.src.sys.stat.mkdir
+    libc.src.errno.errno
+    libc.src.fcntl.open
+    libc.src.unistd.faccessat
+    libc.src.unistd.close
+    libc.src.unistd.symlink
+    libc.src.unistd.unlink
+    libc.src.unistd.unlinkat
+    libc.src.unistd.rmdir
+    libc.test.UnitTest.ErrnoCheckingTest
+    libc.test.UnitTest.ErrnoSetterMatcher
+)
+
 add_libc_unittest(
   fchdir_test
   SUITE
diff --git a/libc/test/src/unistd/faccessat_test.cpp b/libc/test/src/unistd/faccessat_test.cpp
new file mode 100644
index 0000000000000..2dff0b21cccfb
--- /dev/null
+++ b/libc/test/src/unistd/faccessat_test.cpp
@@ -0,0 +1,172 @@
+//===-- Unittests for faccessat -------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/__support/CPP/string.h"
+#include "src/fcntl/open.h"
+#include "src/sys/stat/mkdir.h"
+#include "src/unistd/close.h"
+#include "src/unistd/faccessat.h"
+#include "src/unistd/rmdir.h"
+#include "src/unistd/symlink.h"
+#include "src/unistd/unlink.h"
+#include "src/unistd/unlinkat.h"
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+namespace {
+
+namespace cpp = LIBC_NAMESPACE::cpp;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+
+using LlvmLibcFaccessatTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcFaccessatTest, WithAtFdcwd) {
+  // Test access checks on a file with AT_FDCWD and no flags, equivalent to
+  // access().
+  constexpr const char *FILENAME = "faccessat_basic.test";
+  auto TEST_FILE = libc_make_test_file_path(FILENAME);
+
+  // Check permissions on a file with full permissions
+  int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, F_OK, 0),
+              Succeeds(0));
+  ASSERT_THAT(
+      LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, X_OK | W_OK | R_OK, 0),
+      Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+
+  // Check permissions on a file with execute-only permission
+  fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IXUSR);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, F_OK, 0),
+              Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, X_OK, 0),
+              Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, R_OK, 0),
+              Fails(EACCES));
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, W_OK, 0),
+              Fails(EACCES));
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+
+  // Check permissions on a non existent file
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, F_OK, 0),
+              Fails(ENOENT));
+}
+
+TEST_F(LlvmLibcFaccessatTest, RelativePathWithDirFD) {
+  // Check permissions on a file releative to dir_fd
+  const cpp::string DIRNAME = "faccessat_dir";
+  const cpp::string FILENAME = "relative_file.txt";
+
+  auto TEST_DIR = libc_make_test_file_path(DIRNAME.data());
+  ASSERT_THAT(LIBC_NAMESPACE::mkdir(TEST_DIR, S_IRWXU), Succeeds(0));
+
+  int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_RDONLY | O_DIRECTORY);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(dir_fd, 0);
+
+  auto FULL_FILE_PATH =
+      libc_make_test_file_path((DIRNAME + "/" + FILENAME).data());
+  int fd = LIBC_NAMESPACE::open(FULL_FILE_PATH, O_WRONLY | O_CREAT, S_IRWXU);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+
+  ASSERT_THAT(
+      LIBC_NAMESPACE::faccessat(dir_fd, FILENAME.data(), R_OK | W_OK, 0),
+      Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::unlinkat(dir_fd, FILENAME.data(), 0),
+              Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0));
+}
+
+TEST_F(LlvmLibcFaccessatTest, SymlinkNoFollow) {
+  // Check permissions on a symlink itself, not what it links to
+  constexpr const char *TARGET = "faccessat_target";
+  constexpr const char *SYMLINK = "faccessat_link";
+  auto TEST_TARGET = libc_make_test_file_path(TARGET);
+  auto TEST_SYMLINK = libc_make_test_file_path(SYMLINK);
+
+  int fd = LIBC_NAMESPACE::open(TEST_TARGET, O_WRONLY | O_CREAT, 0);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::symlink(TARGET, TEST_SYMLINK), Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_SYMLINK, R_OK, 0),
+              Fails(EACCES));
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_SYMLINK, F_OK,
+                                        AT_SYMLINK_NOFOLLOW),
+              Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_SYMLINK), Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_TARGET), Succeeds(0));
+}
+
+TEST_F(LlvmLibcFaccessatTest, AtEaccess) {
+  // With AT_EACCESS, faccessat checks permissions using the effective user ID,
+  // but the effective and real user ID will be the same here and changing that
+  // is not feasible in a test, so this is just a basic sanity check.
+  constexpr const char *FILENAME = "faccessat_eaccess.test";
+  auto TEST_FILE = libc_make_test_file_path(FILENAME);
+
+  int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, TEST_FILE, X_OK | W_OK | R_OK,
+                                        AT_EACCESS),
+              Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+}
+
+TEST_F(LlvmLibcFaccessatTest, AtEmptyPath) {
+  constexpr const char *FILENAME = "faccessat_atemptypath.test";
+  auto TEST_FILE = libc_make_test_file_path(FILENAME);
+
+  int fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU);
+  ASSERT_ERRNO_SUCCESS();
+  ASSERT_GT(fd, 0);
+
+  // Check permissions on the file referred to by fd
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(fd, "", F_OK, AT_EMPTY_PATH),
+              Succeeds(0));
+  ASSERT_THAT(
+      LIBC_NAMESPACE::faccessat(fd, "", X_OK | W_OK | R_OK, AT_EMPTY_PATH),
+      Succeeds(0));
+
+  ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0));
+
+  // Check permissions on the current working directory
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, "", F_OK, AT_EMPTY_PATH),
+              Succeeds(0));
+  ASSERT_THAT(LIBC_NAMESPACE::faccessat(AT_FDCWD, "", X_OK | W_OK | R_OK,
+                                        AT_EMPTY_PATH),
+              Succeeds(0));
+}
+
+} // namespace

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, a few comments but mostly formatting

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is failing on the presubmits, probably because SYS_faccessat2 isn't listed in libc/include/sys/syscall.h.def. You'll probably need to add that to the list.

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with one last cleanup, once that's done I'll approve. Do you need me to merge this for you?

@mleleszi
Copy link
Contributor Author

mleleszi commented Oct 2, 2025

Looks good with one last cleanup, once that's done I'll approve. Do you need me to merge this for you?

Yes, can you merge please, I don't think I can merge yet

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will merge after the presubmits finish

@michaelrj-google michaelrj-google merged commit 44d471e into llvm:main Oct 2, 2025
17 of 18 checks passed
Copy link

github-actions bot commented Oct 2, 2025

@mleleszi Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 2, 2025

LLVM Buildbot has detected a new failure on builder libc-aarch64-ubuntu-dbg running on libc-aarch64-ubuntu while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/104/builds/32643

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Set CPU features: FullFP16
-- Compiler features available: builtin_ceil_floor_rint_trunc;builtin_fmax_fmin;builtin_fmaxf16_fminf16;builtin_round;cfloat128;float128;float16
-- Using getrandom for hashtable randomness
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/3] Building CXX object libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.faccessat.dir/faccessat.cpp.o
FAILED: libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.faccessat.dir/faccessat.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.faccessat.dir/faccessat.cpp.o -MF libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.faccessat.dir/faccessat.cpp.o.d -o libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.faccessat.dir/faccessat.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:27:2: error: "faccessat2 syscall is not available."
#error "faccessat2 syscall is not available."
 ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:30:7: error: use of undeclared identifier 'ret'
  if (ret < 0) {
      ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:31:19: error: use of undeclared identifier 'ret'
    libc_errno = -ret;
                  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:22:25: error: unused parameter 'fd' [-Werror,-Wunused-parameter]
                   (int fd, const char *path, int amode, int flag)) {
                        ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:22:41: error: unused parameter 'path' [-Werror,-Wunused-parameter]
                   (int fd, const char *path, int amode, int flag)) {
                                        ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:22:51: error: unused parameter 'amode' [-Werror,-Wunused-parameter]
                   (int fd, const char *path, int amode, int flag)) {
                                                  ^
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/unistd/linux/faccessat.cpp:22:62: error: unused parameter 'flag' [-Werror,-Wunused-parameter]
                   (int fd, const char *path, int amode, int flag)) {
                                                             ^
7 errors generated.
[2/3] Building CXX object libc/src/unistd/linux/CMakeFiles/libc.src.unistd.linux.access.dir/access.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
llvm#160404

- Implement POSIX function "faccessat"
- Remove redundant param in facessat syscall in access implementation,
faccessat syscall does not take a flags arg
@mleleszi mleleszi deleted the libc-faccessat branch October 3, 2025 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants