Loading...
Select Version
&pagelevel(4)&pagelevel
With AF_UNIX, name only comprises a path name which is passed in a variable of type
struct sockaddr_un (see "sockaddr_un address structure of the AF_UNIX address family ").
The following program extract illustrates how a name is assigned to a socket.
#include <sys/types.h> #include <sys/un.h> ... struct sockaddr_un sun; ... /* The statements which supply "sun" with the path name must be inserted here.*/ ... bind(s, (struct sockaddr *)&sun, sizeof sun);
The path name, which must be specified in the sun.sun_path component, is created as a file in the file system using bind(). The process that calls bind() must therefore have write rights to the directory in which the file is to be written. The system does not delete the file. It should therefore be deleted by the process when it is no longer required.