[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 23/79] Delete PID file on exit
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 23/79] Delete PID file on exit |
Date: |
Sun, 30 Sep 2018 10:12:21 +0200 |
From: Marc-André Lureau <address@hidden>
Register an exit notifier to remove the PID file. By the time atexit()
is called, qemu_write_pidfile() guarantees QEMU owns the PID file,
thus we could safely remove it when exiting.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
vl.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index fa6db17..f2964d9 100644
--- a/vl.c
+++ b/vl.c
@@ -2560,6 +2560,16 @@ static void qemu_run_exit_notifiers(void)
notifier_list_notify(&exit_notifiers, NULL);
}
+static const char *pid_file;
+static Notifier qemu_unlink_pidfile_notifier;
+
+static void qemu_unlink_pidfile(Notifier *n, void *data)
+{
+ if (pid_file) {
+ unlink(pid_file);
+ }
+}
+
bool machine_init_done;
void qemu_add_machine_init_done_notifier(Notifier *notify)
@@ -2884,7 +2894,6 @@ int main(int argc, char **argv, char **envp)
const char *vga_model = NULL;
const char *qtest_chrdev = NULL;
const char *qtest_log = NULL;
- const char *pid_file = NULL;
const char *incoming = NULL;
bool userconfig = true;
bool nographic = false;
@@ -3911,6 +3920,9 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
+ qemu_unlink_pidfile_notifier.notify = qemu_unlink_pidfile;
+ qemu_add_exit_notifier(&qemu_unlink_pidfile_notifier);
+
if (qemu_init_main_loop(&main_loop_err)) {
error_report_err(main_loop_err);
exit(1);
--
1.8.3.1
- [Qemu-devel] [PULL 14/79] cpus: access .qemu_icount_bias with atomic64, (continued)
- [Qemu-devel] [PULL 14/79] cpus: access .qemu_icount_bias with atomic64, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 17/79] kvm: x86: Fix kvm_arch_fixup_msi_route for remap-less case, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 22/79] serial: fix DLL writes, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 10/79] qsp: use atomic64 accessors, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 15/79] dump: fix Windows dump memory run mapping, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 11/79] test-rcu-list: access n_reclaims and n_nodes_removed with atomic64, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 18/79] configure: preserve various environment variables in config.status, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 19/79] hw/char/sh_serial: Add timeout handling to unbreak serial input, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 21/79] util: use fcntl() for qemu_write_pidfile() locking, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 20/79] util: add qemu_write_pidfile(), Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 23/79] Delete PID file on exit,
Paolo Bonzini <=
- [Qemu-devel] [PULL 24/79] change get_image_size return type to int64_t, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 25/79] target/i386: move cpu_cc_srcT to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 28/79] target/i386: move cpu_T1 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 34/79] target/i386: move cpu_tmp3_i32 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 26/79] target/i386: move cpu_A0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 31/79] target/i386: move cpu_ptr0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 30/79] target/i386: move cpu_tmp4 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 29/79] target/i386: move cpu_tmp0 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 32/79] target/i386: move cpu_ptr1 to DisasContext, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 35/79] target/i386: move cpu_tmp1_i64 to DisasContext, Paolo Bonzini, 2018/09/30