lkml.org 
[lkml]   [2008]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH,TRIVIAL] AF_UNIX, accept() and addrlen
Andi Kleen, le Mon 24 Mar 2008 12:50:10 +0100, a écrit :
> Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
>
> > David Miller, le Sun 23 Mar 2008 21:56:41 -0700, a écrit :
> > > From: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > > Date: Sat, 8 Mar 2008 02:23:21 +0000
> > >
> > > > Accept and getpeername are supposed to return the amount of bytes
> > > > written in the returned address. However, on unnamed sockets, only
> > > > sizeof(short) is returned, while a 0 is put in the sun_path member.
> > > > This patch adds 1 for that additional byte.
> > > >
> > > > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> > >
> > > This change isn't correct. It's the fact that the
> > > length returned is sizeof(short) that tells the caller
> > > that the unix socket is unnamed.
> >
> > Mmm, where that is documented?
> >
> > I can't find any details about that in SUS, and man 7 unix says
> >
> > `If sun_path starts with a null byte ('' '), then it refers to the
> > abstract namespace main- tained by the Unix protocol module.'
>
> [I wrote unix(7) originally]. The abstract name space is a Linux
> extension and there is no written standard and whatever the kernel
> implements is the de-facto standard. If unix(7) differs in anything
> from what the code does please send patches to the manpages
> maintainer.

Oops, sorry, we are not talking about abstract namespace actually (their
sockaddr length are necessarily bigger than sizeof(sa_family_t) since
they need some data), but unamed sockets. So the Address Format
paragraph just misses description of unnamed sockets.

Samuel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-03-24 13:21    [W:0.071 / U:25.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site