* [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
@ 2021-07-25 22:55 Pali Rohár
2021-07-29 11:30 ` Alejandro Colomar (man-pages)
2021-07-30 10:48 ` [PATCH v2] " Pali Rohár
0 siblings, 2 replies; 11+ messages in thread
From: Pali Rohár @ 2021-07-25 22:55 UTC (permalink / raw)
To: linux-man, Alejandro Colomar, Michael Kerrisk
Signed-off-by: Pali Rohár <pali@kernel.org>
---
man2/ioctl_tty.2 | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index c8269070180f..0c3a8ec24c76 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -77,6 +77,35 @@ The following four ioctls are just like
.BR TCSETSW ,
.BR TCSETSF ,
except that they take a
+.I "struct termios2\ *"
+instead of a
+.IR "struct termios\ *" .
+.I "struct termios2\ *"
+is defined in header file
+.IR "<asm/termbits.h>" .
+If struct member
+.B c_cflag
+contains
+.B BOTHER
+then baudrate is stored in struct members
+.BR c_ispeed " and " c_ospeed
+as integer values.
+These ioctls are not supported on all architectures.
+.IP
+.BI "TCGETS2 struct termios2 *" argp
+.IP
+.BI "TCSETS2 const struct termios2 *" argp
+.IP
+.BI "TCSETSW2 const struct termios2 *" argp
+.IP
+.BI "TCSETSF2 const struct termios2 *" argp
+.PP
+The following four ioctls are just like
+.BR TCGETS ,
+.BR TCSETS ,
+.BR TCSETSW ,
+.BR TCSETSF ,
+except that they take a
.I "struct termio\ *"
instead of a
.IR "struct termios\ *" .
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-25 22:55 [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2 Pali Rohár
@ 2021-07-29 11:30 ` Alejandro Colomar (man-pages)
2021-07-29 17:31 ` Pali Rohár
2021-07-30 10:48 ` [PATCH v2] " Pali Rohár
1 sibling, 1 reply; 11+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-29 11:30 UTC (permalink / raw)
To: Pali Rohár; +Cc: Michael Kerrisk, linux-man
Hi Pali,
On 7/26/21 12:55 AM, Pali Rohár wrote:
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
Please see some comments below.
Thanks,
Alex
> man2/ioctl_tty.2 | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
> index c8269070180f..0c3a8ec24c76 100644
> --- a/man2/ioctl_tty.2
> +++ b/man2/ioctl_tty.2
> @@ -77,6 +77,35 @@ The following four ioctls are just like
> .BR TCSETSW ,
> .BR TCSETSF ,
> except that they take a
> +.I "struct termios2\ *"
> +instead of a
> +.IR "struct termios\ *" .
> +.I "struct termios2\ *"
> +is defined in header file
Maybe s/in/in the/ ?
> +.IR "<asm/termbits.h>" .
Quotes are unnecessary here.
> +If struct member
> +.B c_cflag
> +contains
> +.B BOTHER
> +then baudrate is stored in struct members
> +.BR c_ispeed " and " c_ospeed
We always break this into:
.B c_ispeed
and
.B c_ospeed
> +as integer values.
> +These ioctls are not supported on all architectures.
> +.IP
> +.BI "TCGETS2 struct termios2 *" argp
Please follow the same style as in the rest of the page:
.TP
.B TCGETS2
Argument:
.BI "struct termios2 *" argp
Unless there's a good reason not to.
> +.IP
> +.BI "TCSETS2 const struct termios2 *" argp
> +.IP
> +.BI "TCSETSW2 const struct termios2 *" argp
> +.IP
> +.BI "TCSETSF2 const struct termios2 *" argp
> +.PP
> +The following four ioctls are just like
> +.BR TCGETS ,
> +.BR TCSETS ,
> +.BR TCSETSW ,
> +.BR TCSETSF ,
> +except that they take a
> .I "struct termio\ *"
> instead of a
> .IR "struct termios\ *" .
>
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-29 11:30 ` Alejandro Colomar (man-pages)
@ 2021-07-29 17:31 ` Pali Rohár
2021-07-29 23:39 ` Alejandro Colomar (man-pages)
0 siblings, 1 reply; 11+ messages in thread
From: Pali Rohár @ 2021-07-29 17:31 UTC (permalink / raw)
To: Alejandro Colomar (man-pages); +Cc: Michael Kerrisk, linux-man
Hello!
On Thursday 29 July 2021 13:30:11 Alejandro Colomar (man-pages) wrote:
> Hi Pali,
>
>
> On 7/26/21 12:55 AM, Pali Rohár wrote:
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
>
> Please see some comments below.
>
> Thanks,
>
> Alex
>
> > man2/ioctl_tty.2 | 29 +++++++++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> >
> > diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
> > index c8269070180f..0c3a8ec24c76 100644
> > --- a/man2/ioctl_tty.2
> > +++ b/man2/ioctl_tty.2
> > @@ -77,6 +77,35 @@ The following four ioctls are just like
> > .BR TCSETSW ,
> > .BR TCSETSF ,
> > except that they take a
> > +.I "struct termios2\ *"
> > +instead of a
> > +.IR "struct termios\ *" .
> > +.I "struct termios2\ *"
> > +is defined in header file
>
> Maybe s/in/in the/ ?
Ok, I will change it.
> > +.IR "<asm/termbits.h>" .
>
> Quotes are unnecessary here.
Ok.
> > +If struct member
> > +.B c_cflag
> > +contains
> > +.B BOTHER
> > +then baudrate is stored in struct members
> > +.BR c_ispeed " and " c_ospeed
>
> We always break this into:
>
> .B c_ispeed
> and
> .B c_ospeed
Ok.
> > +as integer values.
> > +These ioctls are not supported on all architectures.
> > +.IP
> > +.BI "TCGETS2 struct termios2 *" argp
>
> Please follow the same style as in the rest of the page:
>
> .TP
> .B TCGETS2
> Argument:
> .BI "struct termios2 *" argp
>
> Unless there's a good reason not to.
Few lines below in this file is:
.IR "struct termios\ *" .
.IP
.BI "TCGETA struct termio *" argp
.IP
.BI "TCSETA const struct termio *" argp
.IP
.BI "TCSETAW const struct termio *" argp
.IP
.BI "TCSETAF const struct termio *" argp
Therefore I used same style for TCGETS2...
So, how should I format this part to be consistent?
> > +.IP
> > +.BI "TCSETS2 const struct termios2 *" argp
> > +.IP
> > +.BI "TCSETSW2 const struct termios2 *" argp
> > +.IP
> > +.BI "TCSETSF2 const struct termios2 *" argp
> > +.PP
> > +The following four ioctls are just like
> > +.BR TCGETS ,
> > +.BR TCSETS ,
> > +.BR TCSETSW ,
> > +.BR TCSETSF ,
> > +except that they take a
> > .I "struct termio\ *"
> > instead of a
> > .IR "struct termios\ *" .
> >
>
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-29 17:31 ` Pali Rohár
@ 2021-07-29 23:39 ` Alejandro Colomar (man-pages)
2021-07-30 0:09 ` Pali Rohár
2021-07-30 0:21 ` Pali Rohár
0 siblings, 2 replies; 11+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-29 23:39 UTC (permalink / raw)
To: Pali Rohár; +Cc: Michael Kerrisk, linux-man
Hi Pali,
On 7/29/21 7:31 PM, Pali Rohár wrote:
>
>>> +.IR "<asm/termbits.h>" .
Is that the header that the user should include?
I don't know. I typically avoid 'asm/' includes, but maybe in this case
it's the correct one. Shouldn't the user maybe include <linux/termios.h>?
user@sqli:/usr/include$ grep -rn 'struct termios {'
asm-generic/termbits.h:12:struct termios {
user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
asm-generic/termios.h:12:#include <asm/termbits.h>
user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
linux/termios.h:6:#include <asm/termios.h>
user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
user@sqli:/usr/include$
>>> +These ioctls are not supported on all architectures.
>>> +.IP
>>> +.BI "TCGETS2 struct termios2 *" argp
>>
>> Please follow the same style as in the rest of the page:
>>
>> .TP
>> .B TCGETS2
>> Argument:
>> .BI "struct termios2 *" argp
>>
>> Unless there's a good reason not to.
>
> Few lines below in this file is:
>
> .IR "struct termios\ *" .
> .IP
> .BI "TCGETA struct termio *" argp
> .IP
> .BI "TCSETA const struct termio *" argp
> .IP
> .BI "TCSETAW const struct termio *" argp
> .IP
> .BI "TCSETAF const struct termio *" argp
>
> Therefore I used same style for TCGETS2...
>
> So, how should I format this part to be consistent?
Hmm, sorry, I didn't see those.
So there's a mix in the file.
The more correct form is the one I used, so please use that one (the one
with .TP)
Thanks,
Alex
>
>>> +.IP
>>> +.BI "TCSETS2 const struct termios2 *" argp
>>> +.IP
>>> +.BI "TCSETSW2 const struct termios2 *" argp
>>> +.IP
>>> +.BI "TCSETSF2 const struct termios2 *" argp
>>> +.PP
>>> +The following four ioctls are just like
>>> +.BR TCGETS ,
>>> +.BR TCSETS ,
>>> +.BR TCSETSW ,
>>> +.BR TCSETSF ,
>>> +except that they take a
>>> .I "struct termio\ *"
>>> instead of a
>>> .IR "struct termios\ *" .
>>>
>>
>>
>> --
>> Alejandro Colomar
>> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
>> http://www.alejandro-colomar.es/
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-29 23:39 ` Alejandro Colomar (man-pages)
@ 2021-07-30 0:09 ` Pali Rohár
2021-07-30 7:04 ` Alejandro Colomar (man-pages)
2021-07-30 0:21 ` Pali Rohár
1 sibling, 1 reply; 11+ messages in thread
From: Pali Rohár @ 2021-07-30 0:09 UTC (permalink / raw)
To: Alejandro Colomar (man-pages); +Cc: Michael Kerrisk, linux-man
Hello!
On Friday 30 July 2021 01:39:11 Alejandro Colomar (man-pages) wrote:
> Hi Pali,
>
> On 7/29/21 7:31 PM, Pali Rohár wrote:
> >
> > > > +.IR "<asm/termbits.h>" .
>
> Is that the header that the user should include?
Yes.
> I don't know. I typically avoid 'asm/' includes, but maybe in this case
> it's the correct one. Shouldn't the user maybe include <linux/termios.h>?
Problem is that you cannot include <linux/termios.h> together with
<sys/ioctl.h>. It cause redefinition of symbols and compile errors.
And without <sys/ioctl.h> you cannot call ioctl() function which
basically means that you cannot use TCGETS2 (as it is ioctl).
Probably this is a bug in glibc header files...
So currently it is needed to include <asm/termbits.h> file to use
TCGETS2 ioctl. I'm not sure if it is "correct", but it is the only
possible option for now about which I know (unless you want to
copy+paste structures and macros from that file into your program, to
avoid inclusion of asm/* files).
If you want, I can send a patch for ioctl_tty.2 example section with
simple C program to show how to use TCGETS2/TCSETS2 ioctl.
> user@sqli:/usr/include$ grep -rn 'struct termios {'
> asm-generic/termbits.h:12:struct termios {
> user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
> x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
> user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
> asm-generic/termios.h:12:#include <asm/termbits.h>
> user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
> x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
> user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
> linux/termios.h:6:#include <asm/termios.h>
> user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
> user@sqli:/usr/include$
>
>
> > > > +These ioctls are not supported on all architectures.
> > > > +.IP
> > > > +.BI "TCGETS2 struct termios2 *" argp
> > >
> > > Please follow the same style as in the rest of the page:
> > >
> > > .TP
> > > .B TCGETS2
> > > Argument:
> > > .BI "struct termios2 *" argp
> > >
> > > Unless there's a good reason not to.
> >
> > Few lines below in this file is:
> >
> > .IR "struct termios\ *" .
> > .IP
> > .BI "TCGETA struct termio *" argp
> > .IP
> > .BI "TCSETA const struct termio *" argp
> > .IP
> > .BI "TCSETAW const struct termio *" argp
> > .IP
> > .BI "TCSETAF const struct termio *" argp
> >
> > Therefore I used same style for TCGETS2...
> >
> > So, how should I format this part to be consistent?
>
>
> Hmm, sorry, I didn't see those.
Ah, now I see that Michael one hour later (after I sent this patch)
fixed above style to another. See commit aceee9e827e6.
But changed it to another new style:
.RS
.TS
lb l.
TCGETA \fBstruct termio *\fPargp
TCSETA \fBconst struct termio *\fPargp
TCSETAW \fBconst struct termio *\fPargp
TCSETAF \fBconst struct termio *\fPargp
.TE
.RE
> So there's a mix in the file.
> The more correct form is the one I used, so please use that one (the one
> with .TP)
So, could you check with Michael which style to use? Because now there
are 3 different (yours, Michael's and the one which was there before)
and I'm really not sure what is correct...
>
> Thanks,
>
> Alex
>
>
> >
> > > > +.IP
> > > > +.BI "TCSETS2 const struct termios2 *" argp
> > > > +.IP
> > > > +.BI "TCSETSW2 const struct termios2 *" argp
> > > > +.IP
> > > > +.BI "TCSETSF2 const struct termios2 *" argp
> > > > +.PP
> > > > +The following four ioctls are just like
> > > > +.BR TCGETS ,
> > > > +.BR TCSETS ,
> > > > +.BR TCSETSW ,
> > > > +.BR TCSETSF ,
> > > > +except that they take a
> > > > .I "struct termio\ *"
> > > > instead of a
> > > > .IR "struct termios\ *" .
> > > >
> > >
> > >
> > > --
> > > Alejandro Colomar
> > > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> > > http://www.alejandro-colomar.es/
>
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-29 23:39 ` Alejandro Colomar (man-pages)
2021-07-30 0:09 ` Pali Rohár
@ 2021-07-30 0:21 ` Pali Rohár
2021-07-30 7:59 ` Alejandro Colomar (man-pages)
1 sibling, 1 reply; 11+ messages in thread
From: Pali Rohár @ 2021-07-30 0:21 UTC (permalink / raw)
To: Alejandro Colomar (man-pages); +Cc: Michael Kerrisk, linux-man
On Friday 30 July 2021 01:39:11 Alejandro Colomar (man-pages) wrote:
> user@sqli:/usr/include$ grep -rn 'struct termios {'
> asm-generic/termbits.h:12:struct termios {
You have there a mistake. It is 'struct termios2', not 'struct termios'.
And for 'struct termios' it is more complicated as there are two
different 'struct termios'. One in file <bits/termios.h> (included from
<termios.h>) and one in file <asm-generic/termbits.h> (included from
<linux/termios.h>).
Function tcsetattr() uses 'struct termios' from <bits/termios.h> and
ioctl TCSETS uses 'struct termios' from <asm-generic/termbits.h>.
> user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
> x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
> user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
> asm-generic/termios.h:12:#include <asm/termbits.h>
> user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
> x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
> user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
> linux/termios.h:6:#include <asm/termios.h>
> user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
> user@sqli:/usr/include$
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-30 0:09 ` Pali Rohár
@ 2021-07-30 7:04 ` Alejandro Colomar (man-pages)
2021-07-30 10:56 ` Pali Rohár
0 siblings, 1 reply; 11+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-30 7:04 UTC (permalink / raw)
To: Pali Rohár; +Cc: Michael Kerrisk, linux-man, Glibc
CC += glibc
On 7/30/21 2:09 AM, Pali Rohár wrote:
> Hello!
>
> On Friday 30 July 2021 01:39:11 Alejandro Colomar (man-pages) wrote:
>> Hi Pali,
>>
>> On 7/29/21 7:31 PM, Pali Rohár wrote:
>>>
>>>>> +.IR "<asm/termbits.h>" .
>>
>> Is that the header that the user should include?
>
> Yes.
>
>> I don't know. I typically avoid 'asm/' includes, but maybe in this case
>> it's the correct one. Shouldn't the user maybe include <linux/termios.h>?
>
> Problem is that you cannot include <linux/termios.h> together with
> <sys/ioctl.h>. It cause redefinition of symbols and compile errors.
>
> And without <sys/ioctl.h> you cannot call ioctl() function which
> basically means that you cannot use TCGETS2 (as it is ioctl).
Seems fair.
>
> Probably this is a bug in glibc header files...
I CCed glibc just in case they want to comment.
>
> So currently it is needed to include <asm/termbits.h> file to use
> TCGETS2 ioctl. I'm not sure if it is "correct", but it is the only
> possible option for now about which I know (unless you want to
> copy+paste structures and macros from that file into your program, to
> avoid inclusion of asm/* files).
Re copy&paste: no thanks :)
>
> If you want, I can send a patch for ioctl_tty.2 example section with
> simple C program to show how to use TCGETS2/TCSETS2 ioctl.
Great! Please CC glibc in the patch.
>
>> user@sqli:/usr/include$ grep -rn 'struct termios {'
>> asm-generic/termbits.h:12:struct termios {
>> user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
>> x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
>> user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
>> asm-generic/termios.h:12:#include <asm/termbits.h>
>> user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
>> x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
>> user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
>> linux/termios.h:6:#include <asm/termios.h>
>> user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
>> user@sqli:/usr/include$
>>
>>
>>>>> +These ioctls are not supported on all architectures.
>>>>> +.IP
>>>>> +.BI "TCGETS2 struct termios2 *" argp
>>>>
>>>> Please follow the same style as in the rest of the page:
>>>>
>>>> .TP
>>>> .B TCGETS2
>>>> Argument:
>>>> .BI "struct termios2 *" argp
>>>>
>>>> Unless there's a good reason not to.
>>>
>>> Few lines below in this file is:
>>>
>>> .IR "struct termios\ *" .
>>> .IP
>>> .BI "TCGETA struct termio *" argp
>>> .IP
>>> .BI "TCSETA const struct termio *" argp
>>> .IP
>>> .BI "TCSETAW const struct termio *" argp
>>> .IP
>>> .BI "TCSETAF const struct termio *" argp
>>>
>>> Therefore I used same style for TCGETS2...
>>>
>>> So, how should I format this part to be consistent?
>>
>>
>> Hmm, sorry, I didn't see those.
>
> Ah, now I see that Michael one hour later (after I sent this patch)
> fixed above style to another. See commit aceee9e827e6.
>
> But changed it to another new style:
>
> .RS
> .TS
> lb l.
> TCGETA \fBstruct termio *\fPargp
> TCSETA \fBconst struct termio *\fPargp
> TCSETAW \fBconst struct termio *\fPargp
> TCSETAF \fBconst struct termio *\fPargp
> .TE
> .RE
>
>> So there's a mix in the file.
>> The more correct form is the one I used, so please use that one (the one
>> with .TP)
>
> So, could you check with Michael which style to use? Because now there
> are 3 different (yours, Michael's and the one which was there before)
> and I'm really not sure what is correct...
Sorry, I was also confused, as I had Michael's version, and didn't see
the table he reformatted, which I now understand was what you were doing
(in the old format). So if what you wrote corresponds to what Michael
reformatted, please use Michael's new format (the table).
Thanks,
Alex
>
>>
>> Thanks,
>>
>> Alex
>>
>>
>>>
>>>>> +.IP
>>>>> +.BI "TCSETS2 const struct termios2 *" argp
>>>>> +.IP
>>>>> +.BI "TCSETSW2 const struct termios2 *" argp
>>>>> +.IP
>>>>> +.BI "TCSETSF2 const struct termios2 *" argp
>>>>> +.PP
>>>>> +The following four ioctls are just like
>>>>> +.BR TCGETS ,
>>>>> +.BR TCSETS ,
>>>>> +.BR TCSETSW ,
>>>>> +.BR TCSETSF ,
>>>>> +except that they take a
>>>>> .I "struct termio\ *"
>>>>> instead of a
>>>>> .IR "struct termios\ *" .
>>>>>
>>>>
>>>>
>>>> --
>>>> Alejandro Colomar
>>>> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
>>>> http://www.alejandro-colomar.es/
>>
>>
>> --
>> Alejandro Colomar
>> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
>> http://www.alejandro-colomar.es/
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-30 0:21 ` Pali Rohár
@ 2021-07-30 7:59 ` Alejandro Colomar (man-pages)
0 siblings, 0 replies; 11+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-30 7:59 UTC (permalink / raw)
To: Pali Rohár; +Cc: Michael Kerrisk, linux-man, Glibc
Hi Pali,
On 7/30/21 2:21 AM, Pali Rohár wrote:
> On Friday 30 July 2021 01:39:11 Alejandro Colomar (man-pages) wrote:
>> user@sqli:/usr/include$ grep -rn 'struct termios {'
>> asm-generic/termbits.h:12:struct termios {
>
> You have there a mistake. It is 'struct termios2', not 'struct termios'.
>
> And for 'struct termios' it is more complicated as there are two
> different 'struct termios'. One in file <bits/termios.h> (included from
> <termios.h>) and one in file <asm-generic/termbits.h> (included from
> <linux/termios.h>).
>
> Function tcsetattr() uses 'struct termios' from <bits/termios.h> and
> ioctl TCSETS uses 'struct termios' from <asm-generic/termbits.h>.
Right.
Anyway, it is in the same header:
user@sqli:/usr/include$ grep -rn 'struct termios2' | grep -v define
asm-generic/termbits.h:21:struct termios2 {
Regards,
Alex
>
>> user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
>> x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
>> user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
>> asm-generic/termios.h:12:#include <asm/termbits.h>
>> user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
>> x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
>> user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
>> linux/termios.h:6:#include <asm/termios.h>
>> user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
>> user@sqli:/usr/include$
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-25 22:55 [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2 Pali Rohár
2021-07-29 11:30 ` Alejandro Colomar (man-pages)
@ 2021-07-30 10:48 ` Pali Rohár
2021-07-30 18:20 ` Alejandro Colomar (man-pages)
1 sibling, 1 reply; 11+ messages in thread
From: Pali Rohár @ 2021-07-30 10:48 UTC (permalink / raw)
To: linux-man, Alejandro Colomar, Michael Kerrisk
Cc: Marek Behún, libc-alpha
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Changes in v2:
* Remove information about asm/termbits.h (will be in followup patch)
* Style fixes
---
man2/ioctl_tty.2 | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
index 2a0effdae8ab..c1875530f0b1 100644
--- a/man2/ioctl_tty.2
+++ b/man2/ioctl_tty.2
@@ -77,6 +77,35 @@ The following four ioctls are just like
.BR TCSETSW ,
.BR TCSETSF ,
except that they take a
+.I "struct termios2\ *"
+instead of a
+.IR "struct termios\ *" .
+If struct member
+.B c_cflag
+contains
+.B BOTHER
+then baudrate is stored in struct members
+.B c_ispeed
+and
+.B c_ospeed
+as integer values.
+These ioctls are not supported on all architectures.
+.RS
+.TS
+lb l.
+TCGETS2 \fBstruct termios2 *\fPargp
+TCSETS2 \fBconst struct termios2 *\fPargp
+TCSETSW2 \fBconst struct termios2 *\fPargp
+TCSETSF2 \fBconst struct termios2 *\fPargp
+.TE
+.RE
+.PP
+The following four ioctls are just like
+.BR TCGETS ,
+.BR TCSETS ,
+.BR TCSETSW ,
+.BR TCSETSF ,
+except that they take a
.I "struct termio\ *"
instead of a
.IR "struct termios\ *" .
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-30 7:04 ` Alejandro Colomar (man-pages)
@ 2021-07-30 10:56 ` Pali Rohár
0 siblings, 0 replies; 11+ messages in thread
From: Pali Rohár @ 2021-07-30 10:56 UTC (permalink / raw)
To: Alejandro Colomar (man-pages); +Cc: Michael Kerrisk, linux-man, Glibc
On Friday 30 July 2021 09:04:46 Alejandro Colomar (man-pages) wrote:
> CC += glibc
>
> On 7/30/21 2:09 AM, Pali Rohár wrote:
> > Hello!
> >
> > On Friday 30 July 2021 01:39:11 Alejandro Colomar (man-pages) wrote:
> > > Hi Pali,
> > >
> > > On 7/29/21 7:31 PM, Pali Rohár wrote:
> > > >
> > > > > > +.IR "<asm/termbits.h>" .
> > >
> > > Is that the header that the user should include?
> >
> > Yes.
> >
> > > I don't know. I typically avoid 'asm/' includes, but maybe in this case
> > > it's the correct one. Shouldn't the user maybe include <linux/termios.h>?
> >
> > Problem is that you cannot include <linux/termios.h> together with
> > <sys/ioctl.h>. It cause redefinition of symbols and compile errors.
> >
> > And without <sys/ioctl.h> you cannot call ioctl() function which
> > basically means that you cannot use TCGETS2 (as it is ioctl).
>
> Seems fair.
>
> >
> > Probably this is a bug in glibc header files...
>
> I CCed glibc just in case they want to comment.
>
> >
> > So currently it is needed to include <asm/termbits.h> file to use
> > TCGETS2 ioctl. I'm not sure if it is "correct", but it is the only
> > possible option for now about which I know (unless you want to
> > copy+paste structures and macros from that file into your program, to
> > avoid inclusion of asm/* files).
>
> Re copy&paste: no thanks :)
>
> >
> > If you want, I can send a patch for ioctl_tty.2 example section with
> > simple C program to show how to use TCGETS2/TCSETS2 ioctl.
>
> Great! Please CC glibc in the patch.
>
> >
> > > user@sqli:/usr/include$ grep -rn 'struct termios {'
> > > asm-generic/termbits.h:12:struct termios {
> > > user@sqli:/usr/include$ grep -rn '<asm-generic/termbits.h>'
> > > x86_64-linux-gnu/asm/termbits.h:1:#include <asm-generic/termbits.h>
> > > user@sqli:/usr/include$ grep -rn '<asm/termbits.h>'
> > > asm-generic/termios.h:12:#include <asm/termbits.h>
> > > user@sqli:/usr/include$ grep -rn '<asm-generic/termios.h>'
> > > x86_64-linux-gnu/asm/termios.h:1:#include <asm-generic/termios.h>
> > > user@sqli:/usr/include$ grep -rn '<asm/termios.h>'
> > > linux/termios.h:6:#include <asm/termios.h>
> > > user@sqli:/usr/include$ grep -rn '<linux/termios.h>'
> > > user@sqli:/usr/include$
> > >
> > >
> > > > > > +These ioctls are not supported on all architectures.
> > > > > > +.IP
> > > > > > +.BI "TCGETS2 struct termios2 *" argp
> > > > >
> > > > > Please follow the same style as in the rest of the page:
> > > > >
> > > > > .TP
> > > > > .B TCGETS2
> > > > > Argument:
> > > > > .BI "struct termios2 *" argp
> > > > >
> > > > > Unless there's a good reason not to.
> > > >
> > > > Few lines below in this file is:
> > > >
> > > > .IR "struct termios\ *" .
> > > > .IP
> > > > .BI "TCGETA struct termio *" argp
> > > > .IP
> > > > .BI "TCSETA const struct termio *" argp
> > > > .IP
> > > > .BI "TCSETAW const struct termio *" argp
> > > > .IP
> > > > .BI "TCSETAF const struct termio *" argp
> > > >
> > > > Therefore I used same style for TCGETS2...
> > > >
> > > > So, how should I format this part to be consistent?
> > >
> > >
> > > Hmm, sorry, I didn't see those.
> >
> > Ah, now I see that Michael one hour later (after I sent this patch)
> > fixed above style to another. See commit aceee9e827e6.
> >
> > But changed it to another new style:
> >
> > .RS
> > .TS
> > lb l.
> > TCGETA \fBstruct termio *\fPargp
> > TCSETA \fBconst struct termio *\fPargp
> > TCSETAW \fBconst struct termio *\fPargp
> > TCSETAF \fBconst struct termio *\fPargp
> > .TE
> > .RE
> >
> > > So there's a mix in the file.
> > > The more correct form is the one I used, so please use that one (the one
> > > with .TP)
> >
> > So, could you check with Michael which style to use? Because now there
> > are 3 different (yours, Michael's and the one which was there before)
> > and I'm really not sure what is correct...
>
> Sorry, I was also confused, as I had Michael's version, and didn't see the
> table he reformatted, which I now understand was what you were doing (in the
> old format). So if what you wrote corresponds to what Michael reformatted,
> please use Michael's new format (the table).
>
> Thanks,
>
> Alex
Hello! Now I sent a new version and reformatted this part according to
Michael style.
> >
> > >
> > > Thanks,
> > >
> > > Alex
> > >
> > >
> > > >
> > > > > > +.IP
> > > > > > +.BI "TCSETS2 const struct termios2 *" argp
> > > > > > +.IP
> > > > > > +.BI "TCSETSW2 const struct termios2 *" argp
> > > > > > +.IP
> > > > > > +.BI "TCSETSF2 const struct termios2 *" argp
> > > > > > +.PP
> > > > > > +The following four ioctls are just like
> > > > > > +.BR TCGETS ,
> > > > > > +.BR TCSETS ,
> > > > > > +.BR TCSETSW ,
> > > > > > +.BR TCSETSF ,
> > > > > > +except that they take a
> > > > > > .I "struct termio\ *"
> > > > > > instead of a
> > > > > > .IR "struct termios\ *" .
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Alejandro Colomar
> > > > > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> > > > > http://www.alejandro-colomar.es/
> > >
> > >
> > > --
> > > Alejandro Colomar
> > > Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> > > http://www.alejandro-colomar.es/
>
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
2021-07-30 10:48 ` [PATCH v2] " Pali Rohár
@ 2021-07-30 18:20 ` Alejandro Colomar (man-pages)
0 siblings, 0 replies; 11+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-07-30 18:20 UTC (permalink / raw)
To: Pali Rohár; +Cc: Marek Behún, linux-man, libc-alpha, Michael Kerrisk
Hi Pali,
On 7/30/21 12:48 PM, Pali Rohár wrote:
> Signed-off-by: Pali Rohár <pali@kernel.org>
>
Patch applied. Thanks,
Alex
> ---
> Changes in v2:
> * Remove information about asm/termbits.h (will be in followup patch)
> * Style fixes
> ---
> man2/ioctl_tty.2 | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/man2/ioctl_tty.2 b/man2/ioctl_tty.2
> index 2a0effdae8ab..c1875530f0b1 100644
> --- a/man2/ioctl_tty.2
> +++ b/man2/ioctl_tty.2
> @@ -77,6 +77,35 @@ The following four ioctls are just like
> .BR TCSETSW ,
> .BR TCSETSF ,
> except that they take a
> +.I "struct termios2\ *"
> +instead of a
> +.IR "struct termios\ *" .
> +If struct member
> +.B c_cflag
> +contains
> +.B BOTHER
> +then baudrate is stored in struct members
> +.B c_ispeed
> +and
> +.B c_ospeed
> +as integer values.
> +These ioctls are not supported on all architectures.
> +.RS
> +.TS
> +lb l.
> +TCGETS2 \fBstruct termios2 *\fPargp
> +TCSETS2 \fBconst struct termios2 *\fPargp
> +TCSETSW2 \fBconst struct termios2 *\fPargp
> +TCSETSF2 \fBconst struct termios2 *\fPargp
> +.TE
> +.RE
> +.PP
> +The following four ioctls are just like
> +.BR TCGETS ,
> +.BR TCSETS ,
> +.BR TCSETSW ,
> +.BR TCSETSF ,
> +except that they take a
> .I "struct termio\ *"
> instead of a
> .IR "struct termios\ *" .
>
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-07-30 18:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 22:55 [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2 Pali Rohár
2021-07-29 11:30 ` Alejandro Colomar (man-pages)
2021-07-29 17:31 ` Pali Rohár
2021-07-29 23:39 ` Alejandro Colomar (man-pages)
2021-07-30 0:09 ` Pali Rohár
2021-07-30 7:04 ` Alejandro Colomar (man-pages)
2021-07-30 10:56 ` Pali Rohár
2021-07-30 0:21 ` Pali Rohár
2021-07-30 7:59 ` Alejandro Colomar (man-pages)
2021-07-30 10:48 ` [PATCH v2] " Pali Rohár
2021-07-30 18:20 ` Alejandro Colomar (man-pages)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.