Repository navigation
drivers/serial: make terminal window size optional for DEFAULT_SMALL - #22133
Merged
xiaoxiang781216 merged 1 commit intoNov 23, 2026
Merged
Conversation
Swatantra-66
requested review from
Donny9,
GUIDINGLI,
jerpelea and
xiaoxiang781216
as code owners
November 20, 2026 19:30
|
xiaoxiang781216
approved these changes
Nov 21, 2026
xiaoxiang781216
previously approved these changes
Nov 21, 2026
Contributor
|
@Swatantra-66 Thanks for your help for code size, please fix the conflict |
Add CONFIG_SERIAL_WINSIZE (default !DEFAULT_SMALL) to gate TIOCGWINSZ and TIOCSWINSZ ioctl support in the serial and pseudo-terminal drivers. When disabled, the struct winsize member is omitted from uart_dev_s and pty_devpair_s, and the ioctl cases fall through to the default handler returning -ENOTTY. Saves 288 bytes of Flash and 40 bytes of bss per serial device on sim:nsh (x86_64). On DEFAULT_SMALL ARM targets the struct winsize (8 bytes SRAM per UART) is also eliminated. Assisted-by: Antigravity:claude-opus-4.6 Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
force-pushed
the
fix/serial-winsize-default-small
branch
from
November 23, 2026 08:24
92225bb to
9ad9ac2
Compare
Contributor
Author
conflict resolved |
xiaoxiang781216
approved these changes
Nov 23, 2026
jerpelea
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #20414
Make terminal window size support (
TIOCGWINSZandTIOCSWINSZ) optional viaCONFIG_SERIAL_WINSIZE(defaulting to!DEFAULT_SMALL):New Kconfig Option (
CONFIG_SERIAL_WINSIZE):config SERIAL_WINSIZEunderdrivers/serial/Kconfig.!DEFAULT_SMALL.SIGWINCHifCONFIG_TTY_SIGINTorCONFIG_TTY_SIGTSTPis enabled.Conditional Compilation in Drivers:
include/nuttx/serial/serial.h:winsizefield instruct uart_dev_sis gated under#ifdef CONFIG_SERIAL_WINSIZE.drivers/serial/serial.c:TIOCGWINSZandTIOCSWINSZcases inuart_ioctl()are gated under#ifdef CONFIG_SERIAL_WINSIZE. When disabled, they fall through to default returning-ENOTTY.drivers/serial/pty.c:pp_winsizeinstruct pty_devpair_s,TIOCGWINSZ/TIOCSWINSZhandling, and deferredSIGWINCHdelivery inpty_ioctl()are gated under#ifdef CONFIG_SERIAL_WINSIZE.Documentation:
Documentation/os/drivers/character/serial.rst: DocumentedCONFIG_SERIAL_WINSIZE, noted that disabled ioctl calls fail withENOTTY(returning -1 and settingerrnotoENOTTY), and described theDEFAULT_SMALLdefault.Impact
DEFAULT_SMALL=y, terminal window size handling and storage are omitted to save Flash and SRAM. On normal targets (DEFAULT_SMALL=n), default behavior is unchanged.Documentation/os/drivers/character/serial.rst.Size Difference
Real Size Figures (
drivers/serial.oonsim:nshx86_64)CONFIG_SERIAL_WINSIZE=yCONFIG_SERIAL_WINSIZE=nIn addition, each UART device instance saves 8 bytes (
struct winsize) of runtime SRAM.Testing
Build Verification Log
sim:nsh(x86_64)CONFIG_SERIAL_WINSIZE=yandCONFIG_SERIAL_WINSIZE=nbuild cleanly:Runtime Test Execution Log
Boot and session verification on
sim:nshsimulator:Code Style Verification
Checked with
tools/nxstyle: