[SCM] KDE Base Workspace module packaging branch, squeeze, updated. debian/4.4.5-4-4-g7071f60

Modestas Vainius modax at alioth.debian.org
Sat Nov 27 20:36:59 UTC 2010


The following commit has been merged in the squeeze branch:
commit c61408851d967a8600e56ab0eb626a261124b80a
Author: Modestas Vainius <modax at debian.org>
Date:   Sat Nov 27 13:52:53 2010 +0200

    Fix a couple of bugs in the kdm kfbsd patch.
    
    * When enumerating TTYs from kern.ttys sysctl, name sure they actually refer to
      VTs.
    * /dev/ttyv device names are in hex on fbsd, adjust code accordingly.
---
 .../patches/31_kdm_vt_switching_on_kfreebsd.diff   |   30 ++++++++++++++------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/debian/patches/31_kdm_vt_switching_on_kfreebsd.diff b/debian/patches/31_kdm_vt_switching_on_kfreebsd.diff
index b7904bd..74b9da2 100644
--- a/debian/patches/31_kdm_vt_switching_on_kfreebsd.diff
+++ b/debian/patches/31_kdm_vt_switching_on_kfreebsd.diff
@@ -31,8 +31,8 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  TTYtoVT( const char *tty )
  {
 -	return memcmp( tty, "tty", 3 ) ? 0 : atoi( tty + 3 );
-+	if (!memcmp( tty, "ttyv", 4 )) // FreeBSD
-+		return atoi( tty + 4 );
++	if (!memcmp( tty, "ttyv", 4 )) // FreeBSD, tty no is in hex
++		return (int) strtoul( tty+4, NULL, 16 );
 +	else if (!memcmp( tty, "tty", 3 )) // Linux
 +		return atoi( tty + 3 );
 +	else
@@ -67,7 +67,7 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  							close( con );
  						}
  					}
-@@ -1327,16 +1346,29 @@ static int activeVTs;
+@@ -1327,16 +1346,41 @@ static int activeVTs;
  static int
  getBusyVTs( void )
  {
@@ -87,13 +87,25 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  		activeVTs = vtstat.v_state;
 +#elif defined(__FreeBSD_kernel__)
 +		struct xtty *ttys;
-+		size_t s, i;
++		size_t s, i, firstvt;
++		struct stat st;
++
 +		activeVTs = 0;
++		firstvt = ~0;
++		// We need rdev of the first tty
++		if (stat("/dev/ttyv0", &st))
++			firstvt = 0; // If stat fails, 0 should be safe default
++
 +		if (!sysctlbyname("kern.ttys", NULL, &s, NULL, 0)) {
 +			ttys = (struct xtty *) malloc(s);
 +			sysctlbyname("kern.ttys", ttys, &s, NULL, 0);
-+			for (i = 0; i < s / sizeof(struct xtty); i++) {
-+				activeVTs |= !!(ttys[i].xt_flags & TF_OPENED) << i;
++			for (i = 0; (i < s / sizeof(struct xtty)) &&
++				    (i < sizeof(activeVTs) * 8); i++)
++			{
++				if (firstvt == ~0 && st.st_rdev == ttys[i].xt_dev)
++					firstvt = i;
++				if (i >= firstvt)
++					activeVTs |= !!(ttys[i].xt_flags & TF_OPENED) << (i - firstvt);
 +			}
 +		}
 +#endif
@@ -120,7 +132,7 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
 +# if defined(__linux__)
  		sprintf( ckDeviceBuf, "/dev/tty%d", td->serverVT );
 +# elif defined(__FreeBSD_kernel__)
-+		sprintf( ckDeviceBuf, "/dev/ttyv%d", td->serverVT );
++		sprintf( ckDeviceBuf, "/dev/ttyv%x", td->serverVT );
 +# endif
  # endif
  	isLocal = ((td->displayType & d_location) == dLocal);
@@ -133,7 +145,7 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  	if (!ce->active) { /* there is only the Global one */
 -#ifdef __linux__ /* XXX actually, sysvinit */
 +/* XXX actually, sysvinit */
-+#if defined(__linux__) || defined(__FreeBSD_kernel__) 
++#if defined(__linux__) || defined(__FreeBSD_kernel__)
  		getInitTab();
  		ASPrintf( (char **)&ce->value, "-%d", maxTTY + 1 );
  		ce->active = ce->written = True;
@@ -143,7 +155,7 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  	if (!ce->active) { /* there is only the Global one */
 -#ifdef __linux__ /* XXX actually, sysvinit */
 +/* XXX actually, sysvinit */
-+#if defined(__linux__) || defined(__FreeBSD_kernel__) 
++#if defined(__linux__) || defined(__FreeBSD_kernel__)
  		char *buf;
  		int i;
  

-- 
KDE Base Workspace module packaging



More information about the pkg-kde-commits mailing list