nbd_get_keepalive(3)
π nbd_get_keepalive(3) β the libnbd girlies' guide
okay so bestie, you found your way into the libnbd manual, and this little cutie is nbd_get_keepalive β literally the "is keepalive on or not" check. she's small, she's iconic, let's get into it π
β¨ NAME β¨
nbd_get_keepalive β return keepalive status π
πΈ SYNOPSIS πΈ
like all good C things, she starts with an include:
#include <libnbd.h>
int nbd_get_keepalive (
struct nbd_handle *h
);
one handle, that's it, no drama π¦
π DESCRIPTION π
so the whole vibe here is: return the keepalive status.
but it's giving two different moods depending on whether your handle is connected or not, and you need to know which one you're in:
- if the handle is not connected, she just returns the keepalive flag from the handle itself, the one you set with
nbd_set_keepalive(3). lowkey just reading back what you told her. π«Ά - if the handle is connected, she gets ambitious and attempts to read the keepalive (
"SO_KEEPALIVE") flag from the socket itself β telling you if keepalive was actually successfully enabled or not. no cap, that's the real tea. π₯
β RETURN VALUE β
this call returns a boolean value. simple as that, periodt. π
π ERRORS π
on error, -1 is returned. π
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β she'll tell you what went wrong, you just gotta ask the right manpage.
also, the following parameters must not be NULL: "h". for more info see "Non-NULL parameters" in libnbd(3). so likeβ¦ don't pass her a NULL handle bestie, that's not the vibe π
π¦ VERSION π¦
this function first appeared in libnbd 1.26. a whole era. β¨
if you need to test whether this function is available at compile time, check if the following macro is defined:
#define LIBNBD_HAVE_NBD_GET_KEEPALIVE 1
iykyk π§
π SEE ALSO π
go read these, they're all part of the same friend group:
π AUTHORS π
- Eric Blake
- Richard W.M. Jones
the masterminds, we stan π«Ά
π 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 about all that. π
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
ngl, legal text is not the main character energy we wanted, but she said what she said and we respect her πΈ
mwah, that's the page! libnbd-1.25.8, dated 2026-10-13 β go forth and check those keepalives, bestie, and remember: she's nbd_get_keepalive(3) in the libnbd manual, and she ate π
π
π¦ 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