File: nbdkit_stdio_safe.pod

package info (click to toggle)
nbdkit 1.42.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,700 kB
  • sloc: ansic: 59,169; sh: 16,858; makefile: 6,452; python: 1,837; cpp: 1,116; perl: 502; ml: 498; tcl: 62
file content (69 lines) | stat: -rw-r--r-- 1,547 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
=head1 NAME

nbdkit_stdio_safe - is it safe to interact with stdin and stdout

=head1 SYNOPSIS

 #include <nbdkit-plugin.h>

 int nbdkit_stdio_safe (void);

=head1 DESCRIPTION

The C<nbdkit_stdio_safe> utility function returns whether or not it is
safe to interact with stdin and stdout during the configuration phase.

This is needed because when the nbdkit I<-s> option is used the plugin
must not directly interact with stdin, because that would interfere
with network communication.

The result of this function only matters in callbacks up to
C<.config_complete>.  Once nbdkit reaches C<.get_ready>, the plugin
should assume that nbdkit may have closed the original stdin and
stdout in order to become a daemon.

L<nbdkit-sh-plugin(3)> uses this function to determine whether it is
safe to support C<script=-> to read a script from stdin.  Also
constructs like C<password=-> (see L<nbdkit_read_password(3)>) are
disabled when reading from stdio is not safe.

=head1 RETURN VALUE

The function returns C<1> (safe) or C<0> (not safe).

It cannot return an error.

=head1 LANGUAGE BINDINGS

In L<nbdkit-ocaml-plugin(3)>:

 NBDKit.stdio_safe : unit -> bool

In L<nbdkit-python-plugin(3)>:

 import nbdkit
 is_safe = nbdkit.stdio_safe()

In L<nbdkit-rust-plugin(3)>:

 use nbdkit::*;
 pub fn is_stdio_safe() -> bool

=head1 HISTORY

C<nbdkit_stdio_safe> was added in nbdkit 1.20.

=head1 SEE ALSO

L<nbdkit(1)>,
L<nbdkit_read_password(3)>,
L<nbdkit-plugin(3)>,
L<nbdkit-filter(3)>.

=head1 AUTHORS

Eric Blake

=head1 COPYRIGHT

Copyright Red Hat