X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 14 Jun 2010 12:26:31 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Nonblocking serial ports Message-ID: <20100614102631.GB3723@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1276495179 DOT 5780 DOT 13 DOT camel AT YAAKOV04> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1276495179.5780.13.camel@YAAKOV04> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Jun 14 00:59, Yaakov S wrote: > I came across this while working on getting my Palm to hook up to > gnome-pilot over Bluetooth. COM3 is an incoming COM Port created within > Bluetooth Settings, although the STC has the same results on COM1 (a > standard serial port). > > Unlike pilot-link's tools and jpilot (all three use pilot-link's > libpisock under the hood), gnome-pilot open()s a serial port with > O_NONBLOCK when first started in order to initialize a GIOChannel, then > later pi_bind()s a different fd pointing to the same port. Works great > on Linux, but on Cygwin the latter call fails, as the serial port is > already blocked by the first open() call. FWIW, both pilot-xfer and > friends and jpilot work fine over the Bluetooth serial port, and all > three work over the network. > > Attached is a STC. On Linux, this succeeds, but on Cygwin (both 1.7.5 > and latest snapshot), it fails: > > second open(/dev/ttyS2) failed: Permission denied That's apparently a Windows restriction. Communication devices like serial or parallel ports can only be opened exclusively on the API level. It does not matter what sharing flags have been set when opening the file for the first time. Actually MSDN requies to set the sharing flags to 0 when opening comm devices, but Cygwi opens them with all sharing flags set, to no avail. Allowing to open a comm device more than once at a time would require some redesign in Cygwin, along the lines of what's done to propagate the pipe handles used for ttys to other processes. That would be a nice case of http://cygwin.com/acronyms/#PTC ... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple