linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ioctl_tty.2: Fix information about header include file
@ 2021-07-30 10:53 Pali Rohár
  2021-07-30 12:02 ` Alejandro Colomar (man-pages)
  2021-07-30 13:05 ` [PATCH v2] " Pali Rohár
  0 siblings, 2 replies; 7+ messages in thread
From: Pali Rohár @ 2021-07-30 10:53 UTC (permalink / raw)
  To: linux-man, Alejandro Colomar, Michael Kerrisk
  Cc: Marek Behún, libc-alpha

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(-)

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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ioctl_tty.2: Fix information about header include file
  2021-07-30 10:53 [PATCH] ioctl_tty.2: Fix information about header include file Pali Rohár
@ 2021-07-30 12:02 ` Alejandro Colomar (man-pages)
  2021-07-30 13:05 ` [PATCH v2] " Pali Rohár
  1 sibling, 0 replies; 7+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-30 12:02 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Marek Behún, libc-alpha, G. Branden Robinson,
	Michael Kerrisk, linux-man

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
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] ioctl_tty.2: Fix information about header include file
  2021-07-30 10:53 [PATCH] ioctl_tty.2: Fix information about header include file Pali Rohár
  2021-07-30 12:02 ` Alejandro Colomar (man-pages)
@ 2021-07-30 13:05 ` Pali Rohár
  2021-08-08  8:26   ` Alejandro Colomar (man-pages)
  1 sibling, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2021-07-30 13:05 UTC (permalink / raw)
  To: linux-man, Alejandro Colomar, Michael Kerrisk
  Cc: Marek Behún, libc-alpha, G. Branden Robinson

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(-)

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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] ioctl_tty.2: Fix information about header include file
  2021-07-30 13:05 ` [PATCH v2] " Pali Rohár
@ 2021-08-08  8:26   ` Alejandro Colomar (man-pages)
  2021-08-31 20:28     ` [PATCH v3] " Pali Rohár
  0 siblings, 1 reply; 7+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-08-08  8:26 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Marek Behún, libc-alpha, G. Branden Robinson, linux-man,
	Michael Kerrisk

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
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3] ioctl_tty.2: Fix information about header include file
  2021-08-08  8:26   ` Alejandro Colomar (man-pages)
@ 2021-08-31 20:28     ` Pali Rohár
  2021-09-10 17:39       ` Pali Rohár
  0 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2021-08-31 20:28 UTC (permalink / raw)
  To: Alejandro Colomar (man-pages), Michael Kerrisk
  Cc: Marek Behún, libc-alpha, G. Branden Robinson, linux-man

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(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ioctl_tty.2: Fix information about header include file
  2021-08-31 20:28     ` [PATCH v3] " Pali Rohár
@ 2021-09-10 17:39       ` Pali Rohár
  2021-09-10 19:47         ` Alejandro Colomar (man-pages)
  0 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2021-09-10 17:39 UTC (permalink / raw)
  To: Alejandro Colomar (man-pages), Michael Kerrisk
  Cc: Marek Behún, libc-alpha, G. Branden Robinson, linux-man

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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ioctl_tty.2: Fix information about header include file
  2021-09-10 17:39       ` Pali Rohár
@ 2021-09-10 19:47         ` Alejandro Colomar (man-pages)
  0 siblings, 0 replies; 7+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-09-10 19:47 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Marek Behún, libc-alpha, G. Branden Robinson, linux-man,
	Michael Kerrisk

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/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-10 19:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 10:53 [PATCH] ioctl_tty.2: Fix information about header include file Pali Rohár
2021-07-30 12:02 ` Alejandro Colomar (man-pages)
2021-07-30 13:05 ` [PATCH v2] " Pali Rohár
2021-08-08  8:26   ` Alejandro Colomar (man-pages)
2021-08-31 20:28     ` [PATCH v3] " Pali Rohár
2021-09-10 17:39       ` Pali Rohár
2021-09-10 19:47         ` Alejandro Colomar (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).