1nbd_connect_vsock(3)                LIBNBD                nbd_connect_vsock(3)
2
3
4

NAME

6       nbd_connect_vsock - connect to NBD server over AF_VSOCK protocol
7

SYNOPSIS

9        #include <libnbd.h>
10
11        int nbd_connect_vsock (
12              struct nbd_handle *h, uint32_t cid, uint32_t port
13            );
14

DESCRIPTION

16       Connect (synchronously) over the "AF_VSOCK" protocol from a virtual
17       machine to an NBD server, usually running on the host.  The "cid" and
18       "port" parameters specify the server address.  Usually "cid" should be
19       2 (to connect to the host), and "port" might be 10809 or another port
20       number assigned to you by the host administrator.
21
22       Not all systems support "AF_VSOCK"; to determine if libnbd was built on
23       a system with vsock support, see nbd_supports_vsock(3).
24
25       This call returns when the connection has been made.  By default, this
26       proceeds all the way to transmission phase, but nbd_set_opt_mode(3) can
27       be used for manual control over option negotiation performed before
28       transmission phase.
29

RETURN VALUE

31       If the call is successful the function returns 0.
32

ERRORS

34       On error -1 is returned.
35
36       Refer to "ERROR HANDLING" in libnbd(3) for how to get further details
37       of the error.
38
39       The following parameters must not be NULL: "h".  For more information
40       see "Non-NULL parameters" in libnbd(3).
41

HANDLE STATE

43       The handle must be newly created, otherwise this call will return an
44       error.
45

VERSION

47       This function first appeared in libnbd 1.2.
48
49       If you need to test if this function is available at compile time check
50       if the following macro is defined:
51
52        #define LIBNBD_HAVE_NBD_CONNECT_VSOCK 1
53

SEE ALSO

55       nbd_aio_connect_vsock(3), nbd_create(3), nbd_set_opt_mode(3),
56       nbd_supports_vsock(3), libnbd(3).
57

AUTHORS

59       Eric Blake
60
61       Richard W.M. Jones
62
64       Copyright Red Hat
65

LICENSE

67       This library is free software; you can redistribute it and/or modify it
68       under the terms of the GNU Lesser General Public License as published
69       by the Free Software Foundation; either version 2 of the License, or
70       (at your option) any later version.
71
72       This library is distributed in the hope that it will be useful, but
73       WITHOUT ANY WARRANTY; without even the implied warranty of
74       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
75       Lesser General Public License for more details.
76
77       You should have received a copy of the GNU Lesser General Public
78       License along with this library; if not, write to the Free Software
79       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
80       02110-1301 USA
81
82
83
84libnbd-1.16.5                     2023-09-26              nbd_connect_vsock(3)
Impressum