This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add implementation of functions stat, fstat and lstat.
ClosedPublic

Authored by sivachandra on Sep 20 2022, 1:21 AM.

Details

Summary

All supporting type and macro definitions have also been added.

Diff Detail

Event Timeline

sivachandra created this revision.Sep 20 2022, 1:21 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 20 2022, 1:21 AM
sivachandra requested review of this revision.Sep 20 2022, 1:21 AM

Is this error in the CI fixed with your latest revision yet?

In file included from /var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/stat.cpp:10:
/var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/kernel_statx.h:66:24: error: expected unqualified-id
constexpr unsigned int STATX_BASIC_STATS = 0x7FF;
                       ^
/usr/include/linux/stat.h:152:27: note: expanded from macro 'STATX_BASIC_STATS'
#define STATX_BASIC_STATS       0x000007ffU     /* The stuff in the normal stat struct */
                                ^
In file included from /var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/stat.cpp:10:
/var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/kernel_statx.h:76:55: error: expected unqualified-id
  long ret = syscall(SYS_statx, dirfd, path, flags, ::STATX_BASIC_STATS, &xbuf);
                                                      ^
/usr/include/linux/stat.h:152:27: note: expanded from macro 'STATX_BASIC_STATS'
#define STATX_BASIC_STATS       0x000007ffU     /* The stuff in the normal stat struct */
                                ^
2 errors generated.

Rename a mask to avoid conflict with name in linux headers.

Is this error in the CI fixed with your latest revision yet?

In file included from /var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/stat.cpp:10:
/var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/kernel_statx.h:66:24: error: expected unqualified-id
constexpr unsigned int STATX_BASIC_STATS = 0x7FF;
                       ^
/usr/include/linux/stat.h:152:27: note: expanded from macro 'STATX_BASIC_STATS'
#define STATX_BASIC_STATS       0x000007ffU     /* The stuff in the normal stat struct */
                                ^
In file included from /var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/stat.cpp:10:
/var/lib/buildkite-agent/builds/llvm-project/libc/src/sys/stat/linux/kernel_statx.h:76:55: error: expected unqualified-id
  long ret = syscall(SYS_statx, dirfd, path, flags, ::STATX_BASIC_STATS, &xbuf);
                                                      ^
/usr/include/linux/stat.h:152:27: note: expanded from macro 'STATX_BASIC_STATS'
#define STATX_BASIC_STATS       0x000007ffU     /* The stuff in the normal stat struct */
                                ^
2 errors generated.

This should be fixed now.

lntue accepted this revision.Sep 21 2022, 10:14 AM
This revision is now accepted and ready to land.Sep 21 2022, 10:14 AM
This revision was landed with ongoing or failed builds.Sep 21 2022, 11:35 AM
This revision was automatically updated to reflect the committed changes.