From: Joseph Myers <joseph@codesourcery.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>,
<libc-alpha@sourceware.org>, <stgraber@stgraber.org>,
<serge@hallyn.com>
Subject: Re: [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd
Date: Mon, 28 Aug 2017 11:39:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1708281137460.17216@digraph.polyomino.org.uk> (raw)
In-Reply-To: <3496d984-a55e-d56b-2c25-a23200327dca@redhat.com>
On Mon, 28 Aug 2017, Florian Weimer wrote:
> On 08/26/2017 03:44 PM, Christian Brauner wrote:
> > +#ifdef TIOCGPTPEER
> > + slave = ioctl (master, TIOCGPTPEER, O_RDWR | O_NOCTTY);
> > +#else
> > if (pts_name (master, &buf, sizeof (_buf)))
> > goto fail;
> >
> > slave = open (buf, O_RDWR | O_NOCTTY);
> > +#endif
>
> I don't think you can #ifdef out existing code this way without
> introducing failures on older kernels. You need to try the ioctl first,
> and if that fails, use the old pts_name code.
And in principle there should be appropriate __ASSUME_* conditionals so
that when building with a new-enough --enable-kernel the old code can be
conditioned out (however, because this code is not Linux-specific, the old
case would need to stay in the code even when __ASSUME_TIOCGPTPEER is
defined unconditionally in the Linux kernel-features.h).
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2017-08-28 11:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-26 14:21 [PATCH 1/2] openpty: close slave pty fd on error Christian Brauner
2017-08-26 14:21 ` [PATCH 2/2] openpty: use TIOCGPTPEER to open slave side fd Christian Brauner
2017-08-28 7:34 ` Florian Weimer
2017-08-28 11:14 ` Christian Brauner
2017-08-28 11:39 ` Joseph Myers [this message]
2017-08-28 12:11 ` [PATCH 2/2 v2] " Christian Brauner
2017-08-28 12:22 ` Joseph Myers
2017-08-28 12:34 ` Andreas Schwab
2017-08-28 12:51 ` [PATCH 2/2 v3] " Christian Brauner
2017-08-29 9:07 ` [PATCH 1/2] openpty: close slave pty fd on error Florian Weimer
2017-08-29 13:46 ` [PATCH 1/2 v4] " Christian Brauner
2017-08-29 13:46 ` [PATCH 2/2 v4] openpty: use TIOCGPTPEER to open slave side fd Christian Brauner
2017-08-29 14:00 ` [PATCH 1/2 v4] openpty: close slave pty fd on error Andreas Schwab
2017-08-29 14:12 ` Christian Brauner
2017-08-29 14:31 ` [PATCH 1/2 v5] " Christian Brauner
2017-08-29 14:31 ` [PATCH 2/2 v5] openpty: use TIOCGPTPEER to open slave side fd Christian Brauner
2017-09-10 17:45 ` [PATCH 1/2 v5] openpty: close slave pty fd on error Christian Brauner
2017-09-20 10:53 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1708281137460.17216@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=christian.brauner@ubuntu.com \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=serge@hallyn.com \
--cc=stgraber@stgraber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).