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 ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org