Re: cfsetispeed and zero baudrate

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

 



Hello Pali!

On 8/30/21 12:38 PM, Pali Rohár wrote:
> Hello Alejandro!
> 
> Currently in cfsetispeed() documentation is written:
> 
>   If the input baud rate is set to zero, the input baud rate will be
>   equal to the output baud rate.
> 
> There is B0 constant which represents "zero baud rate". And also
> information that argument for cfsetispeed() (and also cfsetospeed())
> must be Bnnn constant.
> 
> But above quote documents special handling, "zero" here is really
> integer 0 and not pre-defined constant B0.
> 
> I think that phrase "If the input baud rate is set to zero" could be
> confusing, as based on requirement to use Bnnn constants somebody could
> interpret that "zero" as B0.
> 
> What do you think, should be above documentation part extended to
> express that "zero" is really integer 0 and not constant B0?
> 
> Some references:
> * glibc really checks for integer 0:
>   https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/speed.c;h=daac5ecde1f3695b8cb178002e8756895406087b;hb=HEAD#l86
> * POSIX describes that it is integer 0:
>   https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html

I think we should, as POSIX does, use literal `0` (and not mention
'zero' at all) to clearly differentiate it from the 'zero baud rate' B0.

Would you send a patch?

Thanks!

Alex

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