qemu-devel
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]