From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by sourceware.org (Postfix) with ESMTPS id 30C813861034 for ; Mon, 12 Jul 2021 08:16:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30C813861034 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M4JVv-1m2a8Q2Q6r-000NDA for ; Mon, 12 Jul 2021 10:16:43 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id E0005A80CFE; Mon, 12 Jul 2021 10:16:42 +0200 (CEST) Date: Mon, 12 Jul 2021 10:16:42 +0200 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: cfsetspeed is not consistent with Linux Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <466e52fb-bda0-b5c0-f201-033a85e8de29@cornell.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <466e52fb-bda0-b5c0-f201-033a85e8de29@cornell.edu> X-Provags-ID: V03:K1:L0f3phNeKufen4X/+Be5IB3MlmitcmBiLZHWoiwna4gL7bz7+u/ chRHeFFit6YCTrHxkpykILJX+wiDnwbm+pMqmgh6G6njNCqctLusfr/3wi8Nvq/s8un9/5i H8LlRQsP83T6SCO0h97CH8KgToL6v+mi0v01vsoeRTnVIPblgtzWRnOpt93syXOVl5Sdz4W 939e0ZCRjJgz4rE/kpl+g== X-UI-Out-Filterresults: notjunk:1;V03:K0:uCyFDeAHkd4=:EEhREVDNeGiBH5hJcal/EO ahBrdFZnZQdCpSTP2XT3GS245vpZZB4nJe+sU2/ImCCwZXf2KADtsnFd/bj3FifaIK8VMshYr aGZEkb/04/gcb+7ubZub8DTDDy60HC9+Fh/Q7cCENmYrQ0fdMsS8L2D181/2lwzWsCjT1HMze tp7O8pvK2toyM5VeLWdssw+sV6iTSE0wI6igCEOgAWWMNcyAQw7z1BbJJEGsb/ftJnrvVO6uT RJ5+D7kplGWJDJ4Z0mokmL6xK+zebKmnu4JE2zdf6OZKs2L4R3x+l4rAWuV5h+c2APJiBAy2j e/PXrMrKnmt3RW/nrCd2ShbfzYiwNyq++6sQOMDh9GDpS7crtpzEBKz5olgLiLtfjRgK7RVsO 3OFFiqVm33eOBgl1vWfHCIiOLFhzOlJjHGA6cX3fuaAUjeOPbd2GrcXALYOmmvB/lEM2fn3d6 SoiaU92ToyDF5/qD49RPhR7Lahv6rNDzgZLpRnxx1sbwkMuzggBPy9Qy2xljQ0ynlc+f2vz7G P1ot4dwoiJDKQzkKVx6C6lhZdNqe4O06OXPjTKA5CAfqFQ+LkB2Q74XZnJMZfaVkfTV4TBEZP 6RS3mXe6MfqRnXvHIAHMTSm9oA3VBn0xgxUydZQi8FDbpnmZDanN7852jOX7IxfRIAMQAyIXN FRx9m362xEk11GvcLAdrQPKyXGS2I8AaP0F4GtdPA5Gukpampd7yfwMECEhF5HYlpmb7p0xIW TSnPq9tBmUUHYHQmhWP8aOaeyK7/izw2SOYSrTO9+OEHx6NzW8tVwZDvKRyKnByRMSr7rIE9P AH7rsBgXnc1d7YUQW1OmU6mplMv7NYbgqxogiJvCXVISKgvHMhaKjaDnbMO2RSCUTFgZLHyIi M8+Ows+lAFbc06WuguMA== X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2021 08:16:48 -0000 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