main.c (940a8ce075e3408742a4edcabfd6c2a15e2539eb) main.c (94d81ae896810beafa60c85b88e991daa986e1fc)
1/*
2 * QEMU Guest Agent
3 *
4 * Copyright IBM Corp. 2011
5 *
6 * Authors:
7 * Adam Litke <aglitke@linux.vnet.ibm.com>
8 * Michael Roth <mdroth@linux.vnet.ibm.com>

--- 117 unchanged lines hidden (view full) ---

126
127static void quit_handler(int sig)
128{
129 /* if we're frozen, don't exit unless we're absolutely forced to,
130 * because it's basically impossible for graceful exit to complete
131 * unless all log/pid files are on unfreezable filesystems. there's
132 * also a very likely chance killing the agent before unfreezing
133 * the filesystems is a mistake (or will be viewed as one later).
1/*
2 * QEMU Guest Agent
3 *
4 * Copyright IBM Corp. 2011
5 *
6 * Authors:
7 * Adam Litke <aglitke@linux.vnet.ibm.com>
8 * Michael Roth <mdroth@linux.vnet.ibm.com>

--- 117 unchanged lines hidden (view full) ---

126
127static void quit_handler(int sig)
128{
129 /* if we're frozen, don't exit unless we're absolutely forced to,
130 * because it's basically impossible for graceful exit to complete
131 * unless all log/pid files are on unfreezable filesystems. there's
132 * also a very likely chance killing the agent before unfreezing
133 * the filesystems is a mistake (or will be viewed as one later).
134 * On Windows the freeze interval is limited to 10 seconds, so
135 * we should quit, but first we should wait for the timeout, thaw
136 * the filesystem and quit.
134 */
135 if (ga_is_frozen(ga_state)) {
137 */
138 if (ga_is_frozen(ga_state)) {
139#ifdef _WIN32
140 int i = 0;
141 Error *err = NULL;
142 HANDLE hEventTimeout;
143
144 g_debug("Thawing filesystems before exiting");
145
146 hEventTimeout = OpenEvent(EVENT_ALL_ACCESS, FALSE, EVENT_NAME_TIMEOUT);
147 if (hEventTimeout) {
148 WaitForSingleObject(hEventTimeout, 0);
149 CloseHandle(hEventTimeout);
150 }
151 qga_vss_fsfreeze(&i, false, &err);
152 if (err) {
153 g_debug("Error unfreezing filesystems prior to exiting: %s",
154 error_get_pretty(err));
155 error_free(err);
156 }
157#else
136 return;
158 return;
159#endif
137 }
138 g_debug("received signal num %d, quitting", sig);
139
140 if (g_main_loop_is_running(ga_state->main_loop)) {
141 g_main_loop_quit(ga_state->main_loop);
142 }
143}
144

--- 1292 unchanged lines hidden ---
160 }
161 g_debug("received signal num %d, quitting", sig);
162
163 if (g_main_loop_is_running(ga_state->main_loop)) {
164 g_main_loop_quit(ga_state->main_loop);
165 }
166}
167

--- 1292 unchanged lines hidden ---