From: Thomas Veerman Date: Thu, 15 Jul 2010 14:56:49 +0000 (+0000) Subject: Add/adjust man pages for UDS. Contributed by Thomas Cort X-Git-Tag: v3.1.8~224 X-Git-Url: http://zhaoyanbai.com/repos/dnssec-keygen.html?a=commitdiff_plain;h=ee1b608bcf44ff10f07a93bb59e126cdd2efe35d;p=minix.git Add/adjust man pages for UDS. Contributed by Thomas Cort --- diff --git a/man/man2/Makefile b/man/man2/Makefile index d61605f0b..ab7bedbdd 100644 --- a/man/man2/Makefile +++ b/man/man2/Makefile @@ -1,13 +1,15 @@ -MAN= access.2 alarm.2 brk.2 chdir.2 chmod.2 chown.2 chroot.2 \ - close.2 creat.2 dup.2 execve.2 exit.2 fcntl.2 fork.2 \ - getgid.2 getitimer.2 getpid.2 getpriority.2 gettimeofday.2 \ - getuid.2 intro.2 ioctl.2 kill.2 link.2 lseek.2 mkdir.2 \ - mknod.2 mount.2 open.2 pause.2 pipe.2 ptrace.2 read.2 \ - readlink.2 reboot.2 rename.2 rmdir.2 select.2 setsid.2 \ - setuid.2 sigaction.2 sigpending.2 sigprocmask.2 \ - sigsuspend.2 stat.2 statvfs.2 svrctl.2 symlink.2 sync.2 time.2 \ - times.2 truncate.2 umask.2 uname.2 unlink.2 utime.2 \ - wait.2 write.2 +MAN= accept.2 access.2 alarm.2 bind.2 brk.2 chdir.2 chmod.2 chown.2 \ + chroot.2 close.2 connect.2 creat.2 dup.2 execve.2 exit.2 fcntl.2 \ + fork.2 getgid.2 getitimer.2 getnucred.2 getpeereid.2 \ + getpeername.2 getpid.2 getpriority.2 getsockname.2 getsockopt.2 \ + gettimeofday.2 getuid.2 intro.2 ioctl.2 kill.2 link.2 listen.2 \ + lseek.2 mkdir.2 mknod.2 mount.2 open.2 pause.2 pipe.2 ptrace.2 \ + read.2 readlink.2 reboot.2 recv.2 recvfrom.2 recvmsg.2 rename.2 \ + rmdir.2 select.2 send.2 sendmsg.2 sendto.2 setsid.2 \ + setsockopt.2 setuid.2 shutdown.2 sigaction.2 sigpending.2 \ + sigprocmask.2 sigsuspend.2 socket.2 socketpair.2 stat.2 \ + statvfs.2 svrctl.2 symlink.2 sync.2 time.2 times.2 truncate.2 \ + umask.2 uname.2 unlink.2 utime.2 wait.2 write.2 .include .include diff --git a/man/man2/accept.2 b/man/man2/accept.2 new file mode 100644 index 000000000..2f0e41c67 --- /dev/null +++ b/man/man2/accept.2 @@ -0,0 +1,33 @@ +.TH ACCEPT 2 +.SH NAME +accept \- accepts incoming connections on a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int accept(int \fIsd\fP, struct sockaddr * \fIaddr\fP, socklen_t * \fIaddr_len\fP); +.br +.ft P +.SH DESCRIPTION +accept() accepts a new incoming connection on a listening +socket \fIsd\fP. The structure pointed to by \fIaddr\fP is +filled in with the address of the peer, and \fIaddr_len\fP +is set to the length of the address of the peer. +.SH RETURN VALUES +On success, this function returns a numeric socket descriptor. +On error, -1 is returned and \fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EOPNOTSUPP] +The socket does not support accept(2) (example: a UDP socket). +.TP 15 +[ENOTSOCK] +The \fIsd\fP argument is not a socket. +.TP 15 +[EINVAL] +The socket is not listening or in an invalid state. +.SH SEE ALSO +.BR socket(2), +.BR connect(2) diff --git a/man/man2/bind.2 b/man/man2/bind.2 new file mode 100644 index 000000000..428e1fcdb --- /dev/null +++ b/man/man2/bind.2 @@ -0,0 +1,47 @@ +.TH BIND 2 +.SH NAME +bind \- binds an address to a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int bind(int \fIsd\fP, const struct sockaddr * \fIaddr\fP, socklen_t \fIaddr_len\fP); +.br +.ft P +.SH DESCRIPTION +bind() specifies the \fIaddr\fP (IP address and port for PF_INET or path for PF_UNIX) +to assign to socket \fIsd\fP. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The socket type is not supported by bind(). +.TP 15 +[EAFNOSUPPORT] +The address family is not supported by bind(). +.TP 15 +[EADDRNOTAVAIL] +The address is not available. +.TP 15 +[ENAMETOOLONG] +The sun_path in struct sockaddr_un is too long. +.TP 15 +[EINVAL] +The address is already bound to the socket. +.TP 15 +[EBADF] +The argument \fIsd\fP is not a descriptor. +.TP 15 +[ENOTSOCK] +The argument \fIsd\fP is a descriptor, but not a socket descriptor. +.TP 15 +[EFAULT] +The address pointed to by \fIaddr\fP is not in a +valid part of the process address space. +.SH SEE ALSO +.BR accept(2), +.BR socket(2) diff --git a/man/man2/connect.2 b/man/man2/connect.2 new file mode 100644 index 000000000..9540d66be --- /dev/null +++ b/man/man2/connect.2 @@ -0,0 +1,49 @@ +.TH CONNECT 2 +.SH NAME +connect \- connects a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int connect(int \fIsd\fP, const struct sockaddr * \fIaddr\fP, socklen_t \fIaddr_len\fP); +.br +.ft P +.SH DESCRIPTION +connect() connects the socket \fIsd\fP to a socket listening at +address \fIaddr\fP. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EFAULT] +The address pointed to by \fIaddr\fP is not in a +valid part of the process address space. +.TP 15 +[EAFNOSUPPORT] +The address family of the address pointed to by +\fIaddr\fP is not supported by this function. +.TP 15 +[EINVAL] +The address pointed to by \fIaddr\fP is not valid. +.TP 15 +[ENAMETOOLONG] +The sun_path in struct sockaddr_un is too long. +.TP 15 +[EACCES] +The calling process doesn't have permission to perform +the connect() operation. +.TP 15 +[EISCONN] +The socket is already connected. +.TP 15 +[EALREADY] +The socket is already in the process of connecting. +.TP 15 +[ECONNREFUSED] +The connection was refused. +.SH SEE ALSO +.BR socket(2), +.BR accept(2) diff --git a/man/man2/getnucred.2 b/man/man2/getnucred.2 new file mode 100644 index 000000000..0f989cec2 --- /dev/null +++ b/man/man2/getnucred.2 @@ -0,0 +1,41 @@ +.TH GETNUCRED 2 +.SH NAME +getnucred \- obtain the credentials that correspond to the given endpoint. +.SH SYNOPSIS +.ft B +#include +.in +5 +.ti -5 +#include + +.ti -5 +int getnucred(endpoint_t \fIproc_ep\fP, struct ucred * \fIucred\fP); +.br +.ft P +.SH DESCRIPTION +Given an endpoint \fIproc_ep\fP, this function will fill in \fIucred\fP +with the \fIpid\fP, \fIuid\fP, and \fIgid\fP that correspond to that +endpoint. +.SH RETURN VALUES +On success, this function returns 0 and \fIucred\fP will be filled in. +On error, -1 is returned and \fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EFAULT] +The address pointed to by \fIucred\fP is not in a valid part of the +process address space. +[EPERM] +The user calling this function has insufficient privileges. Only a user +with an euid of 0 may call this function. +[ESRCH] +The endpoint was not found. This is caused by an invalid endpoint or an +endpoint for a process that no longer exists. +.SH SEE ALSO +.BR getpid(2), +.BR getuid(2), +.BR getgid(2), +.BR getnpid(2), +.BR getnuid(2), +.BR getngid(2) +.SH HISTORY +This function first appeared in Minix 3.1.8. diff --git a/man/man2/getpeereid.2 b/man/man2/getpeereid.2 new file mode 100644 index 000000000..2c0a15f07 --- /dev/null +++ b/man/man2/getpeereid.2 @@ -0,0 +1,42 @@ +.TH GETPEEREID 2 +.SH NAME +getpeereid \- get the effective user ID and effective group ID of a peer +connected through a Unix domain socket. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int getpeereid(int \fIsd\fP, uid_t *\fIeuid\fP, gid_t *\fIegid\fP); +.br +.ft P +.SH DESCRIPTION +getpeereid() is often used to authenticate clients connecting to a +server through a Unix domain socket. The server can call this function +with a socket descriptor \fIsd\fP and this function will fill\-in +\fIeuid\fP and \fIegid\fP with the effective user ID and the effective +group ID of the client process. +.SH RETURN VALUES +On success, this function returns 0, \fIeuid\fP is set to the effective +user ID of the peer connected through Unix domain socket \fIsd\fP, and +\fIegid\fP is set to the effective group ID of the peer connected +through Unix domain socket \fIsd\fP. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EBADF] +The argument \fIsd\fP is not a descriptor. +.TP 15 +[ENOTSOCK] +The argument \fIsd\fP is a descriptor, but not a socket descriptor. +.TP 15 +[EFAULT] +The address pointed to by \fIeuid\fP and/or \fIegid\fP is not in a +valid part of the process address space. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2), +.BR unix(8) +.SH HISTORY +This function first appeared in Minix 3.1.8. diff --git a/man/man2/getpeername.2 b/man/man2/getpeername.2 new file mode 100644 index 000000000..a07c1d1fb --- /dev/null +++ b/man/man2/getpeername.2 @@ -0,0 +1,28 @@ +.TH GETPEERNAME 2 +.SH NAME +getpeername \- get the name/address of the connected peer. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int getpeername(int \fIsd\fP, struct sockaddr * \fIaddr\fP, socklen_t * \fIaddr_len\fP); +.br +.ft P +.SH DESCRIPTION +getpeername() takes a connected socket \fIsd\fP and fills in \fIaddr\fP +with the name/address of the connected peer. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[ENOTCONN] +The socket is not connected; there is no peer. +.SH SEE ALSO +.BR socket(2), +.BR getsockname(2) diff --git a/man/man2/getsockname.2 b/man/man2/getsockname.2 new file mode 100644 index 000000000..4efd51e0f --- /dev/null +++ b/man/man2/getsockname.2 @@ -0,0 +1,28 @@ +.TH GETSOCKNAME 2 +.SH NAME +getsockname \- get the current name/address of a socket. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int getsockname(int \fIsd\fP, struct sockaddr * \fIaddr\fP, socklen_t * \fIaddr_len\fP); +.br +.ft P +.SH DESCRIPTION +getsockname() takes a connected socket \fIsd\fP and fills in \fIaddr\fP +with the name/address of the socket. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[EINVAL] +The socket does not have a name/address. +.SH SEE ALSO +.BR socket(2), +.BR getpeername(2) diff --git a/man/man2/getsockopt.2 b/man/man2/getsockopt.2 new file mode 100644 index 000000000..6a69aeafd --- /dev/null +++ b/man/man2/getsockopt.2 @@ -0,0 +1,31 @@ +.TH GETSOCKOPT 2 +.SH NAME +getsockopt \- get the value of a socket option. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int getsockopt(int \fIsd\fP, int \fIlevel\fP, int \fIopt_name\fP, void * \fIopt_val\fP, socklen_t * \fIopt_len\fP); +.br +.ft P +.SH DESCRIPTION +getsockopt() provides an interface to get the value of a specific +option, referenced by \fIopt_name\fP, for a given socket descriptor +\fIsd\fP. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The option \fIopt_name\fP is not available/supported at the \fIlevel\fP +specified for the socket \fIsd\fP. +.TP 15 +[ENOTSOCK] +\fIsd\fP is not a socket descriptor. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2), +.BR setsockopt(2) diff --git a/man/man2/listen.2 b/man/man2/listen.2 new file mode 100644 index 000000000..b41688443 --- /dev/null +++ b/man/man2/listen.2 @@ -0,0 +1,36 @@ +.TH LISTEN 2 +.SH NAME +listen \- listens for incoming connections on a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int listen(int \fIsd\fP, int \fIbacklog\fP); +.br +.ft P +.SH DESCRIPTION +listen() puts socket \fIsd\fP into the listening state. +\fIbacklog\fP number of incoming connections may be +queued before new incoming connections are refused. +This function is usually called after bind(2) and before +accept(2). +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EINVAL] +The socket is invalid or bind(2) has not been called yet +for the socket. +.TP 15 +[EOPNOTSUPP] +The socket type (example SOCK_DGRAM) does not support listening. +.TP 15 +[ENOSYS] +The socket does not support listening. +.SH SEE ALSO +.BR accept(2), +.BR bind(2), +.BR socket(2) diff --git a/man/man2/recv.2 b/man/man2/recv.2 new file mode 100644 index 000000000..6331c4c76 --- /dev/null +++ b/man/man2/recv.2 @@ -0,0 +1,31 @@ +.TH RECV 2 +.SH NAME +recv \- receive a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t recv(int \fIsd\fP, void * \fImsg\fP, size_t \fImsg_len\fP, int \fIflags\fP); +.br +.ft P +.SH DESCRIPTION +recv() receives a message from another socket. It may only be used with +connected sockets. At present, minix doesn't support setting +\fIflags\fP to any value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[EPIPE] +The socket is shutdown for reading. +.SH SEE ALSO +.BR recvfrom(2), +.BR socket(2), +.BR send(2), +.BR sendto(2) diff --git a/man/man2/recvfrom.2 b/man/man2/recvfrom.2 new file mode 100644 index 000000000..45ccb404a --- /dev/null +++ b/man/man2/recvfrom.2 @@ -0,0 +1,32 @@ +.TH RECVFROM 2 +.SH NAME +recvfrom \- receive a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t recvfrom(int \fIsd\fP, void * \fImsg\fP, size_t \fImsg_len\fP, int \fIflags\fP, struct sockaddr * \fIsrc_addr\fP, socklet_t * \fIsrc_addr_len\fP); +.br +.ft P +.SH DESCRIPTION +recvfrom() receives a message from another socket. It may be +used with connectionless and connection oriented sockets. +At present, minix doesn't support setting \fIflags\fP to any +value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[EPIPE] +The socket is shutdown for reading. +.SH SEE ALSO +.BR socket(2), +.BR send(2) +.BR sendto(2) +.BR recv(2) diff --git a/man/man2/recvmsg.2 b/man/man2/recvmsg.2 new file mode 100644 index 000000000..2f3bbce1f --- /dev/null +++ b/man/man2/recvmsg.2 @@ -0,0 +1,37 @@ +.TH RECVMSG 2 +.SH NAME +recvmsg \- receive a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t recvmsg(int \fIsd\fP, struct msghdr * \fImsg\fP, int \fIflags\fP); +.br +.ft P +.SH DESCRIPTION +recvfrom() receives a message from another socket. It may be +used with connectionless and connection oriented sockets. +At present, minix doesn't support setting \fIflags\fP to any +value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[EPIPE] +The socket is shutdown for reading. +.TP 15 +[EFAULT] +\fImsg\fP is NULL. +.SH SEE ALSO +.BR socket(2), +.BR recvfrom(2), +.BR readv(2), +.BR sendmsg(2) +.SH HISTORY +This function first appeared in Minix 3.1.8. diff --git a/man/man2/send.2 b/man/man2/send.2 new file mode 100644 index 000000000..ff43842ff --- /dev/null +++ b/man/man2/send.2 @@ -0,0 +1,44 @@ +.TH SEND 2 +.SH NAME +send \- send a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t send(int \fIsd\fP, const void * \fImsg\fP, size_t \fImsg_len\fP, int \fIflags\fP); +.br +.ft P +.SH DESCRIPTION +send() sends a message to another socket. It may only be used with +connected sockets. At present, minix doesn't support setting +\fIflags\fP to any value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[ENOTCONN] +The socket is not connected; there is no peer. +.TP 15 +[EFAULT] +The message pointed to by \fImsg\fP is not in a +valid part of the process address space. +.TP 15 +[EAFNOSUPPORT] +The address family is not supported by send(). +.TP 15 +[EPIPE] +The socket is shutdown for writing. +.TP 15 +[EMSGSIZE] +The message is too big. +.SH SEE ALSO +.BR socket(2) +.BR sendto(2) +.BR recv(2) +.BR recvfrom(2) diff --git a/man/man2/sendmsg.2 b/man/man2/sendmsg.2 new file mode 100644 index 000000000..034f73735 --- /dev/null +++ b/man/man2/sendmsg.2 @@ -0,0 +1,52 @@ +.TH SENDMSG 2 +.SH NAME +sendmsg \- send a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t sendmsg(int \fIsd\fP, const struct msghdr * \fImsg\fP, int \fIflags\fP); +.br +.ft P +.SH DESCRIPTION +sendmsg() sends a message to another socket. It may be used with +connectionless and connection oriented sockets. At present, minix +doesn't support setting \fIflags\fP to any value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[ENOTCONN] +The socket is not connected; there is no peer. +.TP 15 +[EFAULT] +\fImsg\fP is NULL. +.TP 15 +[EAFNOSUPPORT] +The address family is not supported by send(). +.TP 15 +[ENAMETOOLONG] +The length of sun_path is longer than UNIX_PATH_MAX. +.TP 15 +[ENOENT] +The sun_path is null. +.TP 15 +[EPIPE] +The socket is shutdown for writing. +.TP 15 +[EMSGSIZE] +The message is too big. +.SH SEE ALSO +.BR socket(2), +.BR recvmsg(2), +.BR sendto(2), +.BR writev(2) +.SH HISTORY +This function first appeared in Minix 3.1.8. diff --git a/man/man2/sendto.2 b/man/man2/sendto.2 new file mode 100644 index 000000000..f7019ccbe --- /dev/null +++ b/man/man2/sendto.2 @@ -0,0 +1,51 @@ +.TH SENDTO 2 +.SH NAME +sendto \- send a message through a socket +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +ssize_t sendto(int \fIsd\fP, const void * \fImsg\fP, size_t \fImsg_len\fP, int \fIflags\fP, const struct sockaddr * \fIdest_addr\fP, socklet_t \fIdest_addr_len\fP); +.br +.ft P +.SH DESCRIPTION +sendto() sends a message to another socket. It may be used with +connectionless and connection oriented sockets. At present, minix +doesn't support setting \fIflags\fP to any value other than 0. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The operation is not implemented for the given socket. +.TP 15 +[ENOTCONN] +The socket is not connected; there is no peer. +.TP 15 +[EFAULT] +The message pointed to by \fImsg\fP is not in a +valid part of the process address space. +.TP 15 +[EAFNOSUPPORT] +The address family is not supported by send(). +.TP 15 +[ENAMETOOLONG] +The length of sun_path is longer than UNIX_PATH_MAX. +.TP 15 +[ENOENT] +The sun_path is null. +.TP 15 +[EPIPE] +The socket is shutdown for writing. +.TP 15 +[EMSGSIZE] +The message is too big. +.SH SEE ALSO +.BR send(2) +.BR socket(2) +.BR recv(2) +.BR recvfrom(2) + diff --git a/man/man2/setsockopt.2 b/man/man2/setsockopt.2 new file mode 100644 index 000000000..16658e86d --- /dev/null +++ b/man/man2/setsockopt.2 @@ -0,0 +1,31 @@ +.TH SETSOCKOPT 2 +.SH NAME +setsockopt \- set the value of a socket option. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int setsockopt(int \fIsd\fP, int \fIlevel\fP, int \fIopt_name\fP, const void * \fIopt_val\fP, socklen_t \fIopt_len\fP); +.br +.ft P +.SH DESCRIPTION +setsockopt() provides an interface to set the value of a specific +option, referenced by \fIopt_name\fP, for a given socket descriptor +\fIsd\fP. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[ENOSYS] +The option \fIopt_name\fP is not available/supported at the \fIlevel\fP +specified for the socket \fIsd\fP. +.TP 15 +[ENOTSOCK] +\fIsd\fP is not a socket descriptor. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2), +.BR getsockopt(2) diff --git a/man/man2/shutdown.2 b/man/man2/shutdown.2 new file mode 100644 index 000000000..147e04f46 --- /dev/null +++ b/man/man2/shutdown.2 @@ -0,0 +1,33 @@ +.TH SHUTDOWN 2 +.SH NAME +shutdown \- shuts down a socket for reading, writing, or both +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int shutdown(int \fIsd\fP, int \fIhow\fP); +.br +.ft P +.SH DESCRIPTION +shutdown() shuts down the socket \fIsd\fP for reading, writing, +or both reading and writing by setting \fIhow\fP to SHUT_RD, +SHUT_WR, or SHUT_RDWR. +.SH RETURN VALUES +On success, this function returns 0. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EINVAL] +\fIhow\fP must be SHUT_RD, SHUT_WR, or SHUT_RDWR. +.TP 15 +[ENOTCONN] +\fIsd\fP must be a connected socket. +.TP 15 +[ENOSYS] +attempted to shutdown the read side of a TCP socket, +or the type of socket is not supported. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2) diff --git a/man/man2/socket.2 b/man/man2/socket.2 new file mode 100644 index 000000000..ef65fd461 --- /dev/null +++ b/man/man2/socket.2 @@ -0,0 +1,54 @@ +.TH SOCKET 2 +.SH NAME +socket \- creates a socket. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int socket(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP); +.br +.ft P +.SH DESCRIPTION +socket() creates a socket in the specified \fIdomain\fP. A socket +is a communications endpoint. Currently two values are supported +for \fIdomain\fP, PF_INET for internet sockets and PF_UNIX for +local unix domain sockets. The \fItype\fP of socket can be +SOCK_STREAM for TCP sockets in the PF_INET \fIdomain\fP or +SOCK_DGRAM for UDP sockets in the PF_INET \fIdomain\fP. For +sockets in the PF_UNIX \fIdomain\fP, SOCK_STREAM, SOCK_DGRAM, and +SOCK_SEQPACKET are supported values for \fItype\fP. The value +of \fIprotocol\fP is always 0 or IPPROTO_TCP for TCP sockets or +IPPROTO_UDP for UDP sockets. +.SH RETURN VALUES +On success, this function returns a numeric socket descriptor. +On error, -1 is returned and \fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EAFNOSUPPORT] +The \fIdomain\fP is not supported. +.TP 15 +[EPROTOTYPE] +The \fIprotocol\fP is not supported by the \fIdomain\fP. +.TP 15 +[EMFILE] +The process descriptor table is full. +.TP 15 +[ENFILE] +The system descriptor table is full. +.TP 15 +[ENOSPC] +Could not allocate a file descriptor. +.SH SEE ALSO +.BR socketpair(2), +.BR bind(2), +.BR listen(2), +.BR accept(2), +.BR connect(2), +.BR shutdown(2), +.BR getsockopt(2), +.BR setsockopt(2), +.BR ip(4), +.BR inet(8), +.BR unix(8) diff --git a/man/man2/socketpair.2 b/man/man2/socketpair.2 new file mode 100644 index 000000000..8672bf26b --- /dev/null +++ b/man/man2/socketpair.2 @@ -0,0 +1,45 @@ +.TH SOCKETPAIR 2 +.SH NAME +socketpair \- creates a pair of connected sockets. +.SH SYNOPSIS +.ft B +#include + +.in +5 +.ti -5 +int socketpair(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, int \fIsv[2]\fP); +.br +.ft P +.SH DESCRIPTION +socketpair() creates two connected sockets of the specified \fItype\fP +in the specified \fIdomain\fP using the specified \fIprotocol\fP and +stores the two resulting socket descriptors in \fIsv[2]\fP. +.SH RETURN VALUES +On success, this function returns 0, and \fIsv[2]\fP is set to the two +newly created socket descriptors. On error, -1 is returned and +\fIerrno\fP is set. +.SH ERRORS +.TP 15 +[EAFNOSUPPORT] +The \fIdomain\fP is not supported. +.TP 15 +[EPROTOTYPE] +The \fIprotocol\fP is not supported by the \fIdomain\fP. +.TP 15 +[EPROTONOSUPPORT] +The \fIprotocol\fP is not supported by the \fItype\fP. +.TP 15 +[EINVAL] +The pair of sockets aren't in a valid state or are not connection oriented sockets. +.TP 15 +[EPERM] +The user ID, group ID, and process ID of the first socket doesn't match that of the second. +.SH NOTES +This function is only implemented for unix domain sockets. Therefore, +the only valid value for \fIdomain\fP is +.B AF_UNIX +.SH SEE ALSO +.BR socket(2), +.BR unix(8) +.SH HISTORY +This function first appeared in Minix 3.1.8. diff --git a/man/man4/Makefile b/man/man4/Makefile index 7f7588d9f..0075231c9 100644 --- a/man/man4/Makefile +++ b/man/man4/Makefile @@ -1,4 +1,4 @@ -MAN= console.4 controller.4 dev.4 fd.4 ip.4 lp.4 mtio.4 tty.4 +MAN= console.4 controller.4 dev.4 fd.4 ip.4 lp.4 mtio.4 tty.4 uds.4 .include .include diff --git a/man/man4/dev.4 b/man/man4/dev.4 index e36bb16c2..ff115f52f 100644 --- a/man/man4/dev.4 +++ b/man/man4/dev.4 @@ -199,6 +199,10 @@ device can be used to produce or record air vibrations using a Soundblaster The .B mixer device is used to control the audio driver. +.SS "uds (major 18)" +The +.B uds +device is used to implement unix domain sockets. .SH FILES .TP 10 .B /dev/* @@ -212,6 +216,7 @@ All MINIX 3 devices .BR fd (4), .BR controller (4), .BR ip (4), +.BR uds (4), .BR tty (4), .BR MAKEDEV (8). .SH DIAGNOSTICS diff --git a/man/man4/uds.4 b/man/man4/uds.4 new file mode 100644 index 000000000..025eb3d03 --- /dev/null +++ b/man/man4/uds.4 @@ -0,0 +1,15 @@ +.TH UDS 4 +.SH NAME +uds \- unix domain sockets device +.SH DESCRIPTION +The \fIuds\fP device gives access to the unix domain socket services in +Minix. It is a virtual device similar to the \fItcp\fP and \fIudp\fP +Internet Protocol server devices. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2), +.BR dev(4), +.BR ip(4), +.BR unix(8) +.SH HISTORY +This device first appeared in Minix 3.1.8. diff --git a/man/man8/Makefile b/man/man8/Makefile index a7e955753..fddea57fd 100644 --- a/man/man8/Makefile +++ b/man/man8/Makefile @@ -9,7 +9,7 @@ MAN= add_route.8 adduser.8 backup.8 badblocks.8 boot.8 \ rdate.8 readclock.8 reboot.8 repartition.8 rlogind.8 \ rshd.8 savemixer.8 screendump.8 serial-ip.8 service.8 \ setup.8 shutdown.8 slip.8 srccrc.8 sync.8 syslogd.8 tcpd.8 \ - update.8 usage.8 vmixctl.8 + unix.8 update.8 usage.8 vmixctl.8 .include .include diff --git a/man/man8/unix.8 b/man/man8/unix.8 new file mode 100644 index 000000000..8d1f91c3c --- /dev/null +++ b/man/man8/unix.8 @@ -0,0 +1,26 @@ +.TH UNIX 8 +.SH NAME +unix \- Unix Domain Sockets (PF_UNIX) / Local Sockets (PF_LOCAL) +.SH SYNOPSIS +.ft B +#include +.br +#include + +.in +5 +.ti -5 +int socket(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP); +.ti -5 +int socketpair(int \fIdomain\fP, int \fItype\fP, int \fIprotocol\fP, int \fIsv[2]\fP); +.br +.ft P +.SH DESCRIPTION +Local sockets, more commonly known as Unix Domain Sockets, provide a +means of interprocess communication using the socket API. +.SH SEE ALSO +.BR socket(2), +.BR socketpair(2), +.BR getpeereid(2), +.BR uds(4) +.SH HISTORY +This Unix Domain Sockets first appeared in Minix 3.1.8.