Skip to content

This PR contains two commits that enhance library support and fix header dependencies.#18330

Closed
txy-21 wants to merge 2 commits intoapache:masterfrom
txy-21:feat/add-rexec-lib-and-kmalloc-20260203
Closed

This PR contains two commits that enhance library support and fix header dependencies.#18330
txy-21 wants to merge 2 commits intoapache:masterfrom
txy-21:feat/add-rexec-lib-and-kmalloc-20260203

Conversation

@txy-21
Copy link
Contributor

@txy-21 txy-21 commented Feb 3, 2026

Summary

This PR introduces two enhancements to improve library compatibility and fix header dependencies in NuttX.

Why:

  1. The rexec() function requires conditional header inclusion to support different build configurations (kernel vs. flat builds)
  2. ARM64 architecture timer implementation was missing the kmalloc.h header dependency, causing potential compilation issues

What changed:

  1. libc: Add library support for rexec

    • Modified header inclusion logic in lib.h to conditionally include kmalloc.h for kernel builds and stdlib.h for flat builds
    • Added CONFIG_FILE_STREAM guard for fs/fs.h inclusion
    • Enhanced netdb functions (getaddrinfo, gethostentbynamer) to support rexec scenarios
    • Updated streams.h for rexec stream support
  2. arm64: Add kmalloc header for arch timer

    • Added missing nuttx/kmalloc.h include to arm64_arch_timer.c

Impact

Scope:

  • libc/netdb: Enhanced compatibility for remote execution functionality
  • ARM64 architecture: Fixed header dependency in timer subsystem
  • Build configurations: Improved support for CONFIG_BUILD_FLAT and CONFIG_FILE_STREAM configurations

Affected components:

  • include/nuttx/lib/lib.h
  • include/nuttx/streams.h
  • libs/libc/netdb/lib_getaddrinfo.c
  • libs/libc/netdb/lib_gethostentbynamer.c
  • libs/libc/netdb/lib_netdb.h
  • arch/arm64/src/common/arm64_arch_timer.c

Breaking changes: None

Backward compatibility: Fully maintained

Testing

Build testing:

  • Configurations tested:
    • CONFIG_BUILD_FLAT=y
    • CONFIG_BUILD_KERNEL=y
    • CONFIG_FILE_STREAM=y/n combinations
  • Architectures verified:
    • ARM64 builds with arch timer enabled
    • Multi-architecture compatibility check

Functional testing:

  • ARM64 timer functionality verified on target hardware
  • Network database functions (getaddrinfo, gethostbyname) tested with rexec scenarios
  • No regression observed in existing functionality

Compilation:

# ARM64 configuration
./tools/configure.sh <board>:<config>
make clean && make
# Build successful with no warnings

This patch adds library support for the rexec() function by:
1. Conditionally including headers based on build configuration
   - Use kmalloc.h for kernel builds, stdlib.h otherwise
   - Include fs/fs.h only when CONFIG_FILE_STREAM is enabled
2. Adding stream support for rexec functionality
3. Enhancing netdb functions (getaddrinfo, gethostentbynamer) to
   support remote execution scenarios

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
Include nuttx/kmalloc.h in arm64_arch_timer.c to fix missing header
dependency. This ensures proper memory allocation functions are
available for the architecture timer implementation.

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
@github-actions github-actions bot added Arch: arm64 Issues related to ARM64 (64-bit) architecture Area: OS Components OS Components issues Size: S The size of the change in this PR is small labels Feb 3, 2026
Copy link
Contributor

@jerpelea jerpelea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The submitted patches are unrelated.
Please submit them in 2 separate PRs

please write a descriptive PR title
ex:
libc: Add rexec implementation
arch/arm64: Add kmalloc header for arch timer

@txy-21
Copy link
Contributor Author

txy-21 commented Feb 3, 2026

The submitted patches are unrelated. Please submit them in 2 separate PRs

please write a descriptive PR title ex: libc: Add rexec implementation arch/arm64: Add kmalloc header for arch timer

@jerpelea
Thank you for your comment. I have split this PR into 2 separate PRs.

@txy-21 txy-21 closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm64 Issues related to ARM64 (64-bit) architecture Area: OS Components OS Components issues 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.

2 participants