qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Hanna Reitz <hreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH v2 1/4] os-posix: Add os_set_daemonize()
Date: Thu, 3 Mar 2022 14:22:13 -0600	[thread overview]
Message-ID: <20220303202213.75wzcoz6f5t2hcfn@redhat.com> (raw)
In-Reply-To: <20220303164814.284974-2-hreitz@redhat.com>

On Thu, Mar 03, 2022 at 05:48:11PM +0100, Hanna Reitz wrote:
> The daemonizing functions in os-posix (os_daemonize() and
> os_setup_post()) only daemonize the process if the static `daemonize`
> variable is set.  Right now, it can only be set by os_parse_cmd_args().
> 
> In order to use os_daemonize() and os_setup_post() from the storage
> daemon to have it be daemonized, we need some other way to set this
> `daemonize` variable, because I would rather not tap into the system
> emulator's arg-parsing code.  Therefore, this patch adds an
> os_set_daemonize() function, which will return an error on os-win32
> (because daemonizing is not supported there).
> 
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---

> +++ b/include/sysemu/os-win32.h
> @@ -77,6 +77,11 @@ typedef struct {
>  } qemu_timeval;
>  int qemu_gettimeofday(qemu_timeval *tp);
>  
> +static inline int os_set_daemonize(bool d)
> +{
> +    return -ENOTSUP;

Should this fail only if d is true?  Or will all callers only ever
pass true, in which case why do we need the paraemeter?

> +}
> +
>  static inline bool is_daemonized(void)
>  {
>      return false;
> diff --git a/os-posix.c b/os-posix.c
> index ae6c9f2a5e..24692c8593 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -317,6 +317,12 @@ bool is_daemonized(void)
>      return daemonize;
>  }
>  
> +int os_set_daemonize(bool d)
> +{
> +    daemonize = d;
> +    return 0;
> +}
> +
>  int os_mlock(void)
>  {
>  #ifdef HAVE_MLOCKALL
> -- 
> 2.34.1
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2022-03-03 20:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 16:48 [PATCH v2 0/4] qsd: Add --daemonize; and add job quit tests Hanna Reitz
2022-03-03 16:48 ` [PATCH v2 1/4] os-posix: Add os_set_daemonize() Hanna Reitz
2022-03-03 20:22   ` Eric Blake [this message]
2022-03-04  9:19   ` Daniel P. Berrangé
2022-03-04 10:20     ` Kevin Wolf
2022-03-04 11:58       ` Daniel P. Berrangé
2022-03-03 16:48 ` [PATCH v2 2/4] qsd: Add pre-init argument parsing pass Hanna Reitz
2022-03-03 22:27   ` Eric Blake
2022-03-03 16:48 ` [PATCH v2 3/4] qsd: Add --daemonize Hanna Reitz
2022-03-03 22:31   ` Eric Blake
2022-03-04  9:27   ` Kevin Wolf
2022-03-03 16:48 ` [PATCH v2 4/4] iotests/185: Add post-READY quit tests Hanna Reitz
2022-03-03 22:36   ` Eric Blake
2022-03-04 10:47 ` [PATCH v2 0/4] qsd: Add --daemonize; and add job " Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220303202213.75wzcoz6f5t2hcfn@redhat.com \
    --to=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).