nbd_kill_subprocess(3)

πŸ’– nbd_kill_subprocess(3) πŸ’–

okay so this little cutie lives in the libnbd manual, section 3, and honestly? she's the "break glass in case of emergency" bestie of the libnbd fam. let's get into it ✨


🌸 NAME 🌸

nbd_kill_subprocess β€” kill server running as a subprocess πŸ’€

like, literally. it's the "okay we tried being nice, now we're not" function.


πŸŽ€ SYNOPSIS πŸŽ€

#include <libnbd.h>

int nbd_kill_subprocess (
      struct nbd_handle *h, int signum
    );

she's small, she's tidy, she takes exactly two things. no notes. πŸ’…


✨ DESCRIPTION ✨

so here's the vibe: you've got a server running as a subprocess, and you made it with nbd_connect_command(3). this call lets you kill that server. that's it. that's the whole thing.

and bestie, listen to me β€” you do not need to use this call. fr fr. she's only here for the specific situation where the server does not exit when the socket is closed. that's the only time she gets invited to the party. πŸ™ˆ

the signum parameter is the optional signal number you wanna send (peep signal(7) for the full menu of signals). and if signum is 0, then SIGTERM is what gets sent β€” so like, the polite-but-firm option is the default. 🫢


πŸ”₯ RETURN VALUE πŸ”₯

if the call is successful, the function returns 0. slay. βœ…


πŸ’€ ERRORS πŸ’€

on error, -1 is returned. not slay. 😭

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

also: the following parameters must not be NULL: h. like, don't do that. for more info see "Non-NULL parameters" in libnbd(3). it's giving "obviously" but the manpage said it so i'm saying it too. πŸŽ€


⭐ VERSION ⭐

this function first appeared in libnbd 1.0. iconic behavior honestly, she's an OG. πŸ‘‘

if you need to test whether this function is available at compile time, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_KILL_SUBPROCESS 1

πŸ¦‹ SEE ALSO πŸ¦‹

(the whole friend group tbh πŸ’–)


🌈 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

the legal bits are non-negotiable, bestie β€” read 'em, don't skim 'em 🫢

πŸ’… and that's the page!! this whole thing is from libnbd-1.25.8, dated 2026-10-13 β€” so like, timestamped and everything. mwah. πŸŽ€βœ¨

πŸ“¦ where this page comes from