casaroli opened a new pull request, #20729: URL: https://github.com/apache/nuttx/pull/20729
## Summary Pipes and FIFOs exist only in the pseudo file system. `inode_reserve()` returns `-EEXIST` when a path lies inside a mounted file system, because it does not look into the mount. So `mkfifo()` of a path on a tmpfs, hostfs or v9fs mount failed with `EEXIST` although nothing exists at that path, and a caller that sees `EEXIST` thinks the file is there. `register_pipedriver()` now checks the path with `nx_stat()` when `inode_reserve()` returns `-EEXIST`. If no file exists, it returns `-EPERM`; if a file exists (in the pseudo file system or in the mount), the result stays `-EEXIST`. `inode_reserve()` itself does not change. `EPERM` is what Linux returns from `mknod()`/`mkfifo()` when the file system does not support the node type (for example vfat), and POSIX lists `EPERM` for `mknod()`. A second commit documents the behaviour in `Documentation/reference/user/10_filesystem.rst`. ## Impact Only the error code of `mkfifo()` (and `pipe` registration) for a path inside a mount point changes: `EPERM` instead of `EEXIST` when nothing exists there. A path with a missing parent directory inside a mount also gives `EPERM`, not `ENOENT`. ## Testing `qemu-armv8a:knsh` with `CONFIG_PIPES` and `CONFIG_FS_TMPFS`, QEMU 11 with HVF on an Apple M4, a test program: | check | master | this PR | |---|---|---| | `mkfifo()` in a tmpfs mount | `EEXIST` | `EPERM` | | `mkfifo()` in `/system` (v9fs) | `EEXIST` | `EPERM` | | `mkfifo()` in `/dev` (pseudo file system) | ok | ok | | `mkfifo()` twice on the same path | `EEXIST` | `EEXIST` | | `mkfifo()` on the mount point / on an existing file in the mount | `EEXIST` | `EEXIST` | `ostest` on `qemu-armv8a:knsh` and `qemu-armv8a:nsh` ends with `ostest_main: Exiting with status 0`. `lm3s6965-ek:qemu-flat` builds. `tools/checkpatch.sh -c -u -m -g` 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]
