vsock.7: Minor fixes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-12-11 20:18:45 +01:00
parent 4a70bb07bc
commit 2472922151
1 changed files with 22 additions and 17 deletions

View File

@ -30,9 +30,13 @@ underlying hypervisor.
.PP
A new socket is created with
.PP
socket(AF_VSOCK, socket_type, 0);
.in +4n
.EX
socket(AF_VSOCK, socket_type, 0);
.EE
.in
.PP
When a process wants to establish a connection it calls
When a process wants to establish a connection, it calls
.BR connect (2)
with a given destination socket address.
The socket is automatically bound to a free port if unbound.
@ -59,10 +63,10 @@ a single machine.
.in +4n
.EX
struct sockaddr_vm {
sa_family_t svm_family; /* address family: AF_VSOCK */
unsigned short svm_reserved1;
unsigned int svm_port; /* port in native byte order */
unsigned int svm_cid; /* address in native byte order */
sa_family_t svm_family; /* Address family: AF_VSOCK */
unsigned short svm_reserved1;
unsigned int svm_port; /* Port # in host byte order */
unsigned int svm_cid; /* Address in host byte order */
};
.EE
.in
@ -73,18 +77,18 @@ is always set to
.I svm_reserved1
is always set to 0.
.I svm_port
contains the port in native byte order.
contains the port number in host byte order.
The port numbers below 1024 are called
.IR "privileged ports" .
Only a process with
.B CAP_NET_BIND_SERVER
Only a process with the
.B CAP_NET_BIND_SERVICE
capability may
.BR bind (2)
to these port numbers.
.PP
There are several special addresses:
.B VMADDR_CID_ANY
(-1U)
(\-1U)
means any address for binding;
.B VMADDR_CID_HYPERVISOR
(0) is reserved for services built into the hypervisor;
@ -96,7 +100,7 @@ is the well-known address of the host.
.PP
The special constant
.B VMADDR_PORT_ANY
(-1U)
(\-1U)
means any port number for binding.
.SS Live migration
Sockets are affected by live migration of virtual machines.
@ -112,11 +116,12 @@ Bound sockets are automatically updated to the new CID.
.TP
.B IOCTL_VM_SOCKETS_GET_LOCAL_CID
Get the CID of the local machine.
The argument is a pointer to an unsigned int.
The argument is a pointer to an
.IR "unsigned int" .
.IP
.in +4n
.EX
.IB error " = ioctl(" socket ", " IOCTL_VM_SOCKETS_GET_LOCAL_CID ", " &cid ");"
ioctl(socket, IOCTL_VM_SOCKETS_GET_LOCAL_CID, &cid);
.EE
.in
.IP
@ -135,7 +140,7 @@ capability.
Invalid parameters.
This includes:
attempting to bind a socket that is already bound, providing an invalid struct
.BR sockaddr_vm ,
.IR sockaddr_vm ,
and other input validation errors.
.TP
.B EOPNOTSUPP
@ -154,7 +159,7 @@ for
Unable to bind to a port that is already in use.
.TP
.B EADDRNOTAVAIL
Unable to find a free port for binding or unable to bind to a non-local CID.
Unable to find a free port for binding or unable to bind to a nonlocal CID.
.TP
.B ENOTCONN
Unable to perform operation on an unconnected socket.
@ -167,7 +172,7 @@ or
.TP
.B EPROTONOSUPPORT
Invalid socket protocol number.
Protocol should always be 0.
The protocol should always be 0.
.TP
.B ESOCKTNOSUPPORT
Unsupported socket type in
@ -180,7 +185,7 @@ are valid.
.SH VERSIONS
Support for VMware (VMCI) has been available since Linux 3.9.
KVM (virtio) is supported since Linux 4.8.
Hyper-V is supported since 4.14.
Hyper-V is supported since Linux 4.14.
.SH SEE ALSO
.BR socket (2),
.BR bind (2),