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