nbd_aio_opt_abort(3)

πŸ’… nbd_aio_opt_abort β€” bestie's guide (from the libnbd manual) πŸŽ€

okay so real talk, we're in the libnbd section 3 pages and this one is nbd_aio_opt_abort, and it's honestly giving "graceful exit, but make it async" ✨

🌸 NAME 🌸

nbd_aio_opt_abort β€” end negotiation and close the connection 🫢


✨ SYNOPSIS ✨

#include <libnbd.h>

int nbd_aio_opt_abort (
      struct nbd_handle *h
    );

πŸ’– DESCRIPTION πŸ’–

So basically you're sliding into the server's DMs like "hey queen, we're done here" β€” this requests that the server finish negotiation, gracefully if possible, then close the connection. Gracefully if possible, mind you, so it's a polite request, not a slam-the-door situation πŸ’…

hard requirement tho: this can only be used if nbd_set_opt_mode(3) enabled option mode. No opt mode, no abort, no exceptions, periodt.

And to figure out when the request actually completes? You wait for nbd_aio_is_connecting(3) to return false. That's your signal, that's your vibe check, iykyk πŸ‘‘


πŸ¦‹ RETURN VALUE πŸ¦‹

If the call is successful the function returns 0. slay πŸ’š


😭 ERRORS 😭

On error -1 is returned. not the vibe, but okay.

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β€” that's where the lore lives.

The following parameters must not be NULL: h. Like, must not. For more information see "Non-NULL parameters" in libnbd(3).


πŸ‘‘ HANDLE STATE πŸ‘‘

nbd_aio_opt_abort can be called when the handle is in the following state β€” think of it as a little mood ring for your handle πŸ“:

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

so literally the only green light is "Connecting & handshaking (opt_mode)". one singular window. main character energy for real πŸ”₯


🌈 VERSION 🌈

This function first appeared in libnbd 1.4. vintage but make it fresh πŸ’œ

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_OPT_ABORT 1

πŸ’€ SEE ALSO πŸ’€

go read them, they're all iconique ⭐


🧚 AUTHORS 🧚

Eric Blake

Richard W.M. Jones

(genuinely legends, no cap πŸ™ˆ)


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

fr fr read the license, it's not optional, bestie 😌

okay that's the whole page!! this was libnbd-1.25.8, dated 2026-10-13, page nbd_aio_opt_abort(3) β€” mwah, go abort some negotiation gracefully πŸ’…βœ¨

πŸ“¦ where this page comes from