nbd_aio_connect_socket(3)
π nbd_aio_connect_socket β bestie's guide to libnbd
okay so real talk, this page is nbd_aio_connect_socket(3) from the LIBNBD manual, and it's genuinely one of the cutest little connectors in the whole library. periodt. let's get into it π
β¨ NAME β¨
nbd_aio_connect_socket β connect directly to a connected socket. that's it, that's the whole vibe π¦
β¨ SYNOPSIS β¨
#include <libnbd.h>
int nbd_aio_connect_socket (
struct nbd_handle *h, int sock
);
like, literally just hand it a handle and a socket and you're off π«
β¨ DESCRIPTION β¨
okay so this is the begin connecting era of your life β the function starts connecting to the connected socket fd. ngl the parameters behave exactly as documented over in nbd_connect_socket(3), so if you're confused, that's your study material bestie πβ¨
β¨ RETURN VALUE β¨
if the call is successful, it returns 0. slay. π
β¨ ERRORS β¨
on error, -1 is returned. not slay. π
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β like, the actual tea on what went wrong π
also heads up: the following parameters must not be NULL: h. for more info see "Non-NULL parameters" in libnbd(3). don't be the person who passes NULL, i'm begging π
β¨ NOTES β¨
πΈ Asynchronous connect call πΈ
you can check if the connection attempt is still underway by calling nbd_aio_is_connecting(3) β very much "are we there yet" energy ππ¨
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 β¨
vibe check time β nbd_aio_connect_socket can be called when the handle is in the following state:
- Handle created, before connecting β β allowed (this is your moment π)
- Connecting β β error
- Connecting & handshaking (opt_mode) β β error
- Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error π
so like, one (1) state. the rest is a no. iykyk π«Ά
β¨ VERSION β¨
this function first appeared in libnbd 1.2. a classic, an icon, the moment π
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_SOCKET 1
β¨ SEE ALSO β¨
go read these, they're literally all connected (pun intended):
nbd_aio_is_connecting(3)nbd_aio_is_negotiating(3)nbd_aio_is_ready(3)nbd_connect_socket(3)nbd_create(3)nbd_set_opt_mode(3)libnbd(3)
β¨ AUTHORS β¨
Eric Blake
Richard W.M. Jones
absolute legends, both of them π
β¨ 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
and that's the whole page bestie π«Ά this was libnbd-1.25.8, dated 2026-10-13, and the page itself is nbd_aio_connect_socket(3). go forth and connect responsibly πβ¨
π¦ 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