bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

openpty needs a variant with a flags argument


From: Eric Blake
Subject: openpty needs a variant with a flags argument
Date: Fri, 04 Nov 2011 17:43:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15

openpty is worthless in a multithreaded app like libvirt - there's no way to make the master and slave fds atomically O_CLOEXEC; libvirt would also like O_NONBLOCK (although atomicity on that one is not as important); yet not using openpty() is also painful because of the need for ioctl() on Solaris and HP-UX before isatty() works on the slave. I know that glibc does not (yet) provide a flags variant of openpty, although I created a request:

http://sourceware.org/bugzilla/show_bug.cgi?id=13385

Should we go ahead and implement a safer openpty() in gnulib, while waiting for the glibc decision on that bug? On Linux, it could atomically set FD_CLOEXEC via the use of posix_openpt(O_CLOEXEC) and manual build-up of the rest of the openpty() functionality; elsewhere it wouldn't be atomic, but would be easier to use.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]