Re: [PATCH] ttyname.3: document ENODEV error code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx> 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: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux