nbd_aio_connect(3)
π nbd_aio_connect β connect to the NBD server
okay so bestie, welcome to nbd_aio_connect(3), straight out of the libnbd manual (section 3, obviously π). this one's literally the "start talking to the server, but make it async" function and it's kind of a big deal.
β¨ NAME β¨
nbd_aio_connect β connect to the NBD server π«Ά
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_aio_connect (
struct nbd_handle *h, const struct sockaddr *addr,
socklen_t addrlen
);
like, that's it. that's the whole vibe check. π
π¦ DESCRIPTION π¦
so this is where you begin connecting to the NBD server β no cap. the addr and addrlen parameters are the ones that specify the address of the socket you're connecting to. that's the assignment, that's the whole thing, slay. β¨
π RETURN VALUE π
if the call is successful, the function returns 0. iconic behavior honestly.
π ERRORS π
on error, -1 is returned. π
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β that's where the lore lives.
also, these parameters must not be NULL: h, addr. like, don't even try it. for more info see "Non-NULL parameters" in libnbd(3).
π NOTES π
π§ Asynchronous connect call
you can check if the connection attempt is still underway by calling nbd_aio_is_connecting(3). multitasking queen behavior fr fr.
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. either way, you're gonna know. π
π©· HANDLE STATE π©·
nbd_aio_connect can be called when the handle is in the following state:
- Handle created, before connecting β β allowed (this is your moment bestie)
- Connecting β β error
- Connecting & handshaking (opt_mode) β β error
- Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so yeah, only that first one. everything else is a no. π
β VERSION β
this function first appeared in libnbd 1.0. vintage. π
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 1
π SEE ALSO π
nbd_aio_is_connecting(3), nbd_aio_is_negotiating(3), nbd_aio_is_ready(3), nbd_create(3), nbd_set_opt_mode(3), libnbd(3).
the whole friend group honestly π«Ά
π AUTHORS π
Eric Blake
Richard W.M. Jones
πΈ COPYRIGHT πΈ
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
ok that's the whole page, no notes. go connect to that server bestie, ily π β¨
and finally β this gorgeous little page is libnbd-1.25.8, dated 2026-10-13, and it's the nbd_aio_connect(3) page. mwah. ππ§π
π¦ where this page comes from
- centos-stream 10: libnbd-devel 1.25.8-1.el10 Β· LGPL-2.0-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms