Provided by: manpages-zh_1.5.2-1_all bug

NAME(

       unix, PF_UNIX, AF_UNIX, PF_LOCAL, AF_LOCAL -

SYNOPSIS()

       #include <sys/socket.h>
       #include <sys/un.h>

       unix_socket = socket(PF_UNIX, type, 0);
       error = socketpair(PF_UNIX, type, 0, int *sv);

DESCRIPTION()

       PF_UNIX ( PF_LOCAL ) .Unix ( socketpair(2) ), .  Linux , .

       : SOCK_STREAM , SOCK_DGRAM ,.  Unix ,.

       Unix

ADDRESS FORMAT()

       unix .  socketpair(2) ., connect(2) .  bind(2) .  , .

              #define UNIX_PATH_MAX   108

              struct sockaddr_un {
              sa_family_t     sun_family;     /* AF_UNIX */
              char    sun_path[UNIX_PATH_MAX];        /*  */
              };

       sun_family AF_UNIX.  sun_path .  sun_path , Unix .  sun_path .  .

SOCKET OPTIONS()

       ,   SOL_SOCKET ,  PF_UNIX .  setsockopt(2) .   SOL_SOCKET getsockopt(2)
       .

       SO_PASSCRED .  , .  .

ANCILLARY MESSAGES()

       , SOL_SOCKET ,  PF_UNIX .  , cmsghdr cmsg_level  SOL_SOCKET,  cmsg_type
       . , cmsg(3).

       SCM_RIGHTS
              .  .  dup(2) .

       SCM_CREDENTIALS
               unix .  .  struct ucred

              struct ucred {
              pid_t   pid;     /*  */
              uid_t   uid;     /*  */
              gid_t   gid;     /*  */
              };

       .    0 .( CAP_SYS_ADMIN), ,( CAP_SETUID), ,( CAP_SETGID).  struct ucred
       , SO_PASSCRED .

VERSIONS()

       SCM_CREDENTIALS  Linux 2.2 ,.

NOTES()

        Linux , .  ,.  (), .   BSD ,  Unix .

       , ( unlink(2)).   Unix ; , , .

       , /.

ERRORS()

       ENOMEM .

       ECONNREFUSED
              connect(2) .  .

       EINVAL .   sun_type  AF_UNIX , .

       EOPNOTSUPP
              ,.

       EPROTONOSUPPORT
               PF_UNIX .

       ESOCKTNOSUPPORT
              .

       EPROTOTYPE
               (SOCK_DGRAM  SOCK_STREAM).

       EADDRINUSE
              ,.

       EISCONN
               connect(2) .

       ENOTCONN
              ,.

       ECONNRESET
              .

       EPIPE  ., SIGPIPE .  MSG_NOSIGNAL sendmsg(2) recvmsg(2) .

       EFAULT .

       EPERM   struct ucred .

       , .  ,.

SEE ALSO()

       recvmsg(2), sendmsg(2), socket(2), socket(2),  socketpair(2),  cmsg(3),
       socket(7)

CREDITS()

       manAndi Kleen.

[]

       riser <boomer@ccidnet.com>

[]

       2001/07/19

linuxman:

       http://cmpp.linuxforum.net