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

   ## Summary
   
   POSIX declares `ctermid()` and `L_ctermid` in `<stdio.h>`; NuttX had 
neither. `ctermid()` returns the path of the controlling terminal; on NuttX 
that is `/dev/console` for every task.
   
   This PR adds `libs/libc/stdio/lib_ctermid.c`: it copies `/dev/console` into 
the caller's buffer, or into a static buffer when the argument is NULL, and 
returns it. `L_ctermid` is 13. The function is added to `include/cxx/cstdio` 
and to `libc.csv`, so that the system symbol table exports it.
   
   A second commit marks `ctermid()` as supported in 
`Documentation/standards/posix.rst` and adds it to the stdio list of the user 
reference.
   
   ## Impact
   
   New function only.
   
   ## Testing
   
   A test program on `qemu-armv8a:knsh` (QEMU 11 with HVF on an Apple M4): 
`ctermid(NULL)` and `ctermid(buf)` both return `/dev/console`, and its length 
is less than `L_ctermid`: it passes. On master it does not compile.
   
   `tools/mksymtab` on `libc.csv` + `libm.csv` + `syscall.csv` generates the 
`ctermid` entry. `ostest` on `qemu-armv8a:knsh` and `qemu-armv8a:nsh` ends with 
`ostest_main: Exiting with status 0`. `tools/checkpatch.sh -c -u -m -g` passes.
   


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