[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option |
Date: |
Fri, 25 Jul 2014 10:12:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Stefan Hajnoczi <address@hidden> writes:
> When QEMU is executed as part of a test case or from a script, it is
> usually desirable to exit if the parent process terminates. This
> ensures that "leaked" QEMU processes do not continue consuming resources
> after their parent has died.
>
> This patch adds the -chardev exit-on-eof option causing socket and pipe
> chardevs to exit QEMU upon close. This happens when a parent process
> deliberately closes its file descriptor but also when the kernel cleans
> up a crashed process.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> include/sysemu/char.h | 1 +
> qapi-schema.json | 23 ++++++++++++++++-------
> qemu-char.c | 34 ++++++++++++++++++++++++++++------
> qemu-options.hx | 19 +++++++++++++------
> 4 files changed, 58 insertions(+), 19 deletions(-)
>
> diff --git a/include/sysemu/char.h b/include/sysemu/char.h
> index 0bbd631..382b320 100644
> --- a/include/sysemu/char.h
> +++ b/include/sysemu/char.h
> @@ -86,6 +86,7 @@ struct CharDriverState {
> guint fd_in_tag;
> QemuOpts *opts;
> QTAILQ_ENTRY(CharDriverState) next;
> + bool exit_on_eof;
> };
>
> /**
> diff --git a/qapi-schema.json b/qapi-schema.json
> index b11aad2..9b13da1 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2630,10 +2630,13 @@
> # @device: The name of the special file for the device,
> # i.e. /dev/ttyS0 on Unix or COM1: on Windows
> # @type: What kind of device this is.
> +# @exit-on-eof: #optional terminate when other side closes the pipe
> +# (default: false, since: 2.2)
> #
> # Since: 1.4
> ##
> -{ 'type': 'ChardevHostdev', 'data': { 'device' : 'str' } }
> +{ 'type': 'ChardevHostdev', 'data': { 'device' : 'str',
> + '*exit-on-eof' : 'bool' } }
>
> ##
> # @ChardevSocket:
Any use cases beyond libqtest?
If no, should this be x-exit-on-eof?
Hmm, looks like there's no precedence for x- in QAPI.
- [Qemu-devel] [PATCH 0/3] libqtest: solve QEMU process cleanup problem, Stefan Hajnoczi, 2014/07/24
- [Qemu-devel] [PATCH 1/3] libqemustub: add qemu_system_shutdown_request() and no_shutdown, Stefan Hajnoczi, 2014/07/24
- [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Stefan Hajnoczi, 2014/07/24
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Stefan Hajnoczi, 2014/07/25
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Eric Blake, 2014/07/28
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Markus Armbruster, 2014/07/29
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Eric Blake, 2014/07/29
- Re: [Qemu-devel] [PATCH 2/3] qemu-char: add -chardev exit-on-eof option, Markus Armbruster, 2014/07/29
[Qemu-devel] [PATCH 3/3] libqtest: use -chardev exit-on-eof to clean up QEMU, Stefan Hajnoczi, 2014/07/24