All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ttyname.3: document ENODEV error code
@ 2017-03-20 20:51 Dmitry V. Levin
       [not found] ` <CAPP7u0WL2wa2MLavq22q616=-pHNPyNXqLpPGzR4JqYzGA16-A@mail.gmail.com>
       [not found] ` <20170320205104.GA27434-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry V. Levin @ 2017-03-20 20:51 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: Christian Brauner, linux-man-u79uwXL29TY76Z2rM5mHXA

---
 man3/ttyname.3 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/man3/ttyname.3 b/man3/ttyname.3
index 14c24e7..0be50c6 100644
--- a/man3/ttyname.3
+++ b/man3/ttyname.3
@@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
 .RB ( ttyname_r ())
 .I buflen
 was too small to allow storing the pathname.
+.TP
+.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
+.B ENODEV
+File descriptor refers to a slave pseudoterminal device
+but the corresponding pathname could not be found.
 .SH ATTRIBUTES
 For an explanation of the terms used in this section, see
 .BR attributes (7).
@@ -92,4 +97,5 @@ POSIX.1-2001, POSIX.1-2008, 4.2BSD.
 .BR tty (1),
 .BR fstat (2),
 .BR ctermid (3),
-.BR isatty (3)
+.BR isatty (3),
+.BR pts (4)

-- 
ldv
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found]   ` <CAPP7u0WL2wa2MLavq22q616=-pHNPyNXqLpPGzR4JqYzGA16-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-03-20 21:58     ` Dmitry V. Levin
       [not found]       ` <20170320215823.GA28075-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry V. Levin @ 2017-03-20 21:58 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Michael Kerrisk, linux-man-u79uwXL29TY76Z2rM5mHXA, Serge Hallyn,
	Stéphane Graber

[-- Attachment #1: Type: text/plain, Size: 1710 bytes --]

Hi,

On Mon, Mar 20, 2017 at 10:02:15PM +0100, Christian Brauner wrote:
> Hi,
> 
> Thanks Dmitry. One comment
> 
> On 20 Mar 2017 9:51 p.m., "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
> 
> ---
>  man3/ttyname.3 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/man3/ttyname.3 b/man3/ttyname.3
> index 14c24e7..0be50c6 100644
> --- a/man3/ttyname.3
> +++ b/man3/ttyname.3
> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>  .RB ( ttyname_r ())
>  .I buflen
>  was too small to allow storing the pathname.
> +.TP
> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
> +.B ENODEV
> +File descriptor refers to a slave pseudoterminal device
> +but the corresponding pathname could not be found.
> 
> I think it would be good to explicitly mention that ENODEV is set in case
> the fd does not refer to a pts device in its namespace. Otherwise users
> might take this as an indication that this is a more generic error which is
> not the case.

In fact, this is a more generic error than a namespace mismatch, although
the latter is the most likely reason.

Imagine that the corresponding file inside /dev/pts/ is not available for
some reason and the stat call has failed.  This situation could be
reproduced e.g. by bind-mounting an empty directory to /dev/pts.
A subsequent ttyname invocation would end up with ENODEV because the device
is literally not available although it's withing the same namespace.

I don't mind if you change the description to mention the namespace case
as the most likely, but please do not make it the only case when ENODEV
can happen.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found] ` <20170320205104.GA27434-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-03-24 14:40   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-03-24 14:40 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, Christian Brauner,
	linux-man-u79uwXL29TY76Z2rM5mHXA

On 03/20/2017 09:51 PM, Dmitry V. Levin wrote:
> ---
>  man3/ttyname.3 | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Thanks, Dmitry! Applied.

Cheers,

Michael

