Re: [PATCH 1/1] termios: rename _TERMIOS2_NCCS to KERNEL_TERMIOS2_NCCS

H. Peter Anvin hpa@zytor.com
Fri Jul 18 18:08:38 GMT 2025


On July 18, 2025 10:51:42 AM PDT, "Andreas K. Huettel" <dilfridge@gentoo.org> wrote:
>Am Sonntag, 13. Juli 2025, 07:56:18 Mitteleuropäische Sommerzeit schrieb H. Peter Anvin:
>> For consistency with the other built time computed termios2 constants,
>> rename _TERMIOS2_NCCS to KERNEL_TERMIOS2_NCCS.
>> 
>
>While I appreciate you sending tons of improvements, we're in hard freeze for the 
>upcoming release now. 
>
>If you see anything as critical for 2.42 please mark it as such. 
>Otherwise, after the release.
>
>Thanks.
>
>
>> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
>> ---
>>  sysdeps/unix/sysv/linux/tcgetattr.c           |  2 +-
>>  sysdeps/unix/sysv/linux/tcsetattr.c           |  2 +-
>>  .../unix/sysv/linux/termios-kernel-consts.sym |  2 +-
>>  sysdeps/unix/sysv/linux/termios_internals.h   | 20 +++++++++----------
>>  4 files changed, 13 insertions(+), 13 deletions(-)
>> 
>> diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
>> index 36f68a7868a0..c32becfb7235 100644
>> --- a/sysdeps/unix/sysv/linux/tcgetattr.c
>> +++ b/sysdeps/unix/sysv/linux/tcgetattr.c
>> @@ -37,7 +37,7 @@ __tcgetattr (int fd, struct termios *termios_p)
>>        termios_p->c_ospeed = k_termios.c_ospeed;
>>        termios_p->c_ispeed = k_termios.c_ispeed;
>>  
>> -      copy_c_cc (termios_p->c_cc, NCCS, k_termios.c_cc, _TERMIOS2_NCCS);
>> +      copy_c_cc (termios_p->c_cc, NCCS, k_termios.c_cc, KERNEL_TERMIOS2_NCCS);
>>      }
>>  
>>    return retval;
>> diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
>> index ad8f2dfc3f0d..975e57d63f7a 100644
>> --- a/sysdeps/unix/sysv/linux/tcsetattr.c
>> +++ b/sysdeps/unix/sysv/linux/tcsetattr.c
>> @@ -45,7 +45,7 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
>>  
>>    ___termios2_canonicalize_speeds (&k_termios);
>>  
>> -  copy_c_cc (k_termios.c_cc, _TERMIOS2_NCCS, termios_p->c_cc, NCCS);
>> +  copy_c_cc (k_termios.c_cc, KERNEL_TERMIOS2_NCCS, termios_p->c_cc, NCCS);
>>  
>>    /*
>>     * Choose the proper ioctl number to invoke.
>> diff --git a/sysdeps/unix/sysv/linux/termios-kernel-consts.sym b/sysdeps/unix/sysv/linux/termios-kernel-consts.sym
>> index 3856a8cc1c01..9ad722a0ba65 100644
>> --- a/sysdeps/unix/sysv/linux/termios-kernel-consts.sym
>> +++ b/sysdeps/unix/sysv/linux/termios-kernel-consts.sym
>> @@ -23,4 +23,4 @@ KERNEL_TCSETSW2 TCSETSW2
>>  KERNEL_TERMIOS2_SIZE sizeof (STRUCT_TERMIOS)
>>  KERNEL_TERMIOS2_CC_OFFSET offsetof (STRUCT_TERMIOS, c_cc)
>>  KERNEL_TERMIOS2_LINE_OFFSET offsetof (STRUCT_TERMIOS, c_line)
>> -_TERMIOS2_NCCS sizeof ((STRUCT_TERMIOS) { 0 }.c_cc) / sizeof (cc_t)
>> +KERNEL_TERMIOS2_NCCS sizeof ((STRUCT_TERMIOS) { 0 }.c_cc) / sizeof (cc_t)
>> diff --git a/sysdeps/unix/sysv/linux/termios_internals.h b/sysdeps/unix/sysv/linux/termios_internals.h
>> index b2f3f1b3fdff..cd0d1b7fcbc6 100644
>> --- a/sysdeps/unix/sysv/linux/termios_internals.h
>> +++ b/sysdeps/unix/sysv/linux/termios_internals.h
>> @@ -51,19 +51,19 @@
>>  
>>  struct termios2
>>  {
>> -  tcflag_t c_iflag;		/* input mode flags */
>> -  tcflag_t c_oflag;		/* output mode flags */
>> -  tcflag_t c_cflag;		/* control mode flags */
>> -  tcflag_t c_lflag;		/* local mode flags */
>> +  tcflag_t c_iflag;			/* input mode flags */
>> +  tcflag_t c_oflag;			/* output mode flags */
>> +  tcflag_t c_cflag;			/* control mode flags */
>> +  tcflag_t c_lflag;			/* local mode flags */
>>  #if KERNEL_TERMIOS2_CC_OFFSET < KERNEL_TERMIOS2_LINE_OFFSET
>> -  cc_t c_cc[_TERMIOS2_NCCS];	/* control characters */
>> -  cc_t c_line;			/* line discipline */
>> +  cc_t c_cc[KERNEL_TERMIOS2_NCCS];	/* control characters */
>> +  cc_t c_line;				/* line discipline */
>>  #else
>> -  cc_t c_line;			/* line discipline */
>> -  cc_t c_cc[_TERMIOS2_NCCS];	/* control characters */
>> +  cc_t c_line;				/* line discipline */
>> +  cc_t c_cc[KERNEL_TERMIOS2_NCCS];	/* control characters */
>>  #endif
>> -  speed_t c_ispeed;		/* input speed */
>> -  speed_t c_ospeed;		/* output speed */
>> +  speed_t c_ispeed;			/* input speed */
>> +  speed_t c_ospeed;			/* output speed */
>>  };
>>  
>>  /* ---- Application interface definitions ---- */
>> 
>
>

Make sense. No worries. 

The only things that I consider important is the SPEED_MAX/BAUD_MAX constant and rolling back the removal of ioctl constants (for now.)


More information about the Libc-alpha mailing list