Skip to content

fs/hostfs: Return ENOTTY for unsupported ioctl#19501

Merged
jerpelea merged 1 commit into
apache:masterfrom
LingaoM:hostfs-ioctl-enotty
Jul 23, 2026
Merged

fs/hostfs: Return ENOTTY for unsupported ioctl#19501
jerpelea merged 1 commit into
apache:masterfrom
LingaoM:hostfs-ioctl-enotty

Conversation

@LingaoM

@LingaoM LingaoM commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

host_ioctl() reports unsupported ioctl requests from hostfs backends. Use -ENOTTY for that case instead of -ENOSYS so callers can distinguish an unsupported ioctl request from a missing host operation.

Keep the other host operation stubs returning -ENOSYS; this change is limited to ioctl semantics. Update the ARM, ARM64, RISC-V, Xtensa and Windows sim hostfs stubs to match that behavior.

Testing:

Host: Ubuntu 22.04 x86_64

  • git diff --check

  • make distclean

  • ./tools/configure.sh -l -a ../nuttx-apps sim:nsh

  • make -j16

  • printf 'help\npoweroff\n' | timeout 20s ./nuttx

  • make distclean

  • ./tools/configure.sh -a ../nuttx-apps sabre-6quad:knsh

  • make -j16

Assisted-by: Claude:Claude-Fable-5

@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: simulator Issues related to the SIMulator Arch: xtensa Issues related to the Xtensa architecture Size: S The size of the change in this PR is small labels Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@xiaoxiang781216

xiaoxiang781216 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

please rebase to the last master @LingaoM

@emomaxd

emomaxd commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

These implementations are unconditional stubs and do not inspect request. POSIX describes ENOSYS as indicating that the interface function is not supported at all, whereas NuttX documents ENOTTY for an ioctl() command that is not recognized. Since host_ioctl() is entirely unimplemented on these backends, wouldn’t -ENOSYS be more accurate here?

https://nuttx.apache.org/docs/latest/implementation/ioctl.html
https://pubs.opengroup.org/onlinepubs/009696899/xrat/xsh_chap02.html
https://pubs.opengroup.org/onlinepubs/9699919799.orig/basedefs/errno.h.html

Comment thread arch/arm/src/common/arm_hostfs.c
host_ioctl() reports unsupported ioctl requests from hostfs backends. Use
-ENOTTY for that case instead of -ENOSYS so callers can distinguish an
unsupported ioctl request from a missing host operation.

Keep the other host operation stubs returning -ENOSYS; this change is limited
to ioctl semantics. Update the ARM, ARM64, RISC-V, Xtensa and Windows sim
hostfs stubs to match that behavior.

Testing:

  Host: Ubuntu 22.04 x86_64

  - git diff --check

  - make distclean

  - ./tools/configure.sh -l -a ../nuttx-apps sim:nsh

  - make -j16

  - printf 'help\npoweroff\n' | timeout 20s ./nuttx

  - make distclean

  - ./tools/configure.sh -a ../nuttx-apps sabre-6quad:knsh

  - make -j16

Assisted-by: Claude:Claude-Fable-5
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
@LingaoM
LingaoM force-pushed the hostfs-ioctl-enotty branch from 0cd1b55 to fcfbb21 Compare July 23, 2026 01:40
@jerpelea
jerpelea merged commit 6bd674b into apache:master Jul 23, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: simulator Issues related to the SIMulator Arch: xtensa Issues related to the Xtensa architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants