nbd_aio_command_completed(3)

πŸ’… nbd_aio_command_completed β€” check if the command completed

okay so real quick, this is a page from the libnbd manual, section 3, and it's about nbd_aio_command_completed. yes the name is a mouthful, we're getting through it together bestie 🫢


✨ SYNOPSIS ✨

#include <libnbd.h>

int nbd_aio_command_completed (
      struct nbd_handle *h, uint64_t cookie
    );

like, that's the whole vibe. two args, one int out. we move. 🌸


πŸ’– DESCRIPTION πŸ’–

So nbd_aio_command_completed is literally the "is it done yet??" bestie of the async world. It returns true if the command completed β€” and here's the important part: if this function returns true, then the command was successful and it has been retired. slay.

It returns false if the command is still in flight. like, still cooking. not yet. πŸ“

This can also fail with an error in case the command failed β€” and yes, in that case the command is also retired. so either way the command gets cleaned up, no leaking situations here, we love a tidy queen.

A command is retired either via this command, or by using a completion callback which returns 1. that's the whole retirement pipeline, iykyk.

The cookie parameter is the positive unique 64 bit cookie for the command, as returned by a call such as nbd_aio_pread(3). it's literally the little name tag your command wears at the party so you can find it again πŸŽ€

ngl, "positive unique 64 bit cookie" is such a specific description and I'm obsessed with it. it's exact. don't come at it with a negative cookie, don't come at it with a duplicate. periodt.

πŸ”₯ RETURN VALUE πŸ”₯

This call returns a boolean value. true = done and successful and retired. false = still in flight. and if it's an error situation, that's going to show up through the error path described below, bestie, so keep reading. ✨


😭 ERRORS 😭

On error -1 is returned. yeah. negative one. we don't love to see it but it happens. πŸ’€

Refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error. that's where all the juicy error intel lives, go look, I'll wait. πŸ¦‹

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

do not pass a NULL handle. that's not a fun time. the handle is the main character here, it has to exist. πŸ™ˆ

πŸ‘‘ VERSION πŸ‘‘

This function first appeared in libnbd 1.0. she's an OG, she's been here from the start. iconic.

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

literally just check for the macro. #ifdef girlie behavior. ⭐


🌈 SEE ALSO 🌈

the whole friend group fr fr 🧚


πŸ’œ AUTHORS πŸ’œ

  • Eric Blake
  • Richard W.M. Jones

giving credit where credit is due, we love them for this πŸŽ€


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

okay that last bit is the legal speak, but it's important so we keep it exactly as it is. no cap. read your licenses besties πŸ’…

and that's the page!! πŸ’– this gorgeous little manpage is from libnbd-1.25.8, dated 2026-10-13, and it lives at nbd_aio_command_completed(3). mwah, go check your cookies, bye 🫢✨

πŸ“¦ where this page comes from