[v3] ioctl_tty.2: Fix information about header include file

Message ID 20210831202809.29819-1-pali@kernel.org
State New
Headers show
Series
  • [v3] ioctl_tty.2: Fix information about header include file
Related show

Commit Message

Header file termios.h contains incompatible definitions for linux ioctl
calls. Correct definitions are exported by header file linux/termios.h but
this file conflicts with sys/ioctl.h header file (required for ioctl()
call). Therefore include direct asm header file asm/termbits.h which
contains compatible definitions and structures for ioctl calls.

Signed-off-by: Pali Rohár <pali@kernel.org>


---
Changes in v3:
* Use .I <file> instead of .B #include <file>
* Use Bnnn instead of Bnn

Changes in v2:
* Reformat SYNOPSIS for 80 chars per line
---
 man2/ioctl_tty.2 | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

On Tuesday 31 August 2021 22:28:09 Pali Rohár wrote:
> Header file termios.h contains incompatible definitions for linux ioctl

> calls. Correct definitions are exported by header file linux/termios.h but

> this file conflicts with sys/ioctl.h header file (required for ioctl()

> call). Therefore include direct asm header file asm/termbits.h which

> contains compatible definitions and structures for ioctl calls.

> 

> Signed-off-by: Pali Rohár <pali@kernel.org>


Hello Alejandro! Could you check also this patch?

> ---

> Changes in v3:

> * Use .I <file> instead of .B #include <file>

> * Use Bnnn instead of Bnn

> 

> Changes in v2:

> * Reformat SYNOPSIS for 80 chars per line

> ---

>  man2/ioctl_tty.2 | 19 +++++++++++++++++--

>  1 file changed, 17 insertions(+), 2 deletions(-)

> 

> diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2

> index 186011ee7c33..7d866867c6bd 100644

> --- a/man2/ioctl_tty.2

> +++ b/man2/ioctl_tty.2

> @@ -11,8 +11,10 @@ ioctl_tty \- ioctls for terminals and serial lines

>  .SH SYNOPSIS

>  .nf

>  .B #include <sys/ioctl.h>

> -.BR "#include <termios.h>" "      /* Definition of " CLOCAL ", and"

> -.BR    "                             TC*" { FLUSH , ON , OFF "} constants */"

> +.BR "#include <asm/termbits.h>" "   /* Definition of " "struct termios" ,

> +.BR    "                               struct termios2" ", and"

> +.BR    "                               Bnnn" ", " BOTHER ", " CBAUD ", " CLOCAL ,

> +.BR    "                               TC*" { FLUSH , ON , OFF "} and other constants */"

>  .PP

>  .BI "int ioctl(int " fd ", int " cmd ", ...);"

>  .fi

> @@ -31,6 +33,19 @@ makes for nonportable programs.

>  Use the POSIX interface described in

>  .BR termios (3)

>  whenever possible.

> +.PP

> +Please note that

> +.B struct termios

> +from

> +.I <asm/termbits.h>

> +is different and incompatible with

> +.B struct termios

> +from

> +.IR <termios.h> .

> +These ioctl calls require

> +.B struct termios

> +from

> +.IR <asm/termbits.h> .

>  .SS Get and set terminal attributes

>  .TP

>  .B TCGETS

> -- 

> 2.20.1

>
Hi Pali,

On 9/10/21 7:39 PM, Pali Rohár wrote:
> On Tuesday 31 August 2021 22:28:09 Pali Rohár wrote:

>> Header file termios.h contains incompatible definitions for linux ioctl

>> calls. Correct definitions are exported by header file linux/termios.h but

>> this file conflicts with sys/ioctl.h header file (required for ioctl()

>> call). Therefore include direct asm header file asm/termbits.h which

>> contains compatible definitions and structures for ioctl calls.

>>

>> Signed-off-by: Pali Rohár <pali@kernel.org>

> 

> Hello Alejandro! Could you check also this patch?


Sure, patch applied!
BTW, if at some point you feel like adding entries for termios and 
termios2 into system_data_types(7), I'll be happy to merge those!!

Thank you!

Alex

> 

>> ---

>> Changes in v3:

>> * Use .I <file> instead of .B #include <file>

>> * Use Bnnn instead of Bnn

>>

>> Changes in v2:

>> * Reformat SYNOPSIS for 80 chars per line

>> ---

>>   man2/ioctl_tty.2 | 19 +++++++++++++++++--

>>   1 file changed, 17 insertions(+), 2 deletions(-)

>>

>> diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2

>> index 186011ee7c33..7d866867c6bd 100644

>> --- a/man2/ioctl_tty.2

>> +++ b/man2/ioctl_tty.2

>> @@ -11,8 +11,10 @@ ioctl_tty \- ioctls for terminals and serial lines

>>   .SH SYNOPSIS

>>   .nf

>>   .B #include <sys/ioctl.h>

>> -.BR "#include <termios.h>" "      /* Definition of " CLOCAL ", and"

>> -.BR    "                             TC*" { FLUSH , ON , OFF "} constants */"

>> +.BR "#include <asm/termbits.h>" "   /* Definition of " "struct termios" ,

>> +.BR    "                               struct termios2" ", and"

>> +.BR    "                               Bnnn" ", " BOTHER ", " CBAUD ", " CLOCAL ,

>> +.BR    "                               TC*" { FLUSH , ON , OFF "} and other constants */"

>>   .PP

>>   .BI "int ioctl(int " fd ", int " cmd ", ...);"

>>   .fi

>> @@ -31,6 +33,19 @@ makes for nonportable programs.

>>   Use the POSIX interface described in

>>   .BR termios (3)

>>   whenever possible.

>> +.PP

>> +Please note that

>> +.B struct termios

>> +from

>> +.I <asm/termbits.h>

>> +is different and incompatible with

>> +.B struct termios

>> +from

>> +.IR <termios.h> .

>> +These ioctl calls require

>> +.B struct termios

>> +from

>> +.IR <asm/termbits.h> .

>>   .SS Get and set terminal attributes

>>   .TP

>>   .B TCGETS

>> -- 

>> 2.20.1

>>



-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

Patch

diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index 186011ee7c33..7d866867c6bd 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -11,8 +11,10 @@  ioctl_tty \- ioctls for terminals and serial lines
 .SH SYNOPSIS
 .nf
 .B #include <sys/ioctl.h>
-.BR "#include <termios.h>" "      /* Definition of " CLOCAL ", and"
-.BR    "                             TC*" { FLUSH , ON , OFF "} constants */"
+.BR "#include <asm/termbits.h>" "   /* Definition of " "struct termios" ,
+.BR    "                               struct termios2" ", and"
+.BR    "                               Bnnn" ", " BOTHER ", " CBAUD ", " CLOCAL ,
+.BR    "                               TC*" { FLUSH , ON , OFF "} and other constants */"
 .PP
 .BI "int ioctl(int " fd ", int " cmd ", ...);"
 .fi
@@ -31,6 +33,19 @@  makes for nonportable programs.
 Use the POSIX interface described in
 .BR termios (3)
 whenever possible.
+.PP
+Please note that
+.B struct termios
+from
+.I <asm/termbits.h>
+is different and incompatible with
+.B struct termios
+from
+.IR <termios.h> .
+These ioctl calls require
+.B struct termios
+from
+.IR <asm/termbits.h> .
 .SS Get and set terminal attributes
 .TP
 .B TCGETS