This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] linux ttyname and ttyname_r: return link if appropriate
- From: "Serge E. Hallyn" <serge at hallyn dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: "Serge E. Hallyn" <serge at hallyn dot com>, libc-alpha at sourceware dot org, Stéphane Graber <stgraber at ubuntu dot com>
- Date: Tue, 4 Oct 2016 07:47:39 -0500
- Subject: Re: [PATCH] linux ttyname and ttyname_r: return link if appropriate
- Authentication-results: sourceware.org; auth=none
- References: <20160806020855.GA19897@mail.hallyn.com> <20160806084559.GS6702@vapier.lan> <20160806150002.GA24315@mail.hallyn.com> <20160809211841.GB2566@altlinux.org> <20160809213937.GA3392@mail.hallyn.com> <b4f86770-9dbe-99aa-ac84-d4c6cc753189@redhat.com> <20160810230351.GA20138@mail.hallyn.com> <20160810231818.GA20183@altlinux.org> <20161003061602.GA5257@mail.hallyn.com> <55f31318-8aef-0cc6-aaa2-0e055f35e0dd@redhat.com>
On Tue, Oct 04, 2016 at 11:53:50AM +0200, Florian Weimer wrote:
> On 10/03/2016 08:16 AM, Serge E. Hallyn wrote:
>
> >+/* Return true if this is a UNIX98 pty device, as defined in
> >+ linux/Documentation/devices.txt. */
> >+static int
> >+is_pty (struct stat64 *sb)
> >+{
> >+#ifdef _STATBUF_ST_RDEV
> >+ int m = major (sb->st_rdev);
> >+ return (136 <= m && m <= 143);
> >+#else
> >+ return false;
> >+#endif
> >+}
> >+
>
> Ideally, this function should go into a separate header file which
> is included. A static inline function would be fine for this.
Yeah that would be nicer.
> >+ /* If the link doesn't exist, then it points to a device in another
> >+ namespace. If it is a UNIX98 pty, then return the /proc/self
> >+ fd, as it points to a name unreachable in our namespace. */
>
> This comment does not appear to be correct (the /proc/self part).
D'oh, yeah that's no longer true.