Re: [PATCH] ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux