Received: from eggs.gnu.org ([2001:4830:134:3::10]:53129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmzJ2-0004hv-QF for qemu-devel@nongnu.org; Thu, 13 Jun 2013 00:38:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmzJ1-0007eB-TC for qemu-devel@nongnu.org; Thu, 13 Jun 2013 00:38:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmzJ1-0007e1-LJ for qemu-devel@nongnu.org; Thu, 13 Jun 2013 00:38:39 -0400 Date: Thu, 13 Jun 2013 12:38:29 +0800 From: Amos Kong Message-ID: <20130613043829.GA3360@t430s.nay.redhat.com> References: <1364804434-7980-1-git-send-email-qemulist@gmail.com> <1364804434-7980-6-git-send-email-qemulist@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1364804434-7980-6-git-send-email-qemulist@gmail.com> Subject: Re: [Qemu-devel] about atexit() (was: [PATCH 5/5] hostmem: init/finalize hostmem listener) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Peter Maydell , Anthony Liguori , Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Vasilis Liaskovitis , Stefan Hajnoczi , Paolo Bonzini On Mon, Apr 01, 2013 at 04:20:34PM +0800, Liu Ping Fan wrote: > From: Liu Ping Fan > > Signed-off-by: Liu Ping Fan > --- > vl.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/vl.c b/vl.c > index 7643f16..46a25cf 100644 > --- a/vl.c > +++ b/vl.c > @@ -4157,6 +4157,7 @@ int main(int argc, char **argv, char **envp) > } > > os_set_line_buffering(); > + hostmem_init(); > > qemu_init_cpu_loop(); > qemu_mutex_lock_iothread(); > @@ -4174,6 +4175,7 @@ int main(int argc, char **argv, char **envp) > > /* clean up network at qemu process termination */ > atexit(&net_cleanup); > + atexit(&hostmem_finalize); The func registered by atexit() can only be called at normal termination. If qemu process is abort() or killed by 'kill -9', the func won't be called. A known issue: at the abnormal termination, downscript could not be executed to cleanup tap device. Can we suggest user to clean network manually in this condition? > > if (net_init_clients() < 0) { > exit(1); > -- -- Amos.