public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ptsname_r
@ 2011-11-07 19:14 Eric Blake
  2011-11-07 19:35 ` ptsname_r Christopher Faylor
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2011-11-07 19:14 UTC (permalink / raw)
  To: cygwin

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.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ptsname_r
  2011-11-07 19:14 ptsname_r Eric Blake
@ 2011-11-07 19:35 ` Christopher Faylor
  2011-11-07 20:46   ` ptsname_r Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Faylor @ 2011-11-07 19:35 UTC (permalink / raw)
  To: cygwin

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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ptsname_r
  2011-11-07 20:46   ` ptsname_r Eric Blake
@ 2011-11-07 20:46     ` Eric Blake
  2011-11-08  5:56       ` ptsname_r Christopher Faylor
  2011-11-08  5:53     ` ptsname_r Christopher Faylor
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2011-11-07 20:46 UTC (permalink / raw)
  To: Eric Blake; +Cc: cygwin

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?

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ptsname_r
  2011-11-07 19:35 ` ptsname_r Christopher Faylor
@ 2011-11-07 20:46   ` Eric Blake
  2011-11-07 20:46     ` ptsname_r Eric Blake
  2011-11-08  5:53     ` ptsname_r Christopher Faylor
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Blake @ 2011-11-07 20:46 UTC (permalink / raw)
  To: cygwin

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?

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ptsname_r
  2011-11-07 20:46   ` ptsname_r Eric Blake
  2011-11-07 20:46     ` ptsname_r Eric Blake
@ 2011-11-08  5:53     ` Christopher Faylor
  1 sibling, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2011-11-08  5:53 UTC (permalink / raw)
  To: cygwin

On Mon, Nov 07, 2011 at 01:45:47PM -0700, 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?

Why would we do that when it hasn't been thread-safe for years and it is
acceptable behavior for it not to be.  The thread-local storage is
precious and I don't see a pressing need for this to be thread-safe.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ptsname_r
  2011-11-07 20:46     ` ptsname_r Eric Blake
@ 2011-11-08  5:56       ` Christopher Faylor
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Faylor @ 2011-11-08  5:56 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-08  5:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 19:14 ptsname_r Eric Blake
2011-11-07 19:35 ` ptsname_r Christopher Faylor
2011-11-07 20:46   ` ptsname_r Eric Blake
2011-11-07 20:46     ` ptsname_r Eric Blake
2011-11-08  5:56       ` ptsname_r Christopher Faylor
2011-11-08  5:53     ` ptsname_r Christopher Faylor

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).