[Ecls-list] Pseudo UNIX socket for WIN32

lisp lisp at arrakis.es
Sat Feb 12 08:09:02 UTC 2005

> On Fri, 11 Feb 2005 18:19:55 +0100
> Juan Jose Garcia Ripoll <lisp at arrakis.es> wrote:
>> 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:

Ok, I apologize for having changed the code to work on Linux, but I needed
a version that worked before committing anything. I will surround the
setting of "sun_len" with an #ifdef for the BSD families and figure out a
good limit for the path length. And btw also force a '\0' at the end of
the string after the strncpy. We do not want buffer overflows here, do we

Thanks for the great work! Was it very difficult to figure out how the FFI
works? Would you change anything? Maybe the multiple values stuff. That
should be easy to implement: just a matter of changing the routine
handling C-INLINE so that it sets up several output variables instead of



More information about the ecl-devel mailing list