1 From c2e317911f2fae424ec9a121f267e4a83efcf1c5 Mon Sep 17 00:00:00 2001
2 From: Halton Huo <halton.huo@sun.com>
3 Date: Wed, 19 May 2010 12:46:25 +0800
4 Subject: [PATCH] Enhancement CanActivateSessions for OpenSolaris.
6 VT switching is always enabled on Linux, but for OpenSolaris VT switching
7 can be truned of by 'svcadm disable vtdaemon'. So we should also check
8 whether the service vtdaemon is online on OpenSolaris.
10 https://bugs.freedesktop.org/show_bug.cgi?id=26055
13 src/ck-sysdeps-freebsd.c | 6 ++++++
14 src/ck-sysdeps-linux.c | 6 ++++++
15 src/ck-sysdeps-solaris.c | 18 ++++++++++++++++++
16 src/ck-sysdeps.h | 1 +
17 5 files changed, 32 insertions(+), 0 deletions(-)
19 diff --git a/src/Makefile.am b/src/Makefile.am
20 index 6ab05c8..869decd 100644
23 @@ -49,6 +49,7 @@ if CK_COMPILE_SOLARIS
25 ck-sysdeps-solaris.c \
27 +libck_la_LIBADD = -lscf
31 diff --git a/src/ck-sysdeps-freebsd.c b/src/ck-sysdeps-freebsd.c
32 index a30c380..df2b0f4 100644
33 --- a/src/ck-sysdeps-freebsd.c
34 +++ b/src/ck-sysdeps-freebsd.c
35 @@ -361,6 +361,12 @@ done:
40 +ck_supports_activatable_consoles (void)
46 ck_get_console_device_for_num (guint num)
48 diff --git a/src/ck-sysdeps-linux.c b/src/ck-sysdeps-linux.c
49 index 09db310..a95272e 100644
50 --- a/src/ck-sysdeps-linux.c
51 +++ b/src/ck-sysdeps-linux.c
52 @@ -693,6 +693,12 @@ ck_get_max_num_consoles (guint *num)
57 +ck_supports_activatable_consoles (void)
63 ck_get_console_device_for_num (guint num)
65 diff --git a/src/ck-sysdeps-solaris.c b/src/ck-sysdeps-solaris.c
66 index 335ab8b..bb37e1e 100644
67 --- a/src/ck-sysdeps-solaris.c
68 +++ b/src/ck-sysdeps-solaris.c
75 #define DEV_ENCODE(M,m) ( \
76 ( (M&0xfff) << 8) | ( (m&0xfff00) << 12) | (m&0xff) \
77 @@ -419,6 +420,23 @@ ck_get_max_num_consoles (guint *num)
82 +ck_supports_activatable_consoles (void)
85 + gboolean vt_enabled;
87 + state = smf_get_state ("svc:/system/vtdaemon:default");
88 + if (state && g_str_equal (state, SCF_STATE_STRING_ONLINE)) {
99 ck_get_console_device_for_num (guint num)
101 diff --git a/src/ck-sysdeps.h b/src/ck-sysdeps.h
102 index c3f3756..8f22d52 100644
103 --- a/src/ck-sysdeps.h
104 +++ b/src/ck-sysdeps.h
105 @@ -61,6 +61,7 @@ gboolean ck_fd_is_a_console (int fd);
106 gboolean ck_is_root_user (void);
108 gboolean ck_get_max_num_consoles (guint *num);
109 +gboolean ck_supports_activatable_consoles (void);
111 char * ck_get_console_device_for_num (guint num);
112 gboolean ck_get_console_num_from_device (const char *device,
116 --- ConsoleKit-0.4.1/src/ck-seat.c-orig 2011-02-07 22:09:46.085393510 -0600
117 +++ ConsoleKit-0.4.1/src/ck-seat.c 2011-02-07 22:10:58.766029875 -0600
118 @@ -1172,6 +1172,10 @@ ck_seat_can_activate_sessions (CkSeat
120 g_return_val_if_fail (CK_IS_SEAT (seat), FALSE);
122 + if (ck_supports_activatable_consoles () == FALSE) {
126 if (can_activate != NULL) {
127 *can_activate = (seat->priv->kind == CK_SEAT_KIND_STATIC);