nbd_set_debug(3)

πŸ’… nbd_set_debug β€” the libnbd glow-up where you turn debugging on (or off)

okay so bestie, this is nbd_set_debug(3) from the libnbd manual, and it's literally the switch that decides whether the library spills its debug tea or keeps it cute and quiet πŸ«–βœ¨


πŸŽ€ SYNOPSIS

#include <libnbd.h>

int nbd_set_debug (
      struct nbd_handle *h, bool debug
    );

✨ DESCRIPTION

So the whole vibe of this function is: set or clear the debug flag 🚩 When debugging is enabled, all those debugging messages from the library get printed to stderr β€” yes, straight to stderr, no filter, no chill.

BUT πŸ’€ there's a plot twist: if you've also defined a debugging callback (see nbd_set_debug_callback(3)), those messages get sent to that function instead. Iconic delegation behavior, honestly.

Now for the default, because defaults are main character energy: this flag defaults to false on newly created handles. Periodt. Except β€” and this is the part you need to remember β€” if LIBNBD_DEBUG=1 is set in the environment you're running in, in which case it defaults to true 🌈 Sneaky little env var, iykyk.


πŸ’– RETURN VALUE

If everything goes slay and the call is successful, the function returns 0 πŸŽ‰ That's the good ending.


😭 ERRORS

On error, -1 is returned. Not cute, I know.

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

Also, heads up: the following parameters must not be NULL: h. For more information see "Non-NULL parameters" in libnbd(3). Don't come for me, just passing along the rules πŸ™ˆ


⭐ VERSION

This function first appeared in libnbd 1.0 β€” an OG, a founding member of the group chat πŸ‘‘

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

#define LIBNBD_HAVE_NBD_SET_DEBUG 1

That's your little "does this exist" vibe check at compile time ✨


πŸ¦‹ SEE ALSO

Go read them, they're all part of the same friend group fr fr πŸ“š


πŸ‘‘ 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


okay that's the whole page, mwah πŸ’‹ this came from libnbd-1.25.8 and it's dated 2026-10-13 β€” take care of her, she's serving nbd_set_debug(3) realness πŸ§šβ€β™€οΈπŸ”₯

πŸ“¦ where this page comes from