5 #include <sys/socket.h>
9 make_named_socket (const char *filename
)
11 struct sockaddr_un name
;
15 /* Create the socket. */
17 sock
= socket (PF_UNIX
, SOCK_DGRAM
, 0);
24 /* Bind a name to the socket. */
26 name
.sun_family
= AF_FILE
;
27 strcpy (name
.sun_path
, filename
);
29 /* The size of the address is
30 the offset of the start of the filename,
32 plus one for the terminating null byte. */
33 size
= (offsetof (struct sockaddr_un
, sun_path
)
34 + strlen (name
.sun_path
) + 1);
36 if (bind (sock
, (struct sockaddr
*) &name
, size
) < 0)