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, Sep 23, 2022 at 01:26:00PM +0200, Anthony Mallet wrote:
> On Friday 23 Sep 2022, at 10:29, RVP wrote:
> > So, O_NONBLOCK is, at least, _definitely_ non-portable. Best to use
> > fcntl() here and not depend on a Linux-specific behaviour.
> 
> Fair enough :)
> 
> Then, shouldn't the open(2) (and posix_openpt(3)) at least fail with
> EINVAL or something if other flags are specified?

The man page says:

     Note that unlike implementations on some other operating systems,
     posix_openpt() does not return EINVAL if the value of oflag would be
     deemed invalid, instead it is simply ignored.  This means it is not
     possible to dynamically test which open(2) flags are possible to set, and
     apply a fallback if EINVAL is received.

Martin


Home | Main Index | Thread Index | Old Index