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