nbd_get_keepalive(3)

πŸ“¦
version 1.25.8 Β· 3 versions
, in centos-stream 10

πŸ’… 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 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