nbd_poll2(3)

πŸ’… nbd_poll2 β€” polling but make it extra

okay bestie, so this is nbd_poll2(3) from the libnbd fam πŸ’– β€” it's a libnbd function, and yes it lives in section 3 of the manual like all the other cute library calls.


✨ SYNOPSIS ✨

first things first, you gotta include the header, no cap:

#include <libnbd.h>

int nbd_poll2 (
      struct nbd_handle *h, int fd, int timeout
    );

🌸 DESCRIPTION 🌸

so this is literally the same as nbd_poll(3) β€” same energy, same vibe β€” except bestie, there's an extra file descriptor parameter that gets passed in. πŸ‘‘

that extra fd also gets polled (using POLLIN, obviously), so it's out here waiting on two things at once like the main character it is.

one use for this? waiting on an eventfd(2) πŸ¦‹. that's the moment. that's the whole point. iykyk.


πŸŽ€ RETURN VALUE πŸŽ€

this call returns an integer β‰₯ 0. slay. positive vibes only.


πŸ’€ ERRORS πŸ’€

when it's not slaying, it returns -1. 😭 rough.

if you need the juicy details on what went wrong, refer to "ERROR HANDLING" in libnbd(3) β€” that's where the actual error info lives, fr fr.

also important: the following parameters must not be NULL: "h". like, do not pass NULL for h, bestie, i'm begging. for more info see "Non-NULL parameters" in libnbd(3).


⭐ VERSION ⭐

this function first appeared in libnbd 1.16. so if you're on something older, it's giving "not yet, gorgeous." πŸ™ˆ

need to test at compile time whether it's available? check if this macro is defined:

#define LIBNBD_HAVE_NBD_POLL2 1

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, bestie:


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


ok that's the whole page bestie, go forth and poll responsibly 🫢

and finally, the little sign-off the manpage footer woulda said: this one's from libnbd-1.25.8, dated 2026-10-13. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from