X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Tue, 8 Nov 2011 00:56:23 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: ptsname_r Message-ID: <20111108055623.GB11449@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4EB82DF9 DOT 7080408 AT redhat DOT com> <20111107193521 DOT GA30056 AT ednor DOT casa DOT cgf DOT cx> <4EB8437B DOT 5090600 AT redhat DOT com> <4EB843B4 DOT 4030605 AT redhat DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EB843B4.4030605@redhat.com> 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 Mon, Nov 07, 2011 at 01:46:44PM -0700, Eric Blake wrote: >On 11/07/2011 01:45 PM, Eric Blake wrote: >> On 11/07/2011 12:35 PM, Christopher Faylor wrote: >>> On Mon, Nov 07, 2011 at 12:14:01PM -0700, Eric Blake wrote: >>>> Since ptsname() is not thread-safe on all platforms, it would be nice if >>>> cygwin could also export ptsname_r() to match glibc. >>>> >>>> If no one beats me to it, I'll try and submit patches this week. >>> >>> I'll do it. I've been in this code recently so it's fresh in my mind. >> >> Thanks. Also, even with your patches of today, ptsname() is still not >> thread-safe; should we be sticking that in a thread-local buffer rather >> than in static storage, similar to how other functions like strerror() >> are thread-safe? > >Also, should we have an efault handler in syscalls.cc ptsname_r(), >similar to ttyname_r(), so as to gracefully reject invalid buffers >rather than faulting? I actually carefully followed exactly what was described in the Linux man page. If you pass an invalid pointer to ptsname_r on Linux it seg faults. cgf -- 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