Summary
Enable the termios C extension module, which provides POSIX terminal I/O control.
Current State
Commented out in Modules/Setup.stdlib:
Why Enable It
tty module depends on termios for raw/cbreak mode
getpass.getpass() uses termios to disable echo for password input
readline module integration depends on terminal attribute control
- Interactive Python REPL terminal handling
- Required for proper signal handling in terminal applications
Work Required
- Uncomment in
Modules/Setup.stdlib:
- Nanvix POSIX API requirements:
tcgetattr(fd, termios_p) — get terminal attributes
tcsetattr(fd, optional_actions, termios_p) — set terminal attributes
tcsendbreak(fd, duration) — send break
tcdrain(fd) — wait for output to drain
tcflush(fd, queue_selector) — flush terminal I/O
tcflow(fd, action) — suspend/resume terminal I/O
cfgetispeed() / cfgetospeed() — get baud rates
cfsetispeed() / cfsetospeed() — set baud rates
- Required headers:
<termios.h>, <sys/ioctl.h>
- Terminal ioctls needed:
TIOCGWINSZ (get window size) — used by os.get_terminal_size()
- Build and test:
python -c "import termios; print(termios.B9600)"
POSIX API Dependencies
| API |
Purpose |
tcgetattr() |
Get terminal attributes |
tcsetattr() |
Set terminal attributes |
tcdrain() |
Wait for output drain |
tcflush() |
Flush I/O queues |
tcflow() |
Suspend/resume I/O |
cfget/setispeed() |
Baud rate control |
Complexity
Medium — requires Nanvix terminal subsystem to support termios APIs.
Source Files
Summary
Enable the
termiosC extension module, which provides POSIX terminal I/O control.Current State
Commented out in
Modules/Setup.stdlib:Why Enable It
ttymodule depends ontermiosfor raw/cbreak modegetpass.getpass()usestermiosto disable echo for password inputreadlinemodule integration depends on terminal attribute controlWork Required
Modules/Setup.stdlib:tcgetattr(fd, termios_p)— get terminal attributestcsetattr(fd, optional_actions, termios_p)— set terminal attributestcsendbreak(fd, duration)— send breaktcdrain(fd)— wait for output to draintcflush(fd, queue_selector)— flush terminal I/Otcflow(fd, action)— suspend/resume terminal I/Ocfgetispeed()/cfgetospeed()— get baud ratescfsetispeed()/cfsetospeed()— set baud rates<termios.h>,<sys/ioctl.h>TIOCGWINSZ(get window size) — used byos.get_terminal_size()python -c "import termios; print(termios.B9600)"POSIX API Dependencies
tcgetattr()tcsetattr()tcdrain()tcflush()tcflow()cfget/setispeed()Complexity
Medium — requires Nanvix terminal subsystem to support
termiosAPIs.Source Files
Modules/termios.c