nbdkit_stdio_safe(3)
π nbdkit_stdio_safe β is it safe to interact with stdin and stdout π
okay bestie, welcome to the nbdkit manual, section 3. this one's short and sweet and honestly iconic for how much chaos it prevents. let's get into it π«Ά
β¨ SYNOPSIS β¨
#include <nbdkit-plugin.h>
int nbdkit_stdio_safe (void);
πΈ DESCRIPTION πΈ
so like. the nbdkit_stdio_safe utility function returns whether or not it's safe to interact with stdin and stdout during the configuration phase. that's it, that's the whole job, no cap.
why does this even exist?? because when the nbdkit -s option is used, the plugin must not directly interact with stdin β that would interfere with network communication. and we do NOT want to be fighting the network for stdin, that's giving main character energy from the wrong character π
the result of this function only matters in callbacks up to .config_complete. once nbdkit reaches .get_ready, the plugin should assume that nbdkit may have closed the original stdin and stdout in order to become a daemon. so like, after that point? all bets are off, bestie, assume the stdio is gone β¨
nbdkit-sh-plugin(3) uses this function to determine whether it's safe to support script=- to read a script from stdin. also constructs like password=- (see nbdkit_read_password(3)) get disabled when reading from stdio is not safe. love that for us, honestly β the function just quietly protects everybody π
β RETURN VALUE β
- returns
1when it's safe - returns
0when it's not safe
and that's it. it literally cannot return an error. no error codes, no errno drama, no nothing. it's giving emotionally stable function π
π¦ LANGUAGE BINDINGS π¦
In nbdkit-ocaml-plugin(3):
NBDKit.stdio_safe : unit -> bool
In nbdkit-python-plugin(3):
import nbdkit
is_safe = nbdkit.stdio_safe()
In nbdkit-rust-plugin(3):
use nbdkit::*;
pub fn is_stdio_safe() -> bool
look at all these languages showing up for the function. multilingual queen π
π HISTORY π
nbdkit_stdio_safe was added in nbdkit 1.20. a relatively recent addition to the family, and we're obsessed π₯³
π SEE ALSO π
π AUTHORS π
Eric Blake β thank you for your service, king π«‘
π COPYRIGHT π
Copyright Red Hat
π LICENSE π
so legally speaking, redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met (yes, all three, no skipping, iykyk):
- 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 notice, this list of conditions and the following disclaimer in the documentation 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 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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 DAMAGE.
like, the lawyers wrote that one, not me, and honestly they ate π₯
okay that's the whole page bestie!! this one comes to you from nbdkit-1.48.1, dated 2026-08-29, page nbdkit_stdio_safe(3). stay safe out there, check your stdio, and never talk to stdin without permission πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- fedora 44: nbdkit-devel 1.48.1-1.fc44 Β· BSD-3-Clause
- fedora 44: nbdkit-devel 1.48.1-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms