pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/consolekit Improve active console detection.
details: https://anonhg.NetBSD.org/pkgsrc/rev/f184d041a552
branches: trunk
changeset: 550523:f184d041a552
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Sun Nov 23 19:24:21 2008 +0000
description:
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:
sysutils/consolekit/Makefile | 4 +-
sysutils/consolekit/distinfo | 4 +-
sysutils/consolekit/files/ck-sysdeps-netbsd.c | 46 +++++---------------------
sysutils/consolekit/patches/patch-ae | 25 +++++++++++--
4 files changed, 34 insertions(+), 45 deletions(-)
diffs (180 lines):
diff -r ff1202e6d638 -r f184d041a552 sysutils/consolekit/Makefile
--- a/sysutils/consolekit/Makefile Sun Nov 23 18:41:16 2008 +0000
+++ b/sysutils/consolekit/Makefile Sun Nov 23 19:24:21 2008 +0000
@@ -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 -r ff1202e6d638 -r f184d041a552 sysutils/consolekit/distinfo
--- a/sysutils/consolekit/distinfo Sun Nov 23 18:41:16 2008 +0000
+++ b/sysutils/consolekit/distinfo Sun Nov 23 19:24:21 2008 +0000
@@ -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-ab) = 2e9fe9de1f27c635a4eefa77af8322cb8a02ab35
SHA1 (patch-ac) = 0595a9cd1c4013eb4761e044b4b4b01b613f7d2b
SHA1 (patch-ad) = a1c1a1d0452945550065da3eac2390318c1eb7be
-SHA1 (patch-ae) = 231ff806d2ce5e8dfb4d3b25fff4820c313c8caa
+SHA1 (patch-ae) = c3109e124f36da52cd04091bee00be6a5716d98a
diff -r ff1202e6d638 -r f184d041a552 sysutils/consolekit/files/ck-sysdeps-netbsd.c
--- a/sysutils/consolekit/files/ck-sysdeps-netbsd.c Sun Nov 23 18:41:16 2008 +0000
+++ b/sysutils/consolekit/files/ck-sysdeps-netbsd.c Sun Nov 23 19:24:21 2008 +0000
@@ -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 @@
}
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 @@
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;
+ /* XXXJDM how can we find out how many are configured? */
+ if (num != NULL) {
+ *num = 8;
}
- 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:
- if (num != NULL) {
- *num = max_consoles;
- }
-
- return ret;
+ return TRUE;
}
char *
@@ -375,7 +349,7 @@
/* 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 @@
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 @@
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 -r ff1202e6d638 -r f184d041a552 sysutils/consolekit/patches/patch-ae
--- a/sysutils/consolekit/patches/patch-ae Sun Nov 23 18:41:16 2008 +0000
+++ b/sysutils/consolekit/patches/patch-ae Sun Nov 23 19:24:21 2008 +0000
@@ -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 @@
/* 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 @@
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 @@
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 @@
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) {
Home |
Main Index |
Thread Index |
Old Index