jingfei195887 opened a new pull request, #20668:
URL: https://github.com/apache/nuttx/pull/20668

   ## Summary
   
   Related to the footprint discussion in #20414.
   
   Eleven `posix_spawnattr_*` get/set functions copy a single field, yet each
   lives in its own translation unit, so every caller pays a call plus the
   callee's prologue for one load or store. POSIX allows these interfaces to be
   provided as macros, so they are now `static inline` functions in `spawn.h`
   and their source files are dropped:
   
   `destroy`, `getflags`, `setflags`, `getschedpolicy`, `setschedpolicy`,
   `getsigmask`, `setsigmask`, `getstacksize`, `setstacksize`, `getpriority`,
   `setpriority`.
   
   `posix_spawnattr_init()`, the `schedparam` pair (sporadic fields), the
   `stackaddr` pair (kernel-build variants) and `posix_spawnattr_dump()` stay
   out of line. Prototypes are unchanged.
   
   ## Impact
   
   - No functional change for valid arguments.
   - The removed out-of-line versions had `DEBUGASSERT()` checks (NULL pointers;
     flag and policy ranges in `setflags`/`setschedpolicy`). The inline versions
     do not, to avoid pulling `<assert.h>` into the public `spawn.h`. Happy to
     restore them if reviewers prefer.
   - The eleven functions are no longer exported as symbols from libc. They are
     not listed in `libs/libc/libc.csv`, so generated symbol tables are 
unchanged.
   - Make and CMake both updated.
   
   ## Testing
   
   Host: Ubuntu x86_64, arm-none-eabi-gcc 10.3.1 20210621, master be9dc4cbaa,
   clean builds. Flash = text + data.
   
   | build | master | this PR | delta |
   |---|---:|---:|---:|
   | `stm32f103-minimum:nsh` (CMake) | 52443 | 52387 | **-56** |
   | `stm32f4discovery:kostest` (protected), kernel image | 64210 | 64194 | -16 
|
   | `stm32f4discovery:kostest` (protected), user image | 64516 | 64516 | 0 |
   
   In `stm32f103-minimum:nsh` the calls to `posix_spawnattr_*` drop from 9 to 3.
   
   Other checks:
   - Builds: `stm32f103-minimum:nsh` with `DEBUG_FEATURES=y`, `sim:nsh`,
     `sim:ostest`, `sim:cxxtest`.
   - `sim:nsh`: running the `hello` builtin (spawned through
     `exec_builtin()`) works; `ps` shows the expected policy and priority.
   - `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
     `cmake-format --check`: clean.
   
   Not tested on hardware.
   


-- 
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]

Reply via email to