[Ecls-list] [OT] Re: Pseudo UNIX socket for WIN32

R. Mattes rm at mh-freiburg.de
Sat Feb 12 05:33:48 UTC 2005


On Fri, 11 Feb 2005 22:09:42 +0100, Julian Stecklina wrote:

> On Fri, 11 Feb 2005 18:19:55 +0100
> Juan Jose Garcia Ripoll <lisp at arrakis.es> wrote:
> 
>> Goffioul Michael wrote:
>> 
>> >Attached is a further hacked version of sockets.lisp, which
>> >implements pseudo UNIX socket for WIN32 using named pipes. Have fun.
>> >
>> Hehe, now that I had almost integrated the old file sockets.lisp...
>> :-)
>> 
>> BTW, a question for the unix hackers here. Julian's code had this
>>         sockaddr.sun_len = sizeof(struct sockaddr_un);
>>         sockaddr.sun_family = "some/path/to/socket";
>>         strncpy(&sockaddr.sun_path,#2,sizeof(sockaddr.sun_path));
>>         bind(#0,&sockaddr, sizeof(struct sockaddr_un));
>> 
>> But in many other linux-related places I find only the last two lines.
>> 
>> The field sun_len is gone and it only matters the  size argument that
>> we  pass to bind(). Is the "sun_len" really required? Is it a BSD
>> thing?
> 
> Seems so. struct sockaddr_un seems to differ on FreeBSD and Linux.
> 
> FreeBSD says:
>      UNIX-domain addresses are variable-length file system pathnames of
> at     most 104 characters.  The include file <sys/un.h> defines this
> address:
> 
>            struct sockaddr_un {
>            u_char  sun_len;
>            u_char  sun_family;
>            char    sun_path[104];
>            };
> 
> Debian says:
>               #define UNIX_PATH_MAX    108
> 
>               struct sockaddr_un {
>                   sa_family_t  sun_family;              /* AF_UNIX */
>                   char         sun_path[UNIX_PATH_MAX]; /* pathname */
>               };
> 
> Note that UNIX_PATH_MAX does not exist on FreeBSD. :) But I still
> believe that is "nice" to actually fill sun_len with useful information
> on *BSD.
> 
> Does Linux get anything right? ;)

What, like _not_ hard-coding the maximum allowed filesystem path length
into networking code? The question is also: what value is sun_len? Will
code using the path trust sun_len? That wa we could create sockets with
#\0 in their pathname .... hmmm.

 cheers Ralf Mattes
> Regards,






More information about the ecl-devel mailing list