summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-05-19 23:22:27 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-16 17:13:58 -0700
commit7e127f12a24acb8f43055af0a9be1ec585bbed36 (patch)
tree7972b6ac6c6393206cc853af86c02c3992aa09ec
parenta00dc6af6e84d0bee3f69d8df89d7f68cb535d35 (diff)
sun_init.c: Move vt switches to a switch_to helper function like lnx_init.c
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--hw/xfree86/os-support/solaris/sun_init.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 281a6df9f..d8c897d43 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -63,6 +63,22 @@ static char consoleDev[PATH_MAX] = "/dev/fb";
Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */
_X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb";
+static void
+switch_to(int vt, const char *from)
+{
+ int ret;
+
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
+ if (ret != 0)
+ xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n",
+ from, strerror(errno));
+
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
+ if (ret != 0)
+ xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n",
+ from, strerror(errno));
+}
+
void
xf86OpenConsole(void)
{
@@ -206,11 +222,7 @@ OPENCONSOLE:
/*
* Now get the VT
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ switch_to(xf86Info.vtno, "xf86OpenConsole");
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
@@ -254,11 +266,7 @@ OPENCONSOLE:
/*
* Now re-get the VT
*/
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
-
- if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
+ switch_to(xf86Info.vtno, "xf86OpenConsole");
#ifdef VT_SET_CONSUSER /* added in snv_139 */
if (strcmp(display, "0") == 0)
@@ -347,7 +355,7 @@ xf86CloseConsole(void)
}
/* Activate the VT that X was started on */
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT);
+ switch_to(xf86StartVT, "xf86CloseConsole");
}
#endif /* HAS_USL_VTS */