On 12/07/2016 09:43, Jason Wang wrote:
On 2016年07月11日 22:48, address@hidden wrote:
From: Marc-André Lureau <address@hidden>
We would like to move back net_cleanup() at the end of main function,
like it used to be until f30dbae63a46f23116715dff8d130c, but minimum
tap cleanup is necessary regarless at exit() time. Use an exit notifier
to call TAP down_script. If net_cleanup() is called first, then remove
the exit notifier as it will become a dangling pointer otherwise.
Signed-off-by: Marc-André Lureau <address@hidden>
Suggested-by: Paolo Bonzini <address@hidden>
This looks like a tap specific solution. But at least slirp wants to do
some cleanup too.
Right, specifically slirp_smb_cleanup.
We need a generic solution. Does it work if we use
atexit(net_chr_cleanup) and first cleanup net and then chr at that
function?
I think exit notifiers _are_ a generic solution. Most pieces of QEMU
don't care about cleanup at exit(), because the operating system takes
care of it (freeing memory, closing file descriptors, etc.).
Tap, slirp and chardev are exceptions, and they can use the exit
notifiers. I'll send a patch for slirp.
Paolo