nuttx/libs/libc
Xiang Xiao db9531fe96 drivers/serial: add job-control TTY ioctls and libc wrappers
NuttX has no real session/process-group abstraction, so the TTY layer
collapses the foreground process group onto the single dev->pid field
(pgrp == pid, one member per group).  Extend the controlling-terminal
support so portable software (e.g. dropbear, socat) that relies on
job-control primitives works without losing the existing NuttX-specific
behaviour.

Driver (serial.c, pty.c):
- TIOCSCTTY now accepts a flag: arg > 0 keeps the historical "target
  PID in arg" semantics (NSH registers the foreground command it just
  spawned), while arg == 0 selects the calling task via
  nxsched_getpid(), matching the POSIX flag convention used by
  dropbear/socat/apue.  This preserves all existing callers and makes
  the previously-dead arg==0 path deliver SIGINT correctly.
- Add TIOCGPGRP/TIOCGSID (return dev->pid) and TIOCSPGRP (set it).
- pty.c gains the same handlers against pd_pid and includes
  nuttx/sched.h for nxsched_getpid().

ioctl numbers (tioctl.h): TIOCGPGRP/TIOCSPGRP/TIOCGSID at 0x37-0x39.

libc wrappers:
- termios: tcgetpgrp(), tcsetpgrp(), tcgetsid() over the new ioctls.
- unistd: setsid()/getsid()/setpgid() stubs consistent with the
  existing getpgrp()/getpgid() single-session model (sid == pgid ==
  pid; setpgid only succeeds for pgid == pid).

Declare the new prototypes in unistd.h (tcgetsid was already in
termios.h) and register all sources in the Make.defs/CMakeLists.

Group-broadcast signalling (kill(-pgrp)) remains unsupported, so
tty signals still target the single dev->pid; a real session/process
group model is left as a follow-up.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-08-06 17:48:04 +08:00
..
aio
assert
audio
builtin
ctype
dirent libs/libc/dirent: preserve errno on readdir() end-of-directory 2026-06-10 22:04:00 +08:00
dlfcn
elf
errno
eventfd
fdt
fixedmath
gdbstub
gnssutils
grp
hex2bin
inttypes
libgen
locale
lzf
machine arch/tricore: Full implementation of setjmp and longjmp. 2026-05-22 00:38:02 +08:00
misc arch/sim: replace macOS C++ constructor runtime hack with post-link patch 2026-05-19 07:08:55 -03:00
net
netdb !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
obstack
pthread arch, sched/signal: Fix compilation with ENABLE_PARTIAL_SIGNALS=y 2026-06-17 17:11:26 +08:00
pwd
queue
regex
sched
search
semaphore
signal
spawn
stdio !include/fcntl.h: align open flags with Linux values 2026-07-03 10:33:47 +08:00
stdlib stdlib/rand: replace weak LCG with xorshift32 PRNG 2026-07-04 01:59:35 +08:00
stream libc/stream: Check lowout bounds before access 2026-07-06 19:55:11 +08:00
string
symtab
syslog
termios drivers/serial: add job-control TTY ioctls and libc wrappers 2026-08-06 17:48:04 +08:00
time libc/time: Fix POSIX timezone string parsing. 2026-08-03 22:21:19 +08:00
tls
uio
unistd drivers/serial: add job-control TTY ioctls and libc wrappers 2026-08-06 17:48:04 +08:00
userfs
uuid
wchar
wctype
wqueue
zoneinfo tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-08-04 00:36:32 +08:00
.gitignore
CMakeLists.txt
Kconfig
libc.csv
libc.h
limits_check.c libs/libc: add limits checks 2026-07-03 10:32:57 +08:00
Makefile tools: fix stale archive members surviving a Kconfig-driven CSRCS change 2026-08-04 00:36:32 +08:00