Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
nbdkit_shutdown(3)		     NBDKIT		      nbdkit_shutdown(3)

NAME
     nbdkit_shutdown, nbdkit_disconnect - request shutdown or client disconnec-
     tion

SYNOPSIS
      #include <nbdkit-plugin.h>

      void nbdkit_shutdown (void);
      void nbdkit_disconnect (int force);

DESCRIPTION
     Plugins and filters can call exit(3) in the configuration phase (before and
     including ".get_ready", but not in connected callbacks).

     Once nbdkit has started serving connections, plugins and filters should not
     call exit(3).  However they may instruct nbdkit to shut down by calling
     "nbdkit_shutdown", or to disconnect a single client by calling "nbdkit_dis-
     connect".

   nbdkit_shutdown
     "nbdkit_shutdown" requests nbdkit to shut down asynchronously and returns
     (note that it does not exit the process immediately).

     It ensures that the plugin and all filters are unloaded cleanly which may
     take some time.  Further callbacks from nbdkit into the plugin or filter
     may occur after you have called this.

   nbdkit_disconnect
     "nbdkit_disconnect" requests that the current client connection be discon-
     nected.  It does not affect other connections, and it does not stop the
     same client from trying to reconnect.

     It is only useful from connected callbacks a that is, after (but not in-
     cluding) ".open", and before ".close".  To reject a client in ".precon-
     nect", ".open" or ".list_exports" you should return an error instead.

     If "force" is true, nbdkit will disconnect the client immediately, and the
     client will not receive any response to the current command or any other
     commands in flight in parallel threads.  If "force" is false, nbdkit will
     not accept any new commands from the client (failing all commands other
     than "NBD_CMD_DISC" with "ESHUTDOWN"), but will allow existing commands to
     complete gracefully.  Either way, the next callback for the current connec-
     tion should be ".close".

LANGUAGE BINDINGS
     In nbdkit-ocaml-plugin(3):

      NBDKit.shutdown : unit -> unit
      NBDKit.disconnect : bool -> unit

     In nbdkit-python-plugin(3):

      import nbdkit
      nbdkit.shutdown()
      nbdkit.disconnect(force)

     In nbdkit-rust-plugin(3):

      use nbdkit::*;
      pub fn shutdown()
      pub fn disconnect(force: bool)

     In nbdkit-sh-plugin(3), there are various magic error codes that can be re-
     turned to indicate that shutdown or disconnection is needed.  See that doc-
     umentation for a full description.

HISTORY
     "nbdkit_shutdown" was added in nbdkit 1.20.  "nbdkit_disconnect" was added
     in nbdkit 1.34.

SEE ALSO
     nbdkit(1), nbdkit-plugin(3), nbdkit-filter(3).

AUTHORS
     Eric Blake

     Richard W.M. Jones

COPYRIGHT
     Copyright Red Hat

LICENSE
     Redistribution and use in source and binary forms, with or without modifi-
     cation, are permitted provided that the following conditions are met:

     *	 Redistributions of source code must retain the above copyright notice,
	 this list of conditions and the following disclaimer.

     *	 Redistributions in binary form must reproduce the above copyright no-
	 tice, this list of conditions and the following disclaimer in the docu-
	 mentation and/or other materials provided with the distribution.

     *	 Neither the name of Red Hat nor the names of its contributors may be
	 used to endorse or promote products derived from this software without
	 specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EX-
     PRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
     CLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DI-
     RECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER-
     VICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABIL-
     ITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
     THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM-
     AGE.

nbdkit-1.46.2			   2026-08-30		      nbdkit_shutdown(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=nbdkit_shutdown&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help