On Sat, Nov 29, 2008 at 11:54 AM, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> wrote: > Michael Kerrisk writes: > >> Hi Sam, >> >> (Always worth CCing me as well as the list, if you want my attention >> on a bug report.) >> On Sat, Nov 29, 2008 at 9:34 AM, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> >> wrote: >>> >>> It looks like the kernel -- at least 2.6.27.5 -- rejects with EINVAL a >>> bind() of an AF_UNIX socket whose given size exceeds sizeof(struct >>> sockaddr_un). >>> >>> Even if I make arrangements for a larger structure to accomodate a path >>> that >>> exceeds sockaddr_un's 107 bytes + \0, and I specify the actual size of >>> the >>> structure, bind() fails for me. >>> >>> I don't have the details, but I'm pretty sure other unixes accept domain >>> sockets with larger filenames. >> >> Are you sure of that? Offhand, I don't know of such implementations, >> but it's been a while since I tested this. Which systems have you >> seen this on? > > Well, by process of elimination it has to be either Solaris or AIX, since > those are the only ones I've worked with, in the last couple of decades. > However, I don't remember which specific versions. AIX is a system where I don't know the details. >>> There, the sockaddr_un structure exists for >>> historical reasons, and you can pretty much roll your own. >>> >>> This is perhaps worth mentioning in the description of EINVAL in unix(7). >> >> I'm not (yet) convinced. > > Well, various pathnames on various distros are getting longer, as times go > by. That's how this one came up on my radar screen. > > It might be interesting to track down where the magical 108 byte limitation > came from, but I don't really know where to look. It's historical -- it's what was used on some of the early BSD sockets implementations. Cheers, Michael > Presuming four bytes for > the address family, that leaves the total structure of 112 bytes. Can't > think of a reason to use precisely that size, nothing more, and nothing > less. > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html