nbd_get_subprocess_pid(3)

πŸ’… nbd_get_subprocess_pid(3) β€” from the libnbd manual, section 3, bestie

okay so you opened the libnbd man pages, iconic of you honestly. welcome to nbd_get_subprocess_pid, a little function that tells you the PID of the subprocess libnbd spawned for you. it's giving "who even is that child process" energy and we're obsessed πŸŽ€


✨ NAME ✨

nbd_get_subprocess_pid β€” get the process ID of the subprocess 🫢


🌸 SYNOPSIS 🌸

#include <libnbd.h>

int64_t nbd_get_subprocess_pid (
          struct nbd_handle *h
        );

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, for connections that actually spin up a subprocess β€” think nbd_connect_command(3) and friends β€” this function hands you back the process ID (PID) of that subprocess. literally just the PID. that's the whole vibe πŸ’–

heads up bestie: this is only supported on some platforms. no cap. if you're on a platform that doesn't do it, that's just how it is 😭

and what's it for? mainly debugging cases. like, the classic use: you wanna learn where to attach gdb(1) so you can diagnose a crash happening inside the NBD server subprocess. that's it, that's the main character use case πŸ”₯


⭐ RETURN VALUE ⭐

this call returns a 64 bit signed integer β‰₯ 0. so a big ol' non-negative number, i.e. your PID πŸ’œ


πŸ’€ ERRORS πŸ’€

on error, -1 is returned. yeah. minus one. the saddest number πŸ™ˆ

for how to get further details of the error, refer to "ERROR HANDLING" in libnbd(3).

also, these parameters must not be NULL: "h". for more info, see "Non-NULL parameters" in libnbd(3). don't pass NULL, like, ever, please and thank you 🫢


🌈 VERSION 🌈

this function first appeared in libnbd 1.22.

wanna check at compile time if it's available? just see if this macro is defined:

#define LIBNBD_HAVE_NBD_GET_SUBPROCESS_PID 1

slay, conditional compilation ✨


πŸ‘‘ SEE ALSO πŸ‘‘

go read them, iykyk πŸ“š


🧚 AUTHORS 🧚

  • Eric Blake
  • Richard W.M. Jones

kings of the codebase, honestly πŸ‘‘


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


and that's the whole page bestie πŸŽ€ this was nbd_get_subprocess_pid(3) from libnbd-1.25.8, dated 2026-10-13 β€” go forth and attach your debugger, periodt πŸ’–βœ¨

πŸ“¦ where this page comes from