diff mbox series

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

Message ID 20210730130537.18863-1-pali@kernel.org
State New
Headers show
Series [v2] ioctl_tty.2: Fix information about header include file | expand

Commit Message

Pali Rohár July 30, 2021, 1:05 p.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>

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

Comments

Alejandro Colomar Aug. 8, 2021, 8:26 a.m. UTC | #1
Hi Pali,

On 7/30/21 3:05 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.

No one screamed so far, so I was going to apply this one, but I just 
noticed a minor formatting issue; see below.

Thanks,

Alex

> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> ---
> 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 771a9a470bf0..ecbae4f887c4 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    "                               Bnn" ", " 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
> +.B #include <asm/termbits.h>

Instead, just (with no "#include"):

.I <asm/termbits.h>

See man-pages(7):
    Formatting conventions (general)
        [...]

        Filenames  (whether  pathnames,  or  references  to  header
        files) are always in italics (e.g., <stdio.h>),  except  in
        the  SYNOPSIS  section,  where  included  files are in bold
        (e.g., #include <stdio.h>).  When referring to  a  standard
        header  file include, specify the header file surrounded by
        angle brackets, in the usual C way (e.g., <stdio.h>).


> +is different and incompatible with
> +.B struct termios
> +from
> +.BR "#include <termios.h>" .

ditto

> +These ioctl calls require
> +.B struct termios
> +from
> +.BR "#include <asm/termbits.h>" .

ditto

>   .SS Get and set terminal attributes
>   .TP
>   .B TCGETS
>
diff mbox series

Patch

diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index 771a9a470bf0..ecbae4f887c4 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    "                               Bnn" ", " 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
+.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