diff options
author | Michael Biebl <biebl@debian.org> | 2010-09-20 03:20:28 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2010-09-20 03:20:28 +0200 |
commit | 7d83738affd17f70d23b9b8836dddb81880c5f68 (patch) | |
tree | c6ca925fd9c6305a641d1bbce9aaed495aa73ed5 | |
parent | 02bc0ad0d52963fb282314758defef4b4b742684 (diff) | |
download | consolekit-7d83738affd17f70d23b9b8836dddb81880c5f68.tar.gz |
debian/patches/01-fallback_no_vt_waitevent.patch
* debian/patches/01-fallback_no_vt_waitevent.patch
- Add runtime check for VT_WAITEVENT and fallback to old behaviour of
creating a thread for every possible VT.
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/patches/01-fallback_no_vt_waitevent.patch | 137 | ||||
-rw-r--r-- | debian/patches/series | 1 |
3 files changed, 141 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 0e574ae..501c0ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,9 @@ consolekit (0.4.2-1) UNRELEASED; urgency=low - debian/patches/02-dont_take_bus_name_until_ready.patch - debian/patches/04-dont_fail_with_invalid_seats_file.patch * Refresh patches. + * debian/patches/01-fallback_no_vt_waitevent.patch + - Add runtime check for VT_WAITEVENT and fallback to old behaviour of + creating a thread for every possible VT. -- Michael Biebl <biebl@debian.org> Mon, 20 Sep 2010 02:35:46 +0200 diff --git a/debian/patches/01-fallback_no_vt_waitevent.patch b/debian/patches/01-fallback_no_vt_waitevent.patch new file mode 100644 index 0000000..f88eb69 --- /dev/null +++ b/debian/patches/01-fallback_no_vt_waitevent.patch @@ -0,0 +1,137 @@ +commit 24dc214f55e7c7c17d888d0ccf94cd3625767462 +Author: Michael Biebl <biebl@debian.org> +Date: Mon Sep 20 00:45:16 2010 +0200 + + linux: Check for VT_WAITEVENT ioctl during runtime + + Since 2782cc8d4950effbc4407455e72bd4750cef6e11 ConsoleKit fails, if it + has been compiled on a linux kernel >= 2.6.32 but is run with an older + kernel. Check for VT_WAITEVENT ioctl during runtime and fallback to the + old behaviour of creating a thread for every possible vt. + +diff --git a/src/ck-vt-monitor.c b/src/ck-vt-monitor.c +index 369c63e..9310341 100644 +--- a/src/ck-vt-monitor.c ++++ b/src/ck-vt-monitor.c +@@ -27,6 +27,7 @@ + #include <string.h> + #include <errno.h> + #include <signal.h> ++#include <sys/ioctl.h> + + #include <glib.h> + #include <glib/gi18n.h> +@@ -311,6 +312,34 @@ schedule_process_queue (CkVtMonitor *vt_monitor) + G_UNLOCK (schedule_lock); + } + ++#ifdef VT_WAITEVENT ++static gboolean ++vt_waitevent_supported (int fd) ++{ ++ static int supported = -1; ++ int res; ++ ++ if (supported >= 0) ++ return supported; ++ ++ res = ioctl(fd, VT_WAITEVENT, NULL); ++ ++ if (res == ERROR) { ++ if (errno == EINVAL) { ++ g_debug ("VT_WAITEVENT not supported on this system"); ++ supported = FALSE; ++ return FALSE; ++ } else if (errno == EFAULT) { ++ g_debug ("VT_WAITEVENT supported on this system"); ++ supported = TRUE; ++ return TRUE; ++ } ++ } ++ g_debug ("Unexpected result for VT_WAITEVENT check, returning FALSE"); ++ return FALSE; ++} ++#endif ++ + static void * + vt_thread_start (ThreadData *data) + { +@@ -322,6 +351,9 @@ vt_thread_start (ThreadData *data) + num = data->num; + + #ifdef VT_WAITEVENT ++ if (!vt_waitevent_supported(vt_monitor->priv->vfd)) ++ goto no_waitevent; ++ + for (;;) { + res = ck_wait_for_console_switch (vt_monitor->priv->vfd, &num); + if (! res) { +@@ -340,7 +372,10 @@ vt_thread_start (ThreadData *data) + schedule_process_queue (vt_monitor); + } + } +-#else ++ goto out; ++#endif ++ ++no_waitevent: + res = ck_wait_for_active_console_num (vt_monitor->priv->vfd, num); + if (! res) { + /* FIXME: what do we do if it fails? */ +@@ -357,8 +392,8 @@ vt_thread_start (ThreadData *data) + /* schedule processing of queue */ + schedule_process_queue (vt_monitor); + } +-#endif + ++out: + G_LOCK (hash_lock); + if (vt_monitor->priv->vt_thread_hash != NULL) { + g_hash_table_remove (vt_monitor->priv->vt_thread_hash, GUINT_TO_POINTER (num)); +@@ -418,19 +453,24 @@ vt_add_watches (CkVtMonitor *vt_monitor) + sigaction (SIGPOLL, &act, NULL); + + ioctl (vt_monitor->priv->vfd, I_SETSIG, S_MSG); +-#elif defined (VT_WAITEVENT) ++#else ++ guint max_consoles; ++ int i; ++ gint32 current_num; + gpointer id; + ++#if defined (VT_WAITEVENT) ++ if (!vt_waitevent_supported(vt_monitor->priv->vfd)) ++ goto no_waitevent; ++ + G_LOCK (hash_lock); + id = GINT_TO_POINTER (1); + if (g_hash_table_lookup (vt_monitor->priv->vt_thread_hash, id) == NULL) + vt_add_watch_unlocked (vt_monitor, 1); +- G_UNLOCK (hash_lock); +-#else +- guint max_consoles; +- int i; +- gint32 current_num; ++ goto out; ++#endif + ++no_waitevent: + G_LOCK (hash_lock); + + current_num = vt_monitor->priv->active_num; +@@ -442,7 +482,6 @@ vt_add_watches (CkVtMonitor *vt_monitor) + } + + for (i = 1; i < max_consoles; i++) { +- gpointer id; + + /* don't wait on the active vc */ + if (i == current_num) { +@@ -457,6 +496,7 @@ vt_add_watches (CkVtMonitor *vt_monitor) + } + } + ++out: + G_UNLOCK (hash_lock); + #endif + } diff --git a/debian/patches/series b/debian/patches/series index b2c2b9a..787feab 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,5 @@ # Debian patches for consolekit +01-fallback_no_vt_waitevent.patch 03-cleanup_console_tags.patch 80-gnukfreebsd_support_configure.ac.patch 82-hurd_support.patch |