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 at 11:49:32 +0000 (UTC), RVP wrote:
On Fri, 23 Sep 2022, Anthony Mallet wrote:
Then, shouldn't the open(2) (and posix_openpt(3)) at least fail with
EINVAL or something if other flags are specified?

Yes, this was noticed recently by gutteridge@ (I think) who also
amended the manpage to what Martin just quoted (and which may not
have been pulled up to -9.x)

The other BSDs validate the oflag argument and return EINVAL if
anything supplied is inapplicable. This is also the case with recent
Solaris derivates (my test reference being OmniOS). What they
accept and where they validate varies, with OpenBSD doing so in
the posix_openpt function, and FreeBSD doing so in a lower layer (not
that that really matters here). This came up recently as I was
reviewing issues with vte support of NetBSD. The upstream was expecting
to be able to test for flag support via EINVAL responses, but that
didn't work for NetBSD, which instead would simply return an FD that
was stuck in an unusable state for their purposes and expectations.

It was on my (long) list of things to do to either mention this on a
mailing list like this or file a PR. It's not wrong from a POSIX
perspective as I read it. I'm not sure if there would be an appetite to
change it now -- consider this my question to the list. :)

I hadn't submitted a pullup request to update the man pages on stable
releases, as I wanted to ask about it first, and it seemed kind of
obscure (this is an unexpected coincidence). I can certainly do so.

Regards,

Dave


Home | Main Index | Thread Index | Old Index