[Ecls-list] Pseudo UNIX socket for WIN32

Julian Stecklina der_julian at web.de
Fri Feb 11 13:10:32 UTC 2005


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? ;)

Regards,
-- 
                    ____________________________
 Julian Stecklina  /  _________________________/
  ________________/  /
  \_________________/  LISP - truly beautiful




More information about the ecl-devel mailing list