xiaoxiang781216 opened a new pull request, #20035: URL: https://github.com/apache/nuttx/pull/20035
## Summary Add the Linux `statx(2)` extended-status interface to the libc as a composition of the existing `stat`/`lstat`/`fstat`/`fstatat` implementations, following the `fstatat()` pattern: - `include/sys/stat.h`: expose the exact Linux `struct statx` / `struct statx_timestamp` ABI (fixed-width fields, so the layout is stable across toolchains and a future kernel-space implementation will not break the user-space ABI), the `STATX_*` request/result mask constants, and the `STATX_ATTR_*` attribute constants. - `include/fcntl.h`: add the `AT_STATX_SYNC_AS_STAT` / `AT_STATX_FORCE_SYNC` / `AT_STATX_DONT_SYNC` / `AT_STATX_SYNC_TYPE` and `AT_RECURSIVE` constants. - `libs/libc/misc/lib_statx.c`: implement `statx()` by resolving the path like `fstatat()` (via `lib_getfullpath()`) and translating the resulting `struct stat` into the `struct statx` layout. Semantics: NuttX can only fill `STATX_BASIC_STATS`; birth time, mount ID and DIO alignment stay zero with their mask bits clear. `AT_EMPTY_PATH` is handled via `fstat()`, `AT_STATX_SYNC_*` and `AT_NO_AUTOMOUNT` are accepted as no-ops, and the `mask` argument is treated as a hint, which Linux also permits (the kernel may return more or fewer fields than requested). Ported code that uses `statx()` (libuv, glib, libfuse, ...) now builds and runs unchanged. ## Impact - New libc API, no existing behavior is changed. `struct stat`, `stat()`, `lstat()`, `fstat()` and `fstatat()` are untouched. - No new Kconfig options; `statx()` is always available like the other stat family members. - Impact on size: one new small object file in libc (`lib_statx.c`). - Testing covered by build + boot below; the LTP statx testcases compile against this interface (they need `/proc/mounts` at runtime, so they are black-listed in the LTP port for now). ## Testing Built and booted `sim:nsh` with this change on top of apache/master (commit `035d131b3cc`): ``` NuttShell (NSH) NuttX-10.4.0 nsh> uname -a NuttX 10.4.0 035d131b3cc Sep 1 2026 21:37:48 sim sim ``` `ostest` passes with 0 failures: ``` ostest_main: Started user_main at PID=6 user_main: Begin argument test ... user_main: Exiting ostest_main: Exiting with status 0 ``` `tools/checkpatch.sh -c -u -m -g apache/master..HEAD` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
