JianyuWang0623 opened a new pull request, #4048:
URL: https://github.com/apache/nuttx-apps/pull/4048
**Summary**
Three patches around lazy poll fds: (1) call the poller handler when
its fd is negative so a poller that opens its fd later gets the chance
to do so; (2) wake init at a bounded 100ms while any poller fd is
negative so that retry actually runs, and forward POLLHUP/POLLERR to
the handler for reconnects; (3) gate the retry on a declared events
mask so pollers with nothing to wait for never wake init.
They must land together: without (1), (2)'s wake never calls the
handler for a negative fd and the retry cannot open anything; without
(2), (1) alone leaves the handler uncallable while init sleeps forever;
without (3), (2) wakes init every 100ms for pollers that never get an
fd (e.g. the simple property backend), costing standby power.
**Impact**
- Only the nxinit main loop polling (init.c) and property_simple.c.
- No API changes; pollers that declare no events take no part in the retry.
**Testing**
Environment: esp32p4-pico-wifi-wareshare:nsh (simple property
backend), `apache/nuttx` `562db43781f5`, `nuttx-apps` = this branch.
A temporary test chain (init.rc snippet below, **not part of the
patch**) prints the marker `TEST_PROPTRIG_OK` from the `on property:`
action, so the marker in the boot log proves `setprop` reached the
action:
```
on boot
setprop test.foo 1
on property:test.foo=1
testmark bar
```
Boot log — init starts the console service and the test chain fires
(`Error TEST_PROPTRIG_OK argv1=bar` is the marker printed by the
`on property:` action above):
```
*** Booting NuttX ***
...
Error TEST_PROPTRIG_OK argv1=bar
nsh>
```
Services (`ps`):
```
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
2 2 0 100 RR Task - Waiting Semaphore
0000000000000000 0008128 init_main
3 3 2 100 RR Task - Running
0000000000000000 0008136 sh
```
Idle wake counting: a temporary counter (not in the patch) counts
every `ppoll()` return and prints one `WAKECOUNT` line per second
that contains a return. Two captures: reset + 40s window (including
>=30s idle after the console settled), 1336 bytes, `grep -c
WAKECOUNT` on it returns **0**; a second 30s capture with no reset
and no interaction is **0 bytes**. Zero count lines proves there is
no periodic wakeup in the window (a 100ms wakeup would print one line
per second), though it cannot distinguish "no ppoll return at all"
from "a single return".
sim:nsh (CONFIG_SYSTEM_NXINIT=y) build clean, smoke boot:
```
nsh> ps
TID PID PPID PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK COMMAND
4 4 0 100 FIFO Task - Waiting Semaphore
0000000000000000 0067496 init_main
7 7 4 100 FIFO Task - Running
0000000000000000 0067504 sh
nsh> poweroff
```
checkpatch (community CI profile):
```
Used config files:
1: .codespellrc
✔️ All checks pass.
```
--
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]