public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: cfsetspeed is not consistent with Linux
Date: Mon, 12 Jul 2021 10:16:42 +0200	[thread overview]
Message-ID: <YOv6an75uho0rRW7@calimero.vinschen.de> (raw)
In-Reply-To: <466e52fb-bda0-b5c0-f201-033a85e8de29@cornell.edu>

On Jul 11 12:33, Ken Brown via Cygwin wrote:
> While investigating an emacs bug
> (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49524), I noticed a
> difference in the behavior of cfsetspeed(3) on Cygwin and Linux.  I'm not
> sure we should "fix" this, because Cygwin's behavior is consistent with the
> Linux man page, and Linux's behavior is not.  But I thought I should point
> it out for the sake of discussion, because Cygwin generally tries to emulate
> Linux.  Here are the details:
> 
> The Linux man page for cfsetspeed(3) specifies that the speed argument must
> be one of the constants Bnnn (e.g., B9600) defined in termios.h.  But Linux
> in fact allows the speed to be the numerical baud rate (e.g., 9600).  Test
> case:
> [...]
> $ ./a.out
> Calling cfsetspeed with speed B9600
> cfgetispeed reports speed 13
> Calling cfsetspeed with speed 9600
> cfgetispeed reports speed 13
> 
> On Cygwin, however, the output of the same program is:
> 
> $ ./a
> Calling cfsetspeed with speed B9600
> cfgetispeed reports speed 13
> Calling cfsetspeed with speed 9600
> cfsetspeed: Invalid argument
> 
> If we decide that Cygwin should emulate Linux here, it would be a simple
> matter to copy the glibc code, which checks whether the speed is a numerical
> baud rate and, if so, converts it to a Bnnn constant.

We can do this too.  For historical reasons we should stay careful
taking over other GPLed code into the Cygwin DLL itself, but just
copying the speed_struct struct should be fine.


Corinna

      reply	other threads:[~2021-07-12  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-11 16:33 Ken Brown
2021-07-12  8:16 ` Corinna Vinschen [this message]

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=YOv6an75uho0rRW7@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).