yangsong8-a1 opened a new pull request, #21716:
URL: https://github.com/apache/nuttx/pull/21716

   ## Summary
   
   - Widen `open_count` in `struct uart_dev_s` from `uint8_t` to `uint16_t`.
   - `uart_open()` uses a `uint16_t` temporary for the overflow check, so a
     serial device can now be opened up to 65535 times instead of 255.
   - This fixes `-EMFILE` when many tasks inherit or dup `/dev/console`.
   
   ## Impact
   
   Serial upper half only. `struct uart_dev_s` grows by one byte (absorbed by
   padding on most targets). No API change.
   
   ## Testing
   
   Ubuntu 22.04, gcc 13.1, arm-none-eabi-gcc 10.3, aarch64-none-elf-gcc.
   
   Built and booted: sim:nsh, sim:smp, qemu-armv8a:nsh, qemu-armv8a:nsh_smp,
   qemu-intel64:nsh, mps2-an500:nsh. No new warnings.
   
   sim:nsh test, four tasks open `/dev/console` 100 times each:
   
   ```
   before: OPENTEST opened=254 errno=24
   after:  OPENTEST opened=400 errno=0
           OPENTEST closed
   ```
   


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