> diff --git a/man3/ttyname.3 b/man3/ttyname.3
> index 14c24e7..0be50c6 100644
> --- a/man3/ttyname.3
> +++ b/man3/ttyname.3
> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>  .RB ( ttyname_r ())
>  .I buflen
>  was too small to allow storing the pathname.
> +.TP
> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
> +.B ENODEV
> +File descriptor refers to a slave pseudoterminal device
> +but the corresponding pathname could not be found.
>  .SH ATTRIBUTES
>  For an explanation of the terms used in this section, see
>  .BR attributes (7).
> @@ -92,4 +97,5 @@ POSIX.1-2001, POSIX.1-2008, 4.2BSD.
>  .BR tty (1),
>  .BR fstat (2),
>  .BR ctermid (3),
> -.BR isatty (3)
> +.BR isatty (3),
> +.BR pts (4)
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found]       ` <20170320215823.GA28075-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-03-24 14:40         ` Michael Kerrisk (man-pages)
       [not found]           ` <a3314168-ac99-28ef-2916-4da65adc8377-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-03-24 14:40 UTC (permalink / raw)
  To: Dmitry V. Levin, Christian Brauner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Serge Hallyn,
	Stéphane Graber

Hi Dmitry,

On 03/20/2017 10:58 PM, Dmitry V. Levin wrote:
> Hi,
> 
> On Mon, Mar 20, 2017 at 10:02:15PM +0100, Christian Brauner wrote:
>> Hi,
>>
>> Thanks Dmitry. One comment
>>
>> On 20 Mar 2017 9:51 p.m., "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
>>
>> ---
>>  man3/ttyname.3 | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/man3/ttyname.3 b/man3/ttyname.3
>> index 14c24e7..0be50c6 100644
>> --- a/man3/ttyname.3
>> +++ b/man3/ttyname.3
>> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>>  .RB ( ttyname_r ())
>>  .I buflen
>>  was too small to allow storing the pathname.
>> +.TP
>> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>> +.B ENODEV
>> +File descriptor refers to a slave pseudoterminal device
>> +but the corresponding pathname could not be found.
>>
>> I think it would be good to explicitly mention that ENODEV is set in case
>> the fd does not refer to a pts device in its namespace. Otherwise users
>> might take this as an indication that this is a more generic error which is
>> not the case.
> 
> In fact, this is a more generic error than a namespace mismatch, although
> the latter is the most likely reason.
> 
> Imagine that the corresponding file inside /dev/pts/ is not available for
> some reason and the stat call has failed.  This situation could be
> reproduced e.g. by bind-mounting an empty directory to /dev/pts.
> A subsequent ttyname invocation would end up with ENODEV because the device
> is literally not available although it's withing the same namespace.
> 
> I don't mind if you change the description to mention the namespace case
> as the most likely, but please do not make it the only case when ENODEV
> can happen.

I'm open on this point. If someone wants to write a suitable patch, I'll
probably take it.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found]           ` <a3314168-ac99-28ef-2916-4da65adc8377-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-03-24 14:53             ` Christian Brauner
       [not found]               ` <CAPP7u0Ux2_pKFdS1X0_5SbR_MmvAmcR7+f=XcUOXWJ1Fr0naWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Brauner @ 2017-03-24 14:53 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages)
  Cc: Dmitry V. Levin, linux-man-u79uwXL29TY76Z2rM5mHXA, Serge Hallyn,
	Stéphane Graber

Sorry, for the late reply.

On Fri, Mar 24, 2017 at 3:40 PM, Michael Kerrisk (man-pages)
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Dmitry,
>
> On 03/20/2017 10:58 PM, Dmitry V. Levin wrote:
>> Hi,
>>
>> On Mon, Mar 20, 2017 at 10:02:15PM +0100, Christian Brauner wrote:
>>> Hi,
>>>
>>> Thanks Dmitry. One comment
>>>
>>> On 20 Mar 2017 9:51 p.m., "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
>>>
>>> ---
>>>  man3/ttyname.3 | 8 +++++++-
>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/man3/ttyname.3 b/man3/ttyname.3
>>> index 14c24e7..0be50c6 100644
>>> --- a/man3/ttyname.3
>>> +++ b/man3/ttyname.3
>>> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>>>  .RB ( ttyname_r ())
>>>  .I buflen
>>>  was too small to allow storing the pathname.
>>> +.TP
>>> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>>> +.B ENODEV
>>> +File descriptor refers to a slave pseudoterminal device
>>> +but the corresponding pathname could not be found.
>>>
>>> I think it would be good to explicitly mention that ENODEV is set in case
>>> the fd does not refer to a pts device in its namespace. Otherwise users
>>> might take this as an indication that this is a more generic error which is
>>> not the case.
>>
>> In fact, this is a more generic error than a namespace mismatch, although
>> the latter is the most likely reason.
>>
>> Imagine that the corresponding file inside /dev/pts/ is not available for
>> some reason and the stat call has failed.  This situation could be
>> reproduced e.g. by bind-mounting an empty directory to /dev/pts.
>> A subsequent ttyname invocation would end up with ENODEV because the device
>> is literally not available although it's withing the same namespace.
>>
>> I don't mind if you change the description to mention the namespace case
>> as the most likely, but please do not make it the only case when ENODEV
>> can happen.
>
> I'm open on this point. If someone wants to write a suitable patch, I'll
> probably take it.

This point is in my opinion crucial. The over-mounting scenario is
still a valid case for most programs that do not actually care about
what /dev/pts/<n> is actually used to go on which is a nice side-effect
of the patch. The namespace part should be mentioned since ttyname{_r}()
explicitly does not return anything when it detects that
/proc/self/fd/<n> points to /dev/pts/<n> but /dev/pts/<n> does not exist
in the same namespace. This was the original motivation when we
wrote the patch. So users that get ENODEV from ttyname{_r}() should
be aware that resolving the symlink manually afterwards doesn't give them
a /dev/pts/<n> path valid in the current namespace.

I'll put this on my TODO list but if someone is willing to send a
patch right away
please do so. :)

Christian
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found]               ` <CAPP7u0Ux2_pKFdS1X0_5SbR_MmvAmcR7+f=XcUOXWJ1Fr0naWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-03-26 12:47                 ` Michael Kerrisk (man-pages)
       [not found]                   ` <c3bc0470-b6a6-2ecb-dcb2-97e355c1e307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-03-26 12:47 UTC (permalink / raw)
  To: Christian Brauner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, Dmitry V. Levin,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Serge Hallyn,
	Stéphane Graber

On 03/24/2017 03:53 PM, Christian Brauner wrote:
> Sorry, for the late reply.
> 
> On Fri, Mar 24, 2017 at 3:40 PM, Michael Kerrisk (man-pages)
> <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hi Dmitry,
>>
>> On 03/20/2017 10:58 PM, Dmitry V. Levin wrote:
>>> Hi,
>>>
>>> On Mon, Mar 20, 2017 at 10:02:15PM +0100, Christian Brauner wrote:
>>>> Hi,
>>>>
>>>> Thanks Dmitry. One comment
>>>>
>>>> On 20 Mar 2017 9:51 p.m., "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
>>>>
>>>> ---
>>>>  man3/ttyname.3 | 8 +++++++-
>>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/man3/ttyname.3 b/man3/ttyname.3
>>>> index 14c24e7..0be50c6 100644
>>>> --- a/man3/ttyname.3
>>>> +++ b/man3/ttyname.3
>>>> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>>>>  .RB ( ttyname_r ())
>>>>  .I buflen
>>>>  was too small to allow storing the pathname.
>>>> +.TP
>>>> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>>>> +.B ENODEV
>>>> +File descriptor refers to a slave pseudoterminal device
>>>> +but the corresponding pathname could not be found.
>>>>
>>>> I think it would be good to explicitly mention that ENODEV is set in case
>>>> the fd does not refer to a pts device in its namespace. Otherwise users
>>>> might take this as an indication that this is a more generic error which is
>>>> not the case.
>>>
>>> In fact, this is a more generic error than a namespace mismatch, although
>>> the latter is the most likely reason.
>>>
>>> Imagine that the corresponding file inside /dev/pts/ is not available for
>>> some reason and the stat call has failed.  This situation could be
>>> reproduced e.g. by bind-mounting an empty directory to /dev/pts.
>>> A subsequent ttyname invocation would end up with ENODEV because the device
>>> is literally not available although it's withing the same namespace.
>>>
>>> I don't mind if you change the description to mention the namespace case
>>> as the most likely, but please do not make it the only case when ENODEV
>>> can happen.
>>
>> I'm open on this point. If someone wants to write a suitable patch, I'll
>> probably take it.
> 
> This point is in my opinion crucial. The over-mounting scenario is
> still a valid case for most programs that do not actually care about
> what /dev/pts/<n> is actually used to go on which is a nice side-effect
> of the patch. The namespace part should be mentioned since ttyname{_r}()
> explicitly does not return anything when it detects that
> /proc/self/fd/<n> points to /dev/pts/<n> but /dev/pts/<n> does not exist
> in the same namespace. This was the original motivation when we
> wrote the patch. So users that get ENODEV from ttyname{_r}() should
> be aware that resolving the symlink manually afterwards doesn't give them
> a /dev/pts/<n> path valid in the current namespace.
> 
> I'll put this on my TODO list but if someone is willing to send a
> patch right away
> please do so. :)

Hi Christian,

I think you may be best placed to know what you want to convey here.
I'd be happy to receive a patch.

Cheers,

Michael



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname.3: document ENODEV error code
       [not found]                   ` <c3bc0470-b6a6-2ecb-dcb2-97e355c1e307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-04-19 13:21                     ` Michael Kerrisk (man-pages)
       [not found]                       ` <8c7cb5df-bc2f-94d4-0a17-6efdf86f43b3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-04-19 13:21 UTC (permalink / raw)
  To: Christian Brauner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, Dmitry V. Levin,
	linux-man-u79uwXL29TY76Z2rM5mHXA, Serge Hallyn,
	Stéphane Graber

Hi Christian,

Pink on the below!

Cheers,

Michael


On 03/26/2017 02:47 PM, Michael Kerrisk (man-pages) wrote:
> On 03/24/2017 03:53 PM, Christian Brauner wrote:
>> Sorry, for the late reply.
>>
>> On Fri, Mar 24, 2017 at 3:40 PM, Michael Kerrisk (man-pages)
>> <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>> Hi Dmitry,
>>>
>>> On 03/20/2017 10:58 PM, Dmitry V. Levin wrote:
>>>> Hi,
>>>>
>>>> On Mon, Mar 20, 2017 at 10:02:15PM +0100, Christian Brauner wrote:
>>>>> Hi,
>>>>>
>>>>> Thanks Dmitry. One comment
>>>>>
>>>>> On 20 Mar 2017 9:51 p.m., "Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org> wrote:
>>>>>
>>>>> ---
>>>>>  man3/ttyname.3 | 8 +++++++-
>>>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/man3/ttyname.3 b/man3/ttyname.3
>>>>> index 14c24e7..0be50c6 100644
>>>>> --- a/man3/ttyname.3
>>>>> +++ b/man3/ttyname.3
>>>>> @@ -71,6 +71,11 @@ File descriptor does not refer to a terminal device.
>>>>>  .RB ( ttyname_r ())
>>>>>  .I buflen
>>>>>  was too small to allow storing the pathname.
>>>>> +.TP
>>>>> +.\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>>>>> +.B ENODEV
>>>>> +File descriptor refers to a slave pseudoterminal device
>>>>> +but the corresponding pathname could not be found.
>>>>>
>>>>> I think it would be good to explicitly mention that ENODEV is set in case
>>>>> the fd does not refer to a pts device in its namespace. Otherwise users
>>>>> might take this as an indication that this is a more generic error which is
>>>>> not the case.
>>>>
>>>> In fact, this is a more generic error than a namespace mismatch, although
>>>> the latter is the most likely reason.
>>>>
>>>> Imagine that the corresponding file inside /dev/pts/ is not available for
>>>> some reason and the stat call has failed.  This situation could be
>>>> reproduced e.g. by bind-mounting an empty directory to /dev/pts.
>>>> A subsequent ttyname invocation would end up with ENODEV because the device
>>>> is literally not available although it's withing the same namespace.
>>>>
>>>> I don't mind if you change the description to mention the namespace case
>>>> as the most likely, but please do not make it the only case when ENODEV
>>>> can happen.
>>>
>>> I'm open on this point. If someone wants to write a suitable patch, I'll
>>> probably take it.
>>
>> This point is in my opinion crucial. The over-mounting scenario is
>> still a valid case for most programs that do not actually care about
>> what /dev/pts/<n> is actually used to go on which is a nice side-effect
>> of the patch. The namespace part should be mentioned since ttyname{_r}()
>> explicitly does not return anything when it detects that
>> /proc/self/fd/<n> points to /dev/pts/<n> but /dev/pts/<n> does not exist
>> in the same namespace. This was the original motivation when we
>> wrote the patch. So users that get ENODEV from ttyname{_r}() should
>> be aware that resolving the symlink manually afterwards doesn't give them
>> a /dev/pts/<n> path valid in the current namespace.
>>
>> I'll put this on my TODO list but if someone is willing to send a
>> patch right away
>> please do so. :)
> 
> Hi Christian,
> 
> I think you may be best placed to know what you want to convey here.
> I'd be happy to receive a patch.
> 
> Cheers,
> 
> Michael
> 
> 
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] ttyname(3): add NOTES section
       [not found]                       ` <8c7cb5df-bc2f-94d4-0a17-6efdf86f43b3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-04-21 20:05                         ` Christian Brauner
       [not found]                           ` <20170421200509.23616-1-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Brauner @ 2017-04-21 20:05 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, ldv-u2l5PoMzF/Vg9hUCZPvPmw,
	linux-man-u79uwXL29TY76Z2rM5mHXA, serge-A9i7LUbDfNHQT0dZR+AlfA,
	stgraber-GeWIH/nMZzLQT0dZR+AlfA
  Cc: Christian Brauner

Signed-off-by: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
---
 man3/ttyname.3 | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/man3/ttyname.3 b/man3/ttyname.3
index 0be50c62a..f184b4505 100644
--- a/man3/ttyname.3
+++ b/man3/ttyname.3
@@ -75,7 +75,7 @@ was too small to allow storing the pathname.
 .\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
 .B ENODEV
 File descriptor refers to a slave pseudoterminal device
-but the corresponding pathname could not be found.
+but the corresponding pathname could not be found (see NOTES).
 .SH ATTRIBUTES
 For an explanation of the terms used in this section, see
 .BR attributes (7).
@@ -93,6 +93,22 @@ T}	Thread safety	MT-Safe
 .TE
 .SH CONFORMING TO
 POSIX.1-2001, POSIX.1-2008, 4.2BSD.
+.SH NOTES
+Processes keeping a file descriptor to a
+.BR pts (4)
+device open when switching to
+.BR mount_namespaces (7)
+that use a different
+.IR /dev/ptmx
+instance may still accidently find that a device path of the same name
+for that file descriptor exists. However, this device path refers to a
+different device and thus cannot not be used to modify the device that
+the file descriptor refers to. Calling
+.BR ttyname (7)
+or
+.BR ttyname_r (7)
+on the file descriptor in such a mount namespace will cause these
+functions to return NULL and set errno to ENODEV.
 .SH SEE ALSO
 .BR tty (1),
 .BR fstat (2),
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname(3): add NOTES section
       [not found]                           ` <20170421200509.23616-1-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
@ 2017-04-23 11:52                             ` Dmitry V. Levin
       [not found]                               ` <20170423115237.GA26862-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
  2017-04-23 17:58                             ` Michael Kerrisk (man-pages)
  1 sibling, 1 reply; 11+ messages in thread
From: Dmitry V. Levin @ 2017-04-23 11:52 UTC (permalink / raw)
  To: Christian Brauner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, serge-A9i7LUbDfNHQT0dZR+AlfA,
	stgraber-GeWIH/nMZzLQT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]

On Fri, Apr 21, 2017 at 10:05:09PM +0200, Christian Brauner wrote:
> Signed-off-by: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
> ---
>  man3/ttyname.3 | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/man3/ttyname.3 b/man3/ttyname.3
> index 0be50c62a..f184b4505 100644
> --- a/man3/ttyname.3
> +++ b/man3/ttyname.3
> @@ -75,7 +75,7 @@ was too small to allow storing the pathname.
>  .\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>  .B ENODEV
>  File descriptor refers to a slave pseudoterminal device
> -but the corresponding pathname could not be found.
> +but the corresponding pathname could not be found (see NOTES).
>  .SH ATTRIBUTES
>  For an explanation of the terms used in this section, see
>  .BR attributes (7).
> @@ -93,6 +93,22 @@ T}	Thread safety	MT-Safe
>  .TE
>  .SH CONFORMING TO
>  POSIX.1-2001, POSIX.1-2008, 4.2BSD.
> +.SH NOTES
> +Processes keeping a file descriptor to a
> +.BR pts (4)
> +device open when switching to
> +.BR mount_namespaces (7)
> +that use a different
> +.IR /dev/ptmx
> +instance may still accidently find that a device path of the same name
> +for that file descriptor exists. However, this device path refers to a
> +different device and thus cannot not be used to modify the device that

s/to modify the device/to access the device/


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname(3): add NOTES section
       [not found]                               ` <20170423115237.GA26862-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
@ 2017-04-23 12:11                                 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-04-23 12:11 UTC (permalink / raw)
  To: Dmitry V. Levin, Christian Brauner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, serge-A9i7LUbDfNHQT0dZR+AlfA,
	stgraber-GeWIH/nMZzLQT0dZR+AlfA

On 04/23/2017 01:52 PM, Dmitry V. Levin wrote:
> On Fri, Apr 21, 2017 at 10:05:09PM +0200, Christian Brauner wrote:
>> Signed-off-by: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
>> ---
>>  man3/ttyname.3 | 18 +++++++++++++++++-
>>  1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/man3/ttyname.3 b/man3/ttyname.3
>> index 0be50c62a..f184b4505 100644
>> --- a/man3/ttyname.3
>> +++ b/man3/ttyname.3
>> @@ -75,7 +75,7 @@ was too small to allow storing the pathname.
>>  .\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>>  .B ENODEV
>>  File descriptor refers to a slave pseudoterminal device
>> -but the corresponding pathname could not be found.
>> +but the corresponding pathname could not be found (see NOTES).
>>  .SH ATTRIBUTES
>>  For an explanation of the terms used in this section, see
>>  .BR attributes (7).
>> @@ -93,6 +93,22 @@ T}	Thread safety	MT-Safe
>>  .TE
>>  .SH CONFORMING TO
>>  POSIX.1-2001, POSIX.1-2008, 4.2BSD.
>> +.SH NOTES
>> +Processes keeping a file descriptor to a
>> +.BR pts (4)
>> +device open when switching to
>> +.BR mount_namespaces (7)
>> +that use a different
>> +.IR /dev/ptmx
>> +instance may still accidently find that a device path of the same name
>> +for that file descriptor exists. However, this device path refers to a
>> +different device and thus cannot not be used to modify the device that
> 
> s/to modify the device/to access the device/

Thanks, Dmitry. Fixed!

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ttyname(3): add NOTES section
       [not found]                           ` <20170421200509.23616-1-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
  2017-04-23 11:52                             ` Dmitry V. Levin
@ 2017-04-23 17:58                             ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-04-23 17:58 UTC (permalink / raw)
  To: Christian Brauner, ldv-u2l5PoMzF/Vg9hUCZPvPmw,
	linux-man-u79uwXL29TY76Z2rM5mHXA, serge-A9i7LUbDfNHQT0dZR+AlfA,
	stgraber-GeWIH/nMZzLQT0dZR+AlfA
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w

Hello Christian,

On 04/21/2017 10:05 PM, Christian Brauner wrote:
> Signed-off-by: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>

Thanks! Applied.

Cheers,

Michael


> ---
>  man3/ttyname.3 | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/man3/ttyname.3 b/man3/ttyname.3
> index 0be50c62a..f184b4505 100644
> --- a/man3/ttyname.3
> +++ b/man3/ttyname.3
> @@ -75,7 +75,7 @@ was too small to allow storing the pathname.
>  .\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23
>  .B ENODEV
>  File descriptor refers to a slave pseudoterminal device
> -but the corresponding pathname could not be found.
> +but the corresponding pathname could not be found (see NOTES).
>  .SH ATTRIBUTES
>  For an explanation of the terms used in this section, see
>  .BR attributes (7).
> @@ -93,6 +93,22 @@ T}	Thread safety	MT-Safe
>  .TE
>  .SH CONFORMING TO
>  POSIX.1-2001, POSIX.1-2008, 4.2BSD.
> +.SH NOTES
> +Processes keeping a file descriptor to a
> +.BR pts (4)
> +device open when switching to
> +.BR mount_namespaces (7)
> +that use a different
> +.IR /dev/ptmx
> +instance may still accidently find that a device path of the same name
> +for that file descriptor exists. However, this device path refers to a
> +different device and thus cannot not be used to modify the device that
> +the file descriptor refers to. Calling
> +.BR ttyname (7)
> +or
> +.BR ttyname_r (7)
> +on the file descriptor in such a mount namespace will cause these
> +functions to return NULL and set errno to ENODEV.
>  .SH SEE ALSO
>  .BR tty (1),
>  .BR fstat (2),
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-04-23 17:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-20 20:51 [PATCH] ttyname.3: document ENODEV error code Dmitry V. Levin
     [not found] ` <CAPP7u0WL2wa2MLavq22q616=-pHNPyNXqLpPGzR4JqYzGA16-A@mail.gmail.com>
     [not found]   ` <CAPP7u0WL2wa2MLavq22q616=-pHNPyNXqLpPGzR4JqYzGA16-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-20 21:58     ` Dmitry V. Levin
     [not found]       ` <20170320215823.GA28075-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-03-24 14:40         ` Michael Kerrisk (man-pages)
     [not found]           ` <a3314168-ac99-28ef-2916-4da65adc8377-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-24 14:53             ` Christian Brauner
     [not found]               ` <CAPP7u0Ux2_pKFdS1X0_5SbR_MmvAmcR7+f=XcUOXWJ1Fr0naWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-26 12:47                 ` Michael Kerrisk (man-pages)
     [not found]                   ` <c3bc0470-b6a6-2ecb-dcb2-97e355c1e307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-19 13:21                     ` Michael Kerrisk (man-pages)
     [not found]                       ` <8c7cb5df-bc2f-94d4-0a17-6efdf86f43b3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-21 20:05                         ` [PATCH] ttyname(3): add NOTES section Christian Brauner
     [not found]                           ` <20170421200509.23616-1-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2017-04-23 11:52                             ` Dmitry V. Levin
     [not found]                               ` <20170423115237.GA26862-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-04-23 12:11                                 ` Michael Kerrisk (man-pages)
2017-04-23 17:58                             ` Michael Kerrisk (man-pages)
     [not found] ` <20170320205104.GA27434-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-03-24 14:40   ` [PATCH] ttyname.3: document ENODEV error code Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.