提交 28695489 编写于 作者: A Anthony Liguori

Revert "Convert atexit users to exit_notifier"

This reverts commit d7234f4d.

Conflicts:

	hw/xen_machine_pv.c

This should have never been committed.
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 365c4243
...@@ -333,7 +333,6 @@ static void curses_keyboard_setup(void) ...@@ -333,7 +333,6 @@ static void curses_keyboard_setup(void)
void curses_display_init(DisplayState *ds, int full_screen) void curses_display_init(DisplayState *ds, int full_screen)
{ {
DisplayChangeListener *dcl; DisplayChangeListener *dcl;
static Notifier notifier = { .notify = curses_atexit };
#ifndef _WIN32 #ifndef _WIN32
if (!isatty(1)) { if (!isatty(1)) {
fprintf(stderr, "We need a terminal output\n"); fprintf(stderr, "We need a terminal output\n");
...@@ -343,7 +342,7 @@ void curses_display_init(DisplayState *ds, int full_screen) ...@@ -343,7 +342,7 @@ void curses_display_init(DisplayState *ds, int full_screen)
curses_setup(); curses_setup();
curses_keyboard_setup(); curses_keyboard_setup();
exit_notifier_add(&notifier); atexit(curses_atexit);
#ifndef _WIN32 #ifndef _WIN32
#if defined(SIGWINCH) && defined(KEY_RESIZE) #if defined(SIGWINCH) && defined(KEY_RESIZE)
......
...@@ -97,7 +97,7 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */ ...@@ -97,7 +97,7 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */
void xen_init_display(int domid); void xen_init_display(int domid);
/* configuration (aka xenbus setup) */ /* 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_blk(DriveInfo *disk);
int xen_config_dev_nic(NICInfo *nic); int xen_config_dev_nic(NICInfo *nic);
int xen_config_dev_vfb(int vdev, const char *type); int xen_config_dev_vfb(int vdev, const char *type);
......
...@@ -17,7 +17,7 @@ static void xen_config_cleanup_dir(char *dir) ...@@ -17,7 +17,7 @@ static void xen_config_cleanup_dir(char *dir)
QTAILQ_INSERT_TAIL(&xs_cleanup, d, list); QTAILQ_INSERT_TAIL(&xs_cleanup, d, list);
} }
void xen_config_cleanup(Notifier *notifier) void xen_config_cleanup(void)
{ {
struct xs_dirs *d; struct xs_dirs *d;
......
...@@ -211,7 +211,7 @@ static int xen_domain_watcher(void) ...@@ -211,7 +211,7 @@ static int xen_domain_watcher(void)
} }
/* normal cleanup */ /* normal cleanup */
static void xen_domain_cleanup(Notifier *notifier) static void xen_domain_cleanup(void)
{ {
char *dom; char *dom;
...@@ -232,7 +232,6 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, ...@@ -232,7 +232,6 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,
unsigned int xenstore_port = 0, console_port = 0; unsigned int xenstore_port = 0, console_port = 0;
unsigned long xenstore_mfn = 0, console_mfn = 0; unsigned long xenstore_mfn = 0, console_mfn = 0;
int rc; int rc;
static Notifier exit_notifier = { .notify = xen_domain_cleanup };
memcpy(uuid, qemu_uuid, sizeof(uuid)); memcpy(uuid, qemu_uuid, sizeof(uuid));
rc = xc_domain_create(xen_xc, ssidref, uuid, flags, &xen_domid); 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, ...@@ -241,7 +240,7 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk,
goto err; goto err;
} }
qemu_log("xen: created domain %d\n", xen_domid); qemu_log("xen: created domain %d\n", xen_domid);
exit_notifier_add(&exit_notifier); atexit(xen_domain_cleanup);
if (xen_domain_watcher() == -1) { if (xen_domain_watcher() == -1) {
goto err; goto err;
} }
......
...@@ -42,7 +42,6 @@ static void xen_init_pv(ram_addr_t ram_size, ...@@ -42,7 +42,6 @@ static void xen_init_pv(ram_addr_t ram_size,
CPUState *env; CPUState *env;
DriveInfo *dinfo; DriveInfo *dinfo;
int i; int i;
static Notifier exit_notifier = { .notify = xen_config_cleanup };
/* Initialize a dummy CPU */ /* Initialize a dummy CPU */
if (cpu_model == NULL) { if (cpu_model == NULL) {
...@@ -106,7 +105,7 @@ static void xen_init_pv(ram_addr_t ram_size, ...@@ -106,7 +105,7 @@ static void xen_init_pv(ram_addr_t ram_size,
} }
/* config cleanup hook */ /* config cleanup hook */
exit_notifier_add(&exit_notifier); atexit(xen_config_cleanup);
/* setup framebuffer */ /* setup framebuffer */
xen_init_display(xen_domid); xen_init_display(xen_domid);
......
...@@ -713,15 +713,9 @@ static void term_exit(void) ...@@ -713,15 +713,9 @@ static void term_exit(void)
fcntl(0, F_SETFL, old_fd0_flags); fcntl(0, F_SETFL, old_fd0_flags);
} }
static void term_exit_notifier(Notifier *notifier)
{
term_exit();
}
static void term_init(QemuOpts *opts) static void term_init(QemuOpts *opts)
{ {
struct termios tty; struct termios tty;
static Notifier exit_notifier = { .notify = term_exit_notifier };
tcgetattr (0, &tty); tcgetattr (0, &tty);
oldtty = tty; oldtty = tty;
...@@ -741,9 +735,8 @@ static void term_init(QemuOpts *opts) ...@@ -741,9 +735,8 @@ static void term_init(QemuOpts *opts)
tcsetattr (0, TCSANOW, &tty); tcsetattr (0, TCSANOW, &tty);
if (!term_atexit_done++) { if (!term_atexit_done++)
exit_notifier_add(&exit_notifier); atexit(term_exit);
}
fcntl(0, F_SETFL, O_NONBLOCK); fcntl(0, F_SETFL, O_NONBLOCK);
} }
......
...@@ -827,7 +827,7 @@ static void sdl_mouse_define(int width, int height, int bpp, ...@@ -827,7 +827,7 @@ static void sdl_mouse_define(int width, int height, int bpp,
SDL_SetCursor(guest_sprite); SDL_SetCursor(guest_sprite);
} }
static void sdl_cleanup(Notifier *notifier) static void sdl_cleanup(void)
{ {
if (guest_sprite) if (guest_sprite)
SDL_FreeCursor(guest_sprite); SDL_FreeCursor(guest_sprite);
...@@ -840,7 +840,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) ...@@ -840,7 +840,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
uint8_t data = 0; uint8_t data = 0;
DisplayAllocator *da; DisplayAllocator *da;
const SDL_VideoInfo *vi; const SDL_VideoInfo *vi;
static Notifier exit_notifier = { .notify = sdl_cleanup };
#if defined(__APPLE__) #if defined(__APPLE__)
/* always use generic keymaps */ /* always use generic keymaps */
...@@ -893,7 +892,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) ...@@ -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_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
sdl_cursor_normal = SDL_GetCursor(); sdl_cursor_normal = SDL_GetCursor();
exit_notifier_add(&exit_notifier); atexit(sdl_cleanup);
if (full_screen) { if (full_screen) {
gui_fullscreen = 1; gui_fullscreen = 1;
gui_fullscreen_initial_grab = 1; gui_fullscreen_initial_grab = 1;
......
...@@ -537,7 +537,7 @@ static void configure_rtc(QemuOpts *opts) ...@@ -537,7 +537,7 @@ static void configure_rtc(QemuOpts *opts)
} }
#ifdef _WIN32 #ifdef _WIN32
static void socket_cleanup(Notifier *obj) static void socket_cleanup(void)
{ {
WSACleanup(); WSACleanup();
} }
...@@ -546,7 +546,6 @@ static int socket_init(void) ...@@ -546,7 +546,6 @@ static int socket_init(void)
{ {
WSADATA Data; WSADATA Data;
int ret, err; int ret, err;
static Notifier notifier = { .notify = socket_cleanup };
ret = WSAStartup(MAKEWORD(2,2), &Data); ret = WSAStartup(MAKEWORD(2,2), &Data);
if (ret != 0) { if (ret != 0) {
...@@ -554,7 +553,7 @@ static int socket_init(void) ...@@ -554,7 +553,7 @@ static int socket_init(void)
fprintf(stderr, "WSAStartup: %d\n", err); fprintf(stderr, "WSAStartup: %d\n", err);
return -1; return -1;
} }
exit_notifier_add(&notifier); atexit(socket_cleanup);
return 0; return 0;
} }
#endif #endif
...@@ -3803,8 +3802,6 @@ int main(int argc, char **argv, char **envp) ...@@ -3803,8 +3802,6 @@ int main(int argc, char **argv, char **envp)
error_set_progname(argv[0]); error_set_progname(argv[0]);
exit_notifier_init();
init_clocks(); init_clocks();
qemu_cache_utils_init(envp); qemu_cache_utils_init(envp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册