X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/f0c4d3ebc31969457850a710c25e663880072ed7..14244b21a041161185bb53c3eb29e3d8dc7bfe6e:/os-posix.c diff --git a/os-posix.c b/os-posix.c index e3ed497224..5c64518902 100644 --- a/os-posix.c +++ b/os-posix.c @@ -36,7 +36,7 @@ /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" @@ -44,6 +44,10 @@ #include #endif +#ifdef __FreeBSD__ +#include +#endif + static struct passwd *user_pwd; static const char *chroot_dir; static int daemonize; @@ -144,8 +148,7 @@ void os_set_proc_name(const char *s) char name[16]; if (!s) return; - name[sizeof(name) - 1] = 0; - strncpy(name, s, sizeof(name)); + pstrcpy(name, sizeof(name), s); /* Could rewrite argv[0] too, but that's a bit more complicated. This simple way is enough for `top'. */ if (prctl(PR_SET_NAME, name)) { @@ -184,8 +187,12 @@ void os_parse_cmd_args(int index, const char *optarg) case QEMU_OPTION_daemonize: daemonize = 1; break; +#if defined(CONFIG_LINUX) + case QEMU_OPTION_enablefips: + fips_set_state(true); + break; +#endif } - return; } static void change_process_uid(void) @@ -351,3 +358,8 @@ int qemu_create_pidfile(const char *filename) /* keep pidfile open & locked forever */ return 0; } + +bool is_daemonized(void) +{ + return daemonize; +}