tech-kern archive

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

Re: Open master pty (/dev/ptmx) non blocking



On Fri, 23 Sep 2022, Anthony Mallet wrote:

* POSIX does not mention the flag as supported in posix_openpt(3) (it
 does not says it's not supported either :).


According to POSIX, anything other than O_RDWR or O_NOCTTY is "unspecified";
and, the FreeBSD man page explicitly states:

     O_RDWR         Open for reading and writing.

     O_NOCTTY       If set posix_openpt() shall not cause the terminal
                    device to become the controlling terminal for the
                    process.

     O_CLOEXEC      Set the close-on-exec flag for the new file
                    descriptor.

     The posix_openpt() function shall fail when oflag contains other
     values.

So, O_NONBLOCK is, at least, _definitely_ non-portable. Best to use fcntl()
here and not depend on a Linux-specific behaviour.

-RVP


Home | Main Index | Thread Index | Old Index