uterm: vt: make real_activate() behave like real_deactivate()

real_activate() has alsmost the same semantics as real_deactivate() so we
should also return -EINPROGRESS when we scheduled the VT switch. This
isn't used by kmscon currently, but may be used by other uterm users.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-10-01 13:23:38 +02:00
parent 79692f655a
commit 2c6a34deb9

View File

@ -319,14 +319,28 @@ static void real_close(struct uterm_vt *vt)
vt->real_saved_num = -1;
}
/* Switch to this VT and make it the active VT. */
/* Switch to this VT and make it the active VT. If we are already the active
* VT, then 0 is returned, if the VT_ACTIVATE ioctl is called to activate this
* VT, then -EINPROGRESS is returned and we will be activated when receiving the
* VT switch signal. The currently active VT may prevent this, though.
* On error a negative error code is returned other than -EINPROGRESS */
static int real_activate(struct uterm_vt *vt)
{
int ret;
struct vt_stat vts;
if (vt->real_num < 0)
return -EINVAL;
ret = ioctl(vt->real_fd, VT_GETSTATE, &vts);
if (ret) {
log_warn("cannot find current VT");
return -EFAULT;
}
if (vts.v_active != vt->real_num)
return 0;
ret = ioctl(vt->real_fd, VT_ACTIVATE, vt->real_num);
if (ret) {
log_warn("cannot enter VT %p", vt);
@ -334,7 +348,7 @@ static int real_activate(struct uterm_vt *vt)
}
log_debug("entering VT %p on demand", vt);
return 0;
return -EINPROGRESS;
}
/*