summaryrefslogtreecommitdiff
path: root/src/libply-splash-core
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2010-04-29 13:23:18 -0400
committerRay Strode <rstrode@redhat.com>2010-04-29 13:23:18 -0400
commit8c7b2de6913870167bee60f73423841721f1a2cc (patch)
treebdc899b6ca924b5ad302ad41ca97fee9df8f2f30 /src/libply-splash-core
parentee41b742adad92eab2489be8e9cf96a0cbdae6ca (diff)
[terminal] wait for vt switching to finish on quit
After changing the active vt during start up, we get a signal when it finishes, because we're in VT_PROCESS mode, so we don't need to explicitly block waiting for it to finish. During the quit path, though, we aren't in VT_PROCESS mode anymore, won't get any signals, and still need to know that the VT switch is finished before informing the client that the quit is finished. This commit forces ply_terminal_deactivate_vt to block until the VT switch it initiates finishes.
Diffstat (limited to 'src/libply-splash-core')
-rw-r--r--src/libply-splash-core/ply-terminal.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c
index 92e4a442..f71f25af 100644
--- a/src/libply-splash-core/ply-terminal.c
+++ b/src/libply-splash-core/ply-terminal.c
@@ -743,6 +743,16 @@ set_active_vt (ply_terminal_t *terminal,
}
static bool
+wait_for_vt_to_become_active (ply_terminal_t *terminal,
+ int vt_number)
+{
+ if (ioctl (terminal->fd, VT_WAITACTIVE, vt_number) < 0)
+ return false;
+
+ return true;
+}
+
+static bool
deallocate_vt (ply_terminal_t *terminal,
int vt_number)
{
@@ -752,7 +762,6 @@ deallocate_vt (ply_terminal_t *terminal,
return true;
}
-
bool
ply_terminal_activate_vt (ply_terminal_t *terminal)
{
@@ -815,6 +824,13 @@ ply_terminal_deactivate_vt (ply_terminal_t *terminal)
ply_trace ("Couldn't move console to initial vt: %m");
return false;
}
+
+ if (!wait_for_vt_to_become_active (terminal, terminal->initial_vt_number))
+ {
+ ply_trace ("Error while waiting for vt %d to become active: %m",
+ terminal->initial_vt_number);
+ return false;
+ }
}
else
{