finalize-staged: Don't listen to `SIGTERM`, just let kernel exit us
Followup from discussion in https://github.com/ostreedev/ostree/pull/2544#discussion_r958840936 This is more efficient; no need to have the kernel context switch us in at shutdown time just so we can turn around and call `exit()`.
This commit is contained in:
parent
6651b72a7a
commit
683e4eff08
|
|
@ -41,16 +41,6 @@ static GOptionEntry options[] = {
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean
|
|
||||||
sigterm_cb (gpointer user_data)
|
|
||||||
{
|
|
||||||
gboolean *running = user_data;
|
|
||||||
g_print ("Received SIGTERM, exiting\n");
|
|
||||||
*running = FALSE;
|
|
||||||
g_main_context_wakeup (NULL);
|
|
||||||
return G_SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called by ostree-finalize-staged.service, and in turn
|
/* Called by ostree-finalize-staged.service, and in turn
|
||||||
* invokes a cmdprivate function inside the shared library.
|
* invokes a cmdprivate function inside the shared library.
|
||||||
*/
|
*/
|
||||||
|
|
@ -94,14 +84,10 @@ ot_admin_builtin_finalize_staged (int argc, char **argv, OstreeCommandInvocation
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* We want to keep /boot open until the deployment is finalized during
|
/* We want to keep /boot open until the deployment is finalized during
|
||||||
* system shutdown, so block on SIGTERM under the assumption that it will
|
* system shutdown, so block until we get SIGTERM which systemd will send
|
||||||
* be received when systemd stops the unit.
|
* when the unit is stopped.
|
||||||
*/
|
*/
|
||||||
gboolean running = TRUE;
|
pause ();
|
||||||
g_unix_signal_add (SIGTERM, sigterm_cb, &running);
|
|
||||||
g_print ("Waiting for SIGTERM\n");
|
|
||||||
while (running)
|
|
||||||
g_main_context_iteration (NULL, TRUE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue