Displaying 3 results from an estimated 3 matches for "nbd_unlocked_kill_command".
2019 Jul 25
0
Re: [PATCH libnbd] api: New nbd_kill_command API for sending a signal to the command subprocess.
...ot need to use this call. It is only needed if the server
> +does not exit when the socket is closed.
> +
> +The C<signal> flag is the optional signal number to send
> +(see L<signal(7)>). If signal is C<0> then C<SIGTERM> is sent.";
[1]
> +int
> +nbd_unlocked_kill_command (struct nbd_handle *h, int signal)
> +{
Is gcc -Wshadow going to annoy us by this choice of naming? I'd use
signum, if we're worried.
> @@ -149,6 +150,7 @@ main (int argc, char *argv[])
> read_cb, NULL,
>...
2019 Aug 15
1
[PATCH libnbd] api: Rename nbd_kill_command -> nbd_kill_subprocess.
...rgs = [ Int "signum" ]; ret = RErr;
shortdesc = "kill server running as a subprocess";
diff --git a/lib/handle.c b/lib/handle.c
index d599eef..b508744 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -254,7 +254,7 @@ nbd_unlocked_get_version (struct nbd_handle *h)
}
int
-nbd_unlocked_kill_command (struct nbd_handle *h, int signum)
+nbd_unlocked_kill_subprocess (struct nbd_handle *h, int signum)
{
if (h->pid == -1) {
set_error (ESRCH, "no subprocess exists");
diff --git a/tests/closure-lifetimes.c b/tests/closure-lifetimes.c
index 5a7cd9c..70788b6 100644
--- a/tests/clo...
2019 Jul 25
4
[PATCH libnbd] api: New nbd_kill_command API for sending a signal to the command subprocess.
...gt;sock)
h->sock->ops->close (h->sock);
- if (h->pid >= 0) /* XXX kill it? */
+ if (h->pid > 0)
waitpid (h->pid, NULL, 0);
free (h->export_name);
@@ -215,6 +217,30 @@ nbd_unlocked_get_version (struct nbd_handle *h)
return PACKAGE_VERSION;
}
+int
+nbd_unlocked_kill_command (struct nbd_handle *h, int signal)
+{
+ if (h->pid == -1) {
+ set_error (ESRCH, "no subprocess exists");
+ return -1;
+ }
+ assert (h->pid > 0);
+
+ if (signal == 0)
+ signal = SIGTERM;
+ if (signal < 0) {
+ set_error (EINVAL, "invalid signal number: %d&q...