Shanks0224 opened a new pull request, #22183: URL: https://github.com/apache/nuttx/pull/22183
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary - `pathconf()`/`fpathconf()` support the `_PC_xxx` names, including `_PC_NO_TRUNC`. - Make `getopt_long_option()` weak so it can be garbage collected when only `getopt()` is used. - Build `truncate()` and `posix_fallocate()` unconditionally. - Add `fallocate()` and implement `posix_fallocate()` on it. - `fallocate()` and `posix_fallocate()` return EINVAL for a zero length, as POSIX and Linux `fallocate(2)` require. - Add `statx()`. ## Impact - New functions only add symbols. - `posix_fallocate(fd, offset, 0)` now returns EINVAL instead of success. - The weak `getopt_long_option()` lets the linker drop the long-option code in programs that do not use it. - No impact on documentation or hardware. ## Testing Build host: Linux x86_64. `sim:nsh`, builds with no warning; a test program checks: - `fallocate()`: extends a file, leaves the size alone for a range inside the file, `FALLOC_FL_KEEP_SIZE` keeps the size, negative offset and zero length give EINVAL, a bad descriptor gives EBADF; `posix_fallocate()` returns the error number instead of -1. - `statx()` against `stat()` (size, mode, link count, mtime), relative to a directory descriptor, with `AT_EMPTY_PATH`, and ENOENT for a missing file. - `pathconf()`: `_PC_NO_TRUNC` and `_PC_CHOWN_RESTRICTED` are 1, an invalid name gives EINVAL. - `getopt()` and `getopt_long()` still parse short and long options. - The `fallocate()` and `pathconf()` results agree with glibc on the host. - A program that only calls `getopt()` has 208 bytes less text. -- 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]
