nbd_aio_connect_vsock(3)

πŸ’– nbd_aio_connect_vsock πŸ’–

okay so this is the LIBNBD manual, section 3 β€” and bestie, we're talking about the async girlie that connects you to an NBD server over an AF_VSOCK socket. πŸ’…


✨ NAME ✨

nbd_aio_connect_vsock β€” connect to the NBD server over AF_VSOCK socket πŸ¦‹

πŸŽ€ SYNOPSIS πŸŽ€

#include <libnbd.h>

int nbd_aio_connect_vsock (
      struct nbd_handle *h, uint32_t cid, uint32_t port
    );

🌸 DESCRIPTION 🌸

okay so this starts connecting to the NBD server over the AF_VSOCK protocol to the server cid:port. The parameters behave exactly as documented in nbd_connect_vsock(3) β€” no cap, that's where the deets live. ✨

πŸ’œ RETURN VALUE πŸ’œ

If the call is successful, the function returns 0. slay. βœ…

πŸ”₯ ERRORS πŸ”₯

On error, -1 is returned. 😭

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error. 🫢

The following parameters must not be NULL: "h". For more information see "Non-NULL parameters" in libnbd(3). πŸ’€ no NULL shenanigans, periodt.

✨ NOTES ✨

🌈 Asynchronous connect call 🌈

You can check if the connection attempt is still underway by calling nbd_aio_is_connecting(3). If nbd_set_opt_mode(3) is enabled, the connection is ready for manual option negotiation once nbd_aio_is_negotiating(3) returns true; otherwise, the connection attempt will include the NBD handshake, and is ready for use once nbd_aio_is_ready(3) returns true. 🧚

πŸ‘‘ HANDLE STATE πŸ‘‘

nbd_aio_connect_vsock can be called when the handle is in the following state:

  • Handle created, before connecting β€” βœ… allowed
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” ❌ error
  • Connected to the server β€” ❌ error
  • Connection shut down β€” ❌ error
  • Handle dead β€” ❌ error

⭐ VERSION ⭐

This function first appeared in libnbd 1.2. πŸŽ€

If you need to test if this function is available at compile time, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_AIO_CONNECT_VSOCK 1

πŸ¦‹ SEE ALSO πŸ¦‹

nbd_aio_is_connecting(3), nbd_aio_is_negotiating(3), nbd_aio_is_ready(3), nbd_connect_vsock(3), nbd_create(3), nbd_set_opt_mode(3), libnbd(3), vsock(7). iykyk πŸ’…

🌸 AUTHORS 🌸

  • Eric Blake
  • Richard W.M. Jones

Copyright Red Hat 🫢

πŸ“œ LICENSE πŸ“œ

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


xoxo, bestie β€” this one is from libnbd-1.25.8, dated 2026-10-13, and it's literally the nbd_aio_connect_vsock(3) page. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from