diff --git a/curses.c b/curses.c index 44ab1a52c9145cb5f61c04cc37dcdfdcd754190f..b78c4689cba28bb27340f76417ca614a5a426efd 100644 --- a/curses.c +++ b/curses.c @@ -333,7 +333,6 @@ static void curses_keyboard_setup(void) void curses_display_init(DisplayState *ds, int full_screen) { DisplayChangeListener *dcl; - static Notifier notifier = { .notify = curses_atexit }; #ifndef _WIN32 if (!isatty(1)) { fprintf(stderr, "We need a terminal output\n"); @@ -343,7 +342,7 @@ void curses_display_init(DisplayState *ds, int full_screen) curses_setup(); curses_keyboard_setup(); - exit_notifier_add(¬ifier); + atexit(curses_atexit); #ifndef _WIN32 #if defined(SIGWINCH) && defined(KEY_RESIZE) diff --git a/hw/xen_backend.h b/hw/xen_backend.h index 991a7b7d540ff9242a8634b680e5a7bb21e5a581..f07f7d4224cb6e669370ad797e6419d35a823bf8 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -97,7 +97,7 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */ void xen_init_display(int domid); /* configuration (aka xenbus setup) */ -void xen_config_cleanup(Notifier *notifier); +void xen_config_cleanup(void); int xen_config_dev_blk(DriveInfo *disk); int xen_config_dev_nic(NICInfo *nic); int xen_config_dev_vfb(int vdev, const char *type); diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c index 028f47ecb59d3020ef4dc6a6c525ca50325f957f..ea8f8c4c2df69277ff4c6b10723ec7d8f87caac9 100644 --- a/hw/xen_devconfig.c +++ b/hw/xen_devconfig.c @@ -17,7 +17,7 @@ static void xen_config_cleanup_dir(char *dir) QTAILQ_INSERT_TAIL(&xs_cleanup, d, list); } -void xen_config_cleanup(Notifier *notifier) +void xen_config_cleanup(void) { struct xs_dirs *d; diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c index b735ca453d91872c7c4d70c5191e277c2698627d..2f59856f73c8d86861097388557662caeb66cdd5 100644 --- a/hw/xen_domainbuild.c +++ b/hw/xen_domainbuild.c @@ -211,7 +211,7 @@ static int xen_domain_watcher(void) } /* normal cleanup */ -static void xen_domain_cleanup(Notifier *notifier) +static void xen_domain_cleanup(void) { char *dom; @@ -232,7 +232,6 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, unsigned int xenstore_port = 0, console_port = 0; unsigned long xenstore_mfn = 0, console_mfn = 0; int rc; - static Notifier exit_notifier = { .notify = xen_domain_cleanup }; memcpy(uuid, qemu_uuid, sizeof(uuid)); rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); @@ -241,7 +240,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, goto err; } qemu_log("xen: created domain %d\n", xen_domid); - exit_notifier_add(&exit_notifier); + atexit(xen_domain_cleanup); if (xen_domain_watcher() == -1) { goto err; } diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c index fe7d35cf89951516d8d083878c33fc25aefb11a4..162f88db3326c113fea15d18a4254beb1c04166a 100644 --- a/hw/xen_machine_pv.c +++ b/hw/xen_machine_pv.c @@ -42,7 +42,6 @@ static void xen_init_pv(ram_addr_t ram_size, CPUState *env; DriveInfo *dinfo; int i; - static Notifier exit_notifier = { .notify = xen_config_cleanup }; /* Initialize a dummy CPU */ if (cpu_model == NULL) { @@ -106,7 +105,7 @@ static void xen_init_pv(ram_addr_t ram_size, } /* config cleanup hook */ - exit_notifier_add(&exit_notifier); + atexit(xen_config_cleanup); /* setup framebuffer */ xen_init_display(xen_domid); diff --git a/qemu-char.c b/qemu-char.c index c02dfae43a57bbf36e238fc9f7925054738ae064..a3d6e6496701f66ec30b509a32160c086c29f941 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -713,15 +713,9 @@ static void term_exit(void) fcntl(0, F_SETFL, old_fd0_flags); } -static void term_exit_notifier(Notifier *notifier) -{ - term_exit(); -} - static void term_init(QemuOpts *opts) { struct termios tty; - static Notifier exit_notifier = { .notify = term_exit_notifier }; tcgetattr (0, &tty); oldtty = tty; @@ -741,9 +735,8 @@ static void term_init(QemuOpts *opts) tcsetattr (0, TCSANOW, &tty); - if (!term_atexit_done++) { - exit_notifier_add(&exit_notifier); - } + if (!term_atexit_done++) + atexit(term_exit); fcntl(0, F_SETFL, O_NONBLOCK); } diff --git a/sdl.c b/sdl.c index 8dc78cd9594cd49bad06ef49e2cf25563fed7aa6..16a48e92cb7f3ef3c92c12870d9359154cdd0301 100644 --- a/sdl.c +++ b/sdl.c @@ -827,7 +827,7 @@ static void sdl_mouse_define(int width, int height, int bpp, SDL_SetCursor(guest_sprite); } -static void sdl_cleanup(Notifier *notifier) +static void sdl_cleanup(void) { if (guest_sprite) SDL_FreeCursor(guest_sprite); @@ -840,7 +840,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) uint8_t data = 0; DisplayAllocator *da; const SDL_VideoInfo *vi; - static Notifier exit_notifier = { .notify = sdl_cleanup }; #if defined(__APPLE__) /* always use generic keymaps */ @@ -893,7 +892,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal = SDL_GetCursor(); - exit_notifier_add(&exit_notifier); + atexit(sdl_cleanup); if (full_screen) { gui_fullscreen = 1; gui_fullscreen_initial_grab = 1; diff --git a/vl.c b/vl.c index 8274c1ddda15271f0f0924719c799c6637ea1a7a..26b638c11dca740c6924f9a0cb8a1fb8c7ffebde 100644 --- a/vl.c +++ b/vl.c @@ -537,7 +537,7 @@ static void configure_rtc(QemuOpts *opts) } #ifdef _WIN32 -static void socket_cleanup(Notifier *obj) +static void socket_cleanup(void) { WSACleanup(); } @@ -546,7 +546,6 @@ static int socket_init(void) { WSADATA Data; int ret, err; - static Notifier notifier = { .notify = socket_cleanup }; ret = WSAStartup(MAKEWORD(2,2), &Data); if (ret != 0) { @@ -554,7 +553,7 @@ static int socket_init(void) fprintf(stderr, "WSAStartup: %d\n", err); return -1; } - exit_notifier_add(¬ifier); + atexit(socket_cleanup); return 0; } #endif @@ -3803,8 +3802,6 @@ int main(int argc, char **argv, char **envp) error_set_progname(argv[0]); - exit_notifier_init(); - init_clocks(); qemu_cache_utils_init(envp);