summaryrefslogtreecommitdiffstats
path: root/os-posix.c
diff options
context:
space:
mode:
authorHanna Reitz2022-03-03 17:48:11 +0100
committerKevin Wolf2022-03-04 18:14:40 +0100
commitf22ac4727bfbdd7d54348b8bc6d307e94ad425f8 (patch)
treee18f56c03a03e897180b6e46a24ba68f9aebf14a /os-posix.c
parentcpus: use coroutine TLS macros for iothread_locked (diff)
downloadqemu-f22ac4727bfbdd7d54348b8bc6d307e94ad425f8.tar.gz
qemu-f22ac4727bfbdd7d54348b8bc6d307e94ad425f8.tar.xz
qemu-f22ac4727bfbdd7d54348b8bc6d307e94ad425f8.zip
os-posix: Add os_set_daemonize()
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> Message-Id: <20220303164814.284974-2-hreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c6
1 files changed, 6 insertions, 0 deletions
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