summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHalton Huo <halton.huo@sun.com>2010-01-15 14:06:32 +0800
committerHalton Huo <halton.huo@sun.com>2010-04-19 16:07:11 +0800
commitb2e65a0ab7f4c417c85433e3e9bf97befbe6da3b (patch)
tree11f825e73fc96e9e651b14935601d5d203506a31 /src
parente7f3952632f077ff647e303bd08950085c293297 (diff)
Enhancement CanActivateSessions for OpenSolaris.
VT switching is always enabled on Linux, but for OpenSolaris VT switching can be truned of by 'svcadm disable vtdaemon'. So we should also check whether the service vtdaemon is online on OpenSolaris. https://bugs.freedesktop.org/show_bug.cgi?id=26055
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/ck-seat.c26
2 files changed, 26 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6ab05c8..4788fe1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -139,6 +139,7 @@ console_kit_daemon_LDADD = \
$(CONSOLE_KIT_LIBS) \
$(POLKIT_LIBS) \
$(RBAC_LIBS) \
+ $(SCF_LIBS) \
libck.la \
libck-event-log.la \
$(NULL)
diff --git a/src/ck-seat.c b/src/ck-seat.c
index af7db59..b2e5628 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -25,6 +25,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
+#ifdef HAVE_SCF
+#include <libscf.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
@@ -661,6 +664,26 @@ ck_seat_add_session (CkSeat *seat,
return TRUE;
}
+is_VT_enabled ()
+{
+#ifdef HAVE_SYS_VT_H
+ char *state = NULL;
+ gboolean vt_enabled;
+
+ state = smf_get_state ("svc:/system/vtdaemon:default");
+ if (state && g_str_equal (state, SCF_STATE_STRING_ONLINE)) {
+ vt_enabled = TRUE;
+ } else {
+ vt_enabled = FALSE;
+ }
+
+ g_free (state);
+ return vt_enabled;
+#else
+ return FALSE;
+#endif /* HAVE_SYS_VT_H */
+}
+
gboolean
ck_seat_can_activate_sessions (CkSeat *seat,
gboolean *can_activate,
@@ -669,7 +692,8 @@ ck_seat_can_activate_sessions (CkSeat *seat,
g_return_val_if_fail (CK_IS_SEAT (seat), FALSE);
if (can_activate != NULL) {
- *can_activate = (seat->priv->kind == CK_SEAT_KIND_STATIC);
+ *can_activate = (seat->priv->kind == CK_SEAT_KIND_STATIC)
+ && is_VT_enabled ();
}
return TRUE;