ioctl_tty.2: Fix information about header include file

Message ID 20210730105353.10424-1-pali@kernel.org
State Superseded
Headers
Series ioctl_tty.2: Fix information about header include file |

Checks

Context Check Description
dj/TryBot-apply_patch fail Patch failed to apply to master at the time it was sent

Commit Message

Pali Rohár July 30, 2021, 10:53 a.m. UTC
  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>
---
 man2/ioctl_tty.2 | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
  

Comments

Alejandro Colomar July 30, 2021, 12:02 p.m. UTC | #1
Hi Pali,

On 7/30/21 12:53 PM, 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>

Thanks for the patch.  I'll wait to see if someone from glibc reviews 
the change.
I'll add some comments about the formatting for now.

Cheers,

Alex

> ---
>   man2/ioctl_tty.2 | 17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
> index c1875530f0b1..91aceddb7828 100644
> --- a/man2/ioctl_tty.2
> +++ b/man2/ioctl_tty.2
> @@ -11,8 +11,8 @@ 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 ", " struct " " termios2 ","

A single space between tokens is enough: s/>"   "/>" "/

Join related tokens: s/struct " " termios/"struct termios"/

Tokens without spaces don't need quoting: s/","$/,/

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

Please format everything into at most 80 columns, and preferably 78.

Right now I see:

[
SYNOPSIS
        #include <sys/ioctl.h>
        #include <asm/termbits.h>   /* Definition of struct termios, 
struct termios2,
                                       BOTHER, CLOCAL, and 
TC*{FLUSH,ON,OFF} constants */

        int ioctl(int fd, int cmd, ...);
]

Maybe break between the 2 structs, and after that "and".
Also, I'd add an "and" just before the constants to make clear that 
"constants" only applies to them.

>   .PP
>   .BI "int ioctl(int " fd ", int " cmd ", ...);"
>   .fi
> @@ -31,6 +31,19 @@ makes for nonportable programs.
>   Use the POSIX interface described in
>   .BR termios (3)
>   whenever possible.
> +.PP
> +Please note that
> +.B struct termios
> +from
> +.B #include <asm/termbits.h>
> +is different and incompatible with
> +.B struct termios
> +from
> +.BR "#include <termios.h>" .
> +These ioctl calls require
> +.B struct termios
> +from
> +.BR "#include <asm/termbits.h>" .
>   .SS Get and set terminal attributes
>   .TP
>   .B TCGETS
>
  

Patch

diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index c1875530f0b1..91aceddb7828 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -11,8 +11,8 @@  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 ", " struct " " termios2 ","
+.BR "                              " " " BOTHER ", " CLOCAL ", and " TC* { FLUSH , ON , OFF "} constants */"
 .PP
 .BI "int ioctl(int " fd ", int " cmd ", ...);"
 .fi
@@ -31,6 +31,19 @@  makes for nonportable programs.
 Use the POSIX interface described in
 .BR termios (3)
 whenever possible.
+.PP
+Please note that
+.B struct termios
+from
+.B #include <asm/termbits.h>
+is different and incompatible with
+.B struct termios
+from
+.BR "#include <termios.h>" .
+These ioctl calls require
+.B struct termios
+from
+.BR "#include <asm/termbits.h>" .
 .SS Get and set terminal attributes
 .TP
 .B TCGETS