public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: "Pali Rohár" <pali@kernel.org>, linux-man@vger.kernel.org
Subject: Re: cfsetispeed and zero baudrate
Date: Mon, 30 Aug 2021 13:04:18 +0200	[thread overview]
Message-ID: <5dc2196a-9a2a-1b2e-e6ee-3539a62aad82@gmail.com> (raw)
In-Reply-To: <20210830103855.kv2ykg34m3eorrel@pali>

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/

  reply	other threads:[~2021-08-30 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 10:38 cfsetispeed and zero baudrate Pali Rohár
2021-08-30 11:04 ` Alejandro Colomar (man-pages) [this message]
2021-08-30 11:25   ` [PATCH] termios.3: Clarify zero argument for cfsetispeed() Pali Rohár
2021-08-31  0:25     ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5dc2196a-9a2a-1b2e-e6ee-3539a62aad82@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=pali@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox