search for: listen_stdin

Displaying 20 results from an estimated 33 matches for "listen_stdin".

2019 Oct 18
2
[PATCH nbdkit] Add support for AF_VSOCK.
This is a series of patches to libnbd and nbdkit adding AF_VSOCK support. On the host side it allows you to start an nbdkit instance which listens on a virtio-vsock socket: $ ./nbdkit -fv --vsock memory 1G ... nbdkit: debug: bound to vsock 2:10809 On the guest side you can then use libnbd to connect to the server: $ ./run nbdsh -c 'h.connect_vsock(2, 10809)' -c
2019 Oct 18
2
Re: [PATCH nbdkit] Add support for AF_VSOCK.
...xed up -p/--run/-s/-U/--vsock options, then > + * give an error. > * > * XXX Actually the server could easily be extended to handle both > * TCP/IP and Unix sockets, or even multiple TCP/IP ports. > */ > - if ((port && unixsocket) || (port && listen_stdin) || > - (unixsocket && listen_stdin) || (listen_stdin && run)) { > + if ((port && unixsocket) || > + (port && listen_stdin) || > + (unixsocket && listen_stdin) || > + (listen_stdin && run) || > + (vsock &amp...
2020 Apr 04
0
[nbdkit PATCH 1/2] server: Add nbdkit_stdio_safe
...extern char *nbdkit_realpath (const char *path); extern int nbdkit_nanosleep (unsigned sec, unsigned nsec); diff --git a/server/main.c b/server/main.c index 62598b81..748122fc 100644 --- a/server/main.c +++ b/server/main.c @@ -529,12 +529,13 @@ main (int argc, char *argv[]) (port && listen_stdin) || (unixsocket && listen_stdin) || (listen_stdin && run) || + (listen_stdin && dump_plugin) || (vsock && unixsocket) || (vsock && listen_stdin) || (vsock && run)) { fprintf (stderr, - "%s:...
2020 Apr 04
6
[nbdkit PATCH 0/2] stdin/out cleanups
This is what I've been playing with in response to my earlier question about what to do with 'nbdkit -s sh -' (https://www.redhat.com/archives/libguestfs/2020-April/msg00032.html) I'm still open to ideas on a better name, and/or whether adding <stdbool.h> to our public include files is a good idea (if not, returning int instead of bool is tolerable). Eric Blake (2):
2019 Oct 18
0
[PATCH nbdkit] Add support for AF_VSOCK.
...an error. + /* If the user has mixed up -p/--run/-s/-U/--vsock options, then + * give an error. * * XXX Actually the server could easily be extended to handle both * TCP/IP and Unix sockets, or even multiple TCP/IP ports. */ - if ((port && unixsocket) || (port && listen_stdin) || - (unixsocket && listen_stdin) || (listen_stdin && run)) { + if ((port && unixsocket) || + (port && listen_stdin) || + (unixsocket && listen_stdin) || + (listen_stdin && run) || + (vsock && unixsocket) || + (...
2019 Oct 18
1
[PATCH nbdkit v2] Add support for AF_VSOCK.
v1 was discussed here: https://www.redhat.com/archives/libguestfs/2019-October/thread.html#00100 v2: - Bind to VMADDR_CID_ANY (instead of HOST) and update the documentation accordingly. - Don't bother with SOCK_CLOEXEC fallback path that can never be used. Rich.
2020 Feb 22
2
Re: Plans for nbdkit 1.18 release?
Eric: Did you want to take this one any further? It might be one that we save for > 1.18: https://www.redhat.com/archives/libguestfs/2020-February/thread.html#00206 Another thing I've been thinking about for some time is splitting .config_complete into .config_complete + .get_ready (new name TBD). At the moment .config_complete is both the place where we finish processing config, and
2020 Jul 10
0
[RFC nbdkit PATCH] server: Allow --run with --vsock
...uot;nbd:unix:"); - shell_quote (unixsocket, fp); - } - else - abort (); } putc ('\n', fp); diff --git a/server/main.c b/server/main.c index c432f5bd..dfa81a85 100644 --- a/server/main.c +++ b/server/main.c @@ -545,8 +545,7 @@ main (int argc, char *argv[]) (listen_stdin && run) || (listen_stdin && dump_plugin) || (vsock && unixsocket) || - (vsock && listen_stdin) || - (vsock && run)) { + (vsock && listen_stdin)) { fprintf (stderr, "%s: --dump-plugin, -p, --run, -s,...
2020 Feb 22
1
Re: Plans for nbdkit 1.18 release?
...if + /* If the user has mixed up -p/--run/-s/-U/--vsock options, then + * give an error. + * + * XXX Actually the server could easily be extended to handle both + * TCP/IP and Unix sockets, or even multiple TCP/IP ports. + */ + if ((port && unixsocket) || + (port && listen_stdin) || + (unixsocket && listen_stdin) || + (listen_stdin && run) || + (vsock && unixsocket) || + (vsock && listen_stdin) || + (vsock && run)) { + fprintf (stderr, + "%s: -p, --run, -s, -U or --vsock options cannot be...
2020 Apr 14
0
[nbdkit PATCH v2 1/3] server: Add nbdkit_stdio_safe
...binary forms, with or without * modification, are permitted provided that the following conditions are @@ -404,6 +404,13 @@ nbdkit_parse_bool (const char *str) return -1; } +/* Return true if it is safe to read from stdin during configuration. */ +int +nbdkit_stdio_safe (void) +{ + return !listen_stdin; +} + /* Read a password from configuration value. */ static int read_password_from_fd (const char *what, int fd, char **password); @@ -419,6 +426,11 @@ nbdkit_read_password (const char *value, char **password) /* Read from stdin. */ if (strcmp (value, "-") == 0) { + if (!nbd...
2019 Jan 01
2
[PATCH nbdkit] server: Use bool for types which are really booleans.
.../* 0 = -o, 1 = -n */ +bool newstyle = true; /* false = -o, true = -n */ char *pidfile; /* -P */ const char *port; /* -p */ -int readonly; /* -r */ +bool readonly; /* -r */ char *run; /* --run */ -int listen_stdin; /* -s */ +bool listen_stdin; /* -s */ const char *selinux_label; /* --selinux-label */ int threads; /* -t */ int tls; /* --tls : 0=off 1=on 2=require */ const char *tls_certificates_dir; /* --tls-certificates */ const c...
2019 Aug 27
0
[nbdkit PATCH] server: Enforce sane stdin/out/err
...++++++++ 3 files changed, 24 insertions(+) diff --git a/server/internal.h b/server/internal.h index 22e13b6d..a9692bbc 100644 --- a/server/internal.h +++ b/server/internal.h @@ -92,6 +92,7 @@ extern bool no_sr; extern const char *port; extern bool readonly; extern const char *run; +extern bool listen_stdin; extern const char *selinux_label; extern int threads; extern int tls; diff --git a/server/connections.c b/server/connections.c index c173df8d..0184afea 100644 --- a/server/connections.c +++ b/server/connections.c @@ -366,6 +366,18 @@ free_connection (struct connection *conn) threadlocal_set...
2020 Apr 14
0
[nbdkit PATCH v2 2/3] server: Sanitize stdin/out before running plugin code
...ernal command: %m"); r = EXIT_FAILURE; diff --git a/server/connections.c b/server/connections.c index c54c71c1..c7b55ca1 100644 --- a/server/connections.c +++ b/server/connections.c @@ -335,18 +335,6 @@ free_connection (struct connection *conn) return; conn->close (); - if (listen_stdin) { - int fd; - - /* Restore something to stdin/out so the rest of our code can - * continue to assume that all new fds will be above stderr. - * Swap directions to get EBADF on improper use of stdin/out. - */ - fd = open ("/dev/null", O_WRONLY | O_CLOEXEC); - asser...
2020 Apr 04
0
[nbdkit PATCH 2/2] server: Sanitize stdin/out before running plugin code
...ernal command: %m"); r = EXIT_FAILURE; diff --git a/server/connections.c b/server/connections.c index c54c71c1..c7b55ca1 100644 --- a/server/connections.c +++ b/server/connections.c @@ -335,18 +335,6 @@ free_connection (struct connection *conn) return; conn->close (); - if (listen_stdin) { - int fd; - - /* Restore something to stdin/out so the rest of our code can - * continue to assume that all new fds will be above stderr. - * Swap directions to get EBADF on improper use of stdin/out. - */ - fd = open ("/dev/null", O_WRONLY | O_CLOEXEC); - asser...
2017 Jan 31
0
[PATCH nbdkit] Add support for socket activation.
...e_pidfile (void); static void fork_into_background (void); static uid_t parseuser (const char *); static gid_t parsegroup (const char *); +static unsigned int get_socket_activation (void); const char *exportname; /* -e */ int foreground; /* -f */ @@ -77,6 +80,7 @@ int listen_stdin; /* -s */ char *unixsocket; /* -U */ const char *user, *group; /* -u & -g */ int verbose; /* -v */ +unsigned int socket_activation /* $LISTEN_FDS and $LISTEN_PID set */; volatile int quit; @@ -157,6 +161,9 @@ main (int argc, char *ar...
2017 Nov 17
0
[nbdkit PATCH 6/6] Add --threads option for supporting true parallel requests
...uct connection *conn, int readonly); extern void plugin_close (struct connection *conn); diff --git a/src/main.c b/src/main.c index c9f08ab..cc5e9e3 100644 --- a/src/main.c +++ b/src/main.c @@ -84,6 +84,7 @@ int readonly; /* -r */ char *run; /* --run */ int listen_stdin; /* -s */ const char *selinux_label; /* --selinux-label */ +int threads; /* -t */ int tls; /* --tls : 0=off 1=on 2=require */ const char *tls_certificates_dir; /* --tls-certificates */ int tls_verify_peer; /* --tls-verify-p...
2020 Apr 14
6
[nbdkit PATCH v2 0/3] more consistent stdin/out handling
In v2: - use int instead of bool in the public header - split the tests from the code - don't overload test-layers; instead, add new tests - add a missing fflush exposed by the new tests - other minor cleanups Eric Blake (3): server: Add nbdkit_stdio_safe server: Sanitize stdin/out before running plugin code server: More tests of stdin/out handling docs/nbdkit-plugin.pod |
2019 Sep 01
11
[nbdkit PATCH 00/10] Avoid -Wshadow
While working on can_FOO caching, at one point I got confused by whether 'readonly' meant the global set by -r or a local passed to .open(). A quick attempt to compile with -Wshadow found several other confusing points; this series gets us to the point that we can add -Wshadow to builds with --enable-gcc-warnings. Eric Blake (10): server: Avoid -Wshadow warnings guestfs: Avoid
2019 Oct 11
0
[PATCH NOT WORKING nbdkit v2 1/2] server: Add .ready_to_serve plugin method.
...user (); + backend->ready_to_serve (backend); write_pidfile (); accept_incoming_connections (socks, nr_socks); free_listening_sockets (socks, nr_socks); /* also closes them */ @@ -866,6 +867,7 @@ start_serving (void) /* Handling a single connection on stdin/stdout. */ if (listen_stdin) { change_user (); + backend->ready_to_serve (backend); write_pidfile (); threadlocal_new_server_thread (); if (handle_single_connection (0, 1) == -1) @@ -882,6 +884,7 @@ start_serving (void) run_command (); change_user (); fork_into_background (); + backend->...
2017 Nov 17
8
[RFC nbdkit PATCH 0/6] Enable full parallel request handling
I want to make my nbd forwarding plugin fully parallel - but to do that, I first need to make nbdkit itself fully parallel ;) With this series, I was finally able to demonstrate out-of-order responses when using qemu-io (which is great at sending back-to-back requests prior to waiting for responses) coupled with the nbd file plugin (which has a great feature of rdelay and wdelay, to make it