The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


sys/un.h - definitions for UNIX-domain sockets


#include <sys/un.h>


The <sys/un.h> header defines the sockaddr_un structure that includes at least the following members:

sa_family_t sun_family    address family
char        sun_path[]    socket pathname

The sockaddr_un structure is used to store addresses for UNIX domain sockets. Values of this type must be cast to struct sockaddr for use with the socket interfaces defined in this document.

The <sys/un.h> header defines the type sa_family_t as described in <sys/socket.h>.

The size of sun_path has intentionally been left undefined. This was done for good reasons. Different implementations have used different sizes. For example, BSD4.3 uses a size of 108. BSD4.4 uses a size of 104. Since most of the implementations today originated from BSD versions, most of the major vendors today use a size that ranges from 92 to 108. Applications should not assume a particular length for sun_path or assume that it can hold _POSIX_PATH_MAX characters (255).


bind(), socket(), socketpair().

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]