nuttx/Documentation/components/drivers/character
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
..
analog docs/ads1115: Add trigger commands to documentation 2025-07-14 10:22:33 -04:00
crypto Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
input !boards/arm/stm32: move common board sources 2026-07-03 10:27:27 +08:00
leds !arch/stm32: move stm32l1 and finalize the directory split 2026-07-03 10:27:27 +08:00
motor drivers/foc: add support for FOC power-stage driver 2023-11-18 17:07:20 -08:00
timers !arch/stm32h7: use common STM32 Kconfig symbols 2026-06-24 23:14:35 +08:00
wireless style: fix typos 2025-04-30 13:45:46 +08:00
1wire.rst 1wire DS2XXX: add 1wire and DS2XXX documentation 2025-10-11 07:39:01 -03:00
bch.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
can.rst can: strict TX priority ordering to avoid priority inversion 2026-01-06 16:03:14 +08:00
contactless.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
eeprom.rst Documentation: add pages for supported MTD devices 2025-12-31 11:37:49 +08:00
efuse.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
gpio.rst drivers/gpio: gpio driver added debounce and interrupt mask functions 2025-12-18 14:52:37 +01:00
i2s.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
index.rst documentation: add GPIO character device driver entry 2025-11-22 14:12:19 -05:00
ipcc.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
loop.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
math.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
modem.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
note.rst driver/noteram: Support poll threshold 2026-01-27 03:18:38 +08:00
nullzero.rst Documentation: cosmetics changes 2023-10-26 20:01:21 +08:00
quadrature.rst doc: Improved QE Documentation and add mt6816 board profile doc 2026-05-03 07:56:38 -03:00
rc.rst docs/rc: document RC/LIRC drivers and remove empty drivers/rmt files 2026-04-04 11:18:32 -03:00
rf.rst Documentation: add dummy pages for missing filesystems and drivers 2023-10-27 13:21:40 -03:00
serial.rst drivers/serial: add job-control TTY ioctls and libc wrappers 2026-08-06 17:48:04 +08:00
touchscreen.rst drivers/touchscreen: add grab for touchscreen 2024-08-08 18:30:32 +08:00