summaryrefslogtreecommitdiff
path: root/sysutils/consolekit
diff options
context:
space:
mode:
authorjmcneill <jmcneill@pkgsrc.org>2008-11-23 19:24:21 +0000
committerjmcneill <jmcneill@pkgsrc.org>2008-11-23 19:24:21 +0000
commitb49a5be10474ca95cd3afac19e5850b4a9d9cd6b (patch)
treef589cb4cf179b38f941390c14843775f4e75acdf /sysutils/consolekit
parent3c76c93224395bc219c70ba56d6d9d608c2cc52d (diff)
downloadpkgsrc-b49a5be10474ca95cd3afac19e5850b4a9d9cd6b.tar.gz
Improve active console detection.
XXX ps doesn't associate X with its tty on NetBSD, add nasty hack of falling back to ttyE4 and revisit later.
Diffstat (limited to 'sysutils/consolekit')
-rw-r--r--sysutils/consolekit/Makefile4
-rw-r--r--sysutils/consolekit/distinfo4
-rw-r--r--sysutils/consolekit/files/ck-sysdeps-netbsd.c44
-rw-r--r--sysutils/consolekit/patches/patch-ae25
4 files changed, 33 insertions, 44 deletions
diff --git a/sysutils/consolekit/Makefile b/sysutils/consolekit/Makefile
index 03ae72fef71..d0f99f46176 100644
--- a/sysutils/consolekit/Makefile
+++ b/sysutils/consolekit/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
+# $NetBSD: Makefile,v 1.3 2008/11/23 19:24:21 jmcneill Exp $
#
CONSOLEKIT_VER= 0.3.0
DISTNAME= ConsoleKit-${CONSOLEKIT_VER}
PKGNAME= consolekit-${CONSOLEKIT_VER}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://people.freedesktop.org/~mccann/dist/
EXTRACT_SUFX= .tar.bz2
diff --git a/sysutils/consolekit/distinfo b/sysutils/consolekit/distinfo
index e9973ab586f..006f5ece302 100644
--- a/sysutils/consolekit/distinfo
+++ b/sysutils/consolekit/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
+$NetBSD: distinfo,v 1.3 2008/11/23 19:24:21 jmcneill Exp $
SHA1 (ConsoleKit-0.3.0.tar.bz2) = e3b6156622cc14ebca7382a55b8ed15f2f2bad98
RMD160 (ConsoleKit-0.3.0.tar.bz2) = 7a1ebd2f4bfb65690e70138c9923c3fd2fcaf671
@@ -7,4 +7,4 @@ SHA1 (patch-aa) = 859ccbad31b941b78d4fe9e65fa766c672a717f2
SHA1 (patch-ab) = 2e9fe9de1f27c635a4eefa77af8322cb8a02ab35
SHA1 (patch-ac) = 0595a9cd1c4013eb4761e044b4b4b01b613f7d2b
SHA1 (patch-ad) = a1c1a1d0452945550065da3eac2390318c1eb7be
-SHA1 (patch-ae) = 231ff806d2ce5e8dfb4d3b25fff4820c313c8caa
+SHA1 (patch-ae) = c3109e124f36da52cd04091bee00be6a5716d98a
diff --git a/sysutils/consolekit/files/ck-sysdeps-netbsd.c b/sysutils/consolekit/files/ck-sysdeps-netbsd.c
index ca95c0f6c65..c067548d332 100644
--- a/sysutils/consolekit/files/ck-sysdeps-netbsd.c
+++ b/sysutils/consolekit/files/ck-sysdeps-netbsd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ck-sysdeps-netbsd.c,v 1.2 2008/11/22 19:33:05 jmcneill Exp $ */
+/* $NetBSD: ck-sysdeps-netbsd.c,v 1.3 2008/11/23 19:24:21 jmcneill Exp $ */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
@@ -194,7 +194,8 @@ stat2proc (pid_t pid,
}
if (p.p_tdev == NODEV) {
- memcpy (P->tty_text, " ? ", sizeof P->tty_text);
+ /* XXXJDM nasty hack */
+ memcpy (P->tty_text, "/dev/ttyE4", sizeof P->tty_text);
}
if (P->pid != pid) {
@@ -332,39 +333,12 @@ ck_unix_pid_get_login_session_id (pid_t pid,
gboolean
ck_get_max_num_consoles (guint *num)
{
- int max_consoles;
- int res;
- gboolean ret;
- struct ttyent *t;
-
- ret = FALSE;
- max_consoles = 0;
-
- res = setttyent ();
- if (res == 0) {
- goto done;
- }
-
- while ((t = getttyent ()) != NULL) {
- if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
- max_consoles++;
- }
-
- /* Increment one more so that all consoles are properly counted
- * this is arguable a bug in vt_add_watches().
- */
- max_consoles++;
-
- ret = TRUE;
-
- endttyent ();
-
-done:
+ /* XXXJDM how can we find out how many are configured? */
if (num != NULL) {
- *num = max_consoles;
+ *num = 8;
}
- return ret;
+ return TRUE;
}
char *
@@ -375,7 +349,7 @@ ck_get_console_device_for_num (guint num)
/* The device number is always one less than the VT number. */
num--;
- device = g_strdup_printf ("/dev/ttyv%u", num);
+ device = g_strdup_printf ("/dev/ttyE%u", num);
return device;
}
@@ -394,7 +368,7 @@ ck_get_console_num_from_device (const char *device,
return FALSE;
}
- if (sscanf (device, "/dev/ttyv%u", &n) == 1) {
+ if (sscanf (device, "/dev/ttyE%u", &n) == 1) {
/* The VT number is always one more than the device number. */
n++;
ret = TRUE;
@@ -426,7 +400,7 @@ ck_get_active_console_num (int console_fd,
goto out;
}
- g_debug ("Active VT is: %d (ttyv%d)", active, active - 1);
+ g_debug ("Active VT is: %d (ttyE%d)", active, active - 1);
ret = TRUE;
out:
diff --git a/sysutils/consolekit/patches/patch-ae b/sysutils/consolekit/patches/patch-ae
index 38aca7f7d16..fe7dbbe2f8f 100644
--- a/sysutils/consolekit/patches/patch-ae
+++ b/sysutils/consolekit/patches/patch-ae
@@ -1,7 +1,7 @@
-$NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
+$NetBSD: patch-ae,v 1.3 2008/11/23 19:24:21 jmcneill Exp $
--- src/ck-sysdeps-unix.c.orig 2008-01-23 09:30:44.000000000 -0500
-+++ src/ck-sysdeps-unix.c
++++ src/ck-sysdeps-unix.c 2008-11-23 13:51:19.000000000 -0500
@@ -35,6 +35,11 @@
#include <linux/kd.h>
#endif
@@ -40,7 +40,7 @@ $NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
/* Adapted from dbus-sysdeps-unix.c:_dbus_read_credentials_socket() */
gboolean
ck_get_socket_peer_credentials (int socket_fd,
-@@ -99,7 +123,16 @@ ck_get_socket_peer_credentials (int
+@@ -99,7 +123,16 @@
if (ucred != NULL) {
ucred_free (ucred);
}
@@ -58,7 +58,7 @@ $NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
g_warning ("Socket credentials not supported on this OS\n");
#endif
-@@ -126,7 +159,7 @@ ck_get_socket_peer_credentials (int
+@@ -126,7 +159,7 @@
gboolean
ck_fd_is_a_console (int fd)
{
@@ -67,7 +67,7 @@ $NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
struct vt_stat vts;
#elif defined(__FreeBSD__)
int vers;
-@@ -134,7 +167,7 @@ ck_fd_is_a_console (int fd)
+@@ -134,7 +167,7 @@
int kb_ok;
errno = 0;
@@ -76,3 +76,18 @@ $NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
kb_ok = (ioctl (fd, VT_GETSTATE, &vts) == 0);
#elif defined(__FreeBSD__)
kb_ok = (ioctl (fd, CONS_GETVERS, &vers) == 0);
+@@ -184,6 +217,14 @@
+ }
+ #endif
+
++#ifdef __NetBSD__
++ /* On NetBSD, first try wsdisplay device. */
++ fd = open_a_console ("/dev/ttyE0");
++ if (fd >= 0) {
++ goto done;
++ }
++#endif
++
+ #ifdef _PATH_TTY
+ fd = open_a_console (_PATH_TTY);
+ if (fd >= 0) {