[SCM] KDE Base Workspace module packaging branch, master, updated. debian/4.6.3-1-3-gc1fb838

Modestas Vainius modax at alioth.debian.org
Sun Jun 5 10:18:12 UTC 2011


The following commit has been merged in the master branch:
commit c1fb838051e782bd2ed3f56add24545718663b88
Author: Modestas Vainius <modax at debian.org>
Date:   Sun Jun 5 13:17:58 2011 +0300

    Adapt kdm_vt_switching_on_kfreebsd.diff patch to upstream changes.
    
    ... and reenable the patch.
---
 debian/changelog                                 |    2 +
 debian/patches/kdm_vt_switching_on_kfreebsd.diff |  285 +++++++++++-----------
 debian/patches/series                            |    1 +
 3 files changed, 145 insertions(+), 143 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 236e4cc..2b31e3f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ kdebase-workspace (4:4.6.3-2) UNRELEASED; urgency=low
 
   * Backport a patch from 4.7 in order to fix some problems with multihead in
     kwin (patch backport_kwin_multihead_improvements.diff).
+  * Adapt kdm_vt_switching_on_kfreebsd.diff patch to upstream changes in 4.6
+    and reenable the patch.
 
  -- Modestas Vainius <modax at debian.org>  Fri, 03 Jun 2011 01:11:58 +0300
 
diff --git a/debian/patches/kdm_vt_switching_on_kfreebsd.diff b/debian/patches/kdm_vt_switching_on_kfreebsd.diff
index d509362..62c6448 100644
--- a/debian/patches/kdm_vt_switching_on_kfreebsd.diff
+++ b/debian/patches/kdm_vt_switching_on_kfreebsd.diff
@@ -2,7 +2,7 @@ From: Modestas Vainius <modax at debian.org>
 Subject: implement VT switching and status detection support in KDM on kFreeBSD
 Forwarded: no
 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586540
-Last-Update: 2010-10-24
+Last-Update: 2011-06-05
 
 This patch implements proper VT switching for KDM on kFreeBSD. It also includes
 detection of the next available VT which should prevent KDM from taking over
@@ -12,7 +12,7 @@ This revision of the patch is pretty hackish. What is more, it does not cover
 FreeBSD (only kFreeBSD) while it could perfectly do so.
 --- a/kdm/backend/dm.c
 +++ b/kdm/backend/dm.c
-@@ -48,7 +48,13 @@ from the copyright holder.
+@@ -47,7 +47,13 @@ from the copyright holder.
  
  #ifdef HAVE_VTS
  # include <sys/ioctl.h>
@@ -25,92 +25,92 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
 +#endif
  #endif
  
- static void sigHandler( int n );
-@@ -329,7 +335,12 @@ main( int argc, char **argv )
+ static void sigHandler(int n);
+@@ -328,7 +334,12 @@ main(int argc, char **argv)
  int
- TTYtoVT( const char *tty )
+ TTYtoVT(const char *tty)
  {
--	return memcmp( tty, "tty", 3 ) ? 0 : atoi( tty + 3 );
-+	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
-+		return 0;
+-    return memcmp(tty, "tty", 3) ? 0 : atoi(tty + 3);
++    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
++        return 0;
  }
  
  int
-@@ -1036,9 +1047,15 @@ reapChildren( void )
- 					} else {
- 						int con = open( "/dev/console", O_RDONLY );
- 						if (con >= 0) {
-+							int activevt;
+@@ -1030,9 +1041,15 @@ reapChildren(void)
+                     } else {
+                         int con = open("/dev/console", O_RDONLY);
+                         if (con >= 0) {
++                            int activevt;
 +#if defined(__linux__)
- 							struct vt_stat vtstat;
- 							ioctl( con, VT_GETSTATE, &vtstat );
--							if (vtstat.v_active == d->serverVT) {
-+							activevt = vtstat.v_active;
+                             struct vt_stat vtstat;
+                             ioctl(con, VT_GETSTATE, &vtstat);
+-                            if (vtstat.v_active == d->serverVT) {
++                            activevt = vtstat.v_active;
 +#elif defined(__FreeBSD_kernel__)
-+							ioctl( con, VT_GETACTIVE, &activevt);
++                            ioctl(con, VT_GETACTIVE, &activevt);
 +#endif
-+							if (activevt == d->serverVT) {
- 								int vt = 1;
- 								struct display *di;
- 								for (di = displays; di; di = di->next)
-@@ -1051,7 +1068,9 @@ reapChildren( void )
- 										vt = di->serverVT;
- 								ioctl( con, VT_ACTIVATE, vt );
- 							}
++                            if (activevt == d->serverVT) {
+                                 int vt = 1;
+                                 struct display *di;
+                                 for (di = displays; di; di = di->next)
+@@ -1045,7 +1062,9 @@ reapChildren(void)
+                                         vt = di->serverVT;
+                                 ioctl(con, VT_ACTIVATE, vt);
+                             }
 +#ifdef __linux__
- 							ioctl( con, VT_DISALLOCATE, d->serverVT );
+                             ioctl(con, VT_DISALLOCATE, d->serverVT);
 +#endif
- 							close( con );
- 						}
- 					}
-@@ -1327,16 +1346,41 @@ static int activeVTs;
+                             close(con);
+                         }
+                     }
+@@ -1318,16 +1337,41 @@ static int activeVTs;
  static int
- getBusyVTs( void )
+ getBusyVTs(void)
  {
--	struct vt_stat vtstat;
--	int con;
+-    struct vt_stat vtstat;
+-    int con;
 -
- 	if (activeVTs == -1) {
+     if (activeVTs == -1) {
 +#if defined(__linux__)
-+		struct vt_stat vtstat;
-+		int con;
++        struct vt_stat vtstat;
++        int con;
 +
- 		vtstat.v_state = 0;
- 		if ((con = open( "/dev/console", O_RDONLY )) >= 0) {
- 			ioctl( con, VT_GETSTATE, &vtstat );
- 			close( con );
- 		}
- 		activeVTs = vtstat.v_state;
+         vtstat.v_state = 0;
+         if ((con = open("/dev/console", O_RDONLY)) >= 0) {
+             ioctl(con, VT_GETSTATE, &vtstat);
+             close(con);
+         }
+         activeVTs = vtstat.v_state;
 +#elif defined(__FreeBSD_kernel__)
-+		struct xtty *ttys;
-+		size_t s, i, firstvt;
-+		struct stat st;
++        struct xtty *ttys;
++        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 */
++        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 < 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);
-+			}
-+		}
++        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 < 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
- 	}
- 	return activeVTs;
+     }
+     return activeVTs;
  }
 --- a/kdm/backend/greet.h
 +++ b/kdm/backend/greet.h
@@ -125,63 +125,63 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
  #endif
 --- a/kdm/backend/client.c
 +++ b/kdm/backend/client.c
-@@ -1301,7 +1301,11 @@ startClient( volatile int *pid )
- 	
+@@ -1339,7 +1339,11 @@ startClient(volatile int *pid)
+     
  # ifdef HAVE_VTS
- 	if (td->serverVT > 0)
+     if (td->serverVT > 0)
 +# if defined(__linux__)
- 		sprintf( ckDeviceBuf, "/dev/tty%d", td->serverVT );
+         sprintf(ckDeviceBuf, "/dev/tty%d", td->serverVT);
 +# elif defined(__FreeBSD_kernel__)
-+		sprintf( ckDeviceBuf, "/dev/ttyv%x", td->serverVT );
++        sprintf(ckDeviceBuf, "/dev/ttyv%x", td->serverVT);
 +# endif
  # endif
- 	isLocal = ((td->displayType & d_location) == dLocal);
+     isLocal = ((td->displayType & d_location) == dLocal);
  # ifdef XDMCP
 --- a/kdm/kfrontend/genkdmconf.c
 +++ b/kdm/kfrontend/genkdmconf.c
-@@ -1483,7 +1483,8 @@ static void
- upd_servervts( Entry *ce, Section *cs ATTR_UNUSED )
+@@ -1538,7 +1538,8 @@ static void
+ upd_servervts(Entry *ce, Section *cs ATTR_UNUSED)
  {
- 	if (!ce->active) { /* there is only the Global one */
+     if (!ce->active) { /* there is only the Global one */
 -#ifdef __linux__ /* XXX actually, sysvinit */
 +/* XXX actually, sysvinit */
 +#if defined(__linux__) || defined(__FreeBSD_kernel__)
- 		getInitTab();
- 		ASPrintf( (char **)&ce->value, "-%d", maxTTY + 1 );
- 		ce->active = ce->written = True;
-@@ -1495,14 +1496,19 @@ static void
- upd_consolettys( Entry *ce, Section *cs ATTR_UNUSED )
+         getInitTab();
+         ASPrintf((char **)&ce->value, "-%d", maxTTY + 1);
+         ce->active = ce->written = True;
+@@ -1550,14 +1551,19 @@ static void
+ upd_consolettys(Entry *ce, Section *cs ATTR_UNUSED)
  {
- 	if (!ce->active) { /* there is only the Global one */
+     if (!ce->active) { /* there is only the Global one */
 -#ifdef __linux__ /* XXX actually, sysvinit */
 +/* XXX actually, sysvinit */
 +#if defined(__linux__) || defined(__FreeBSD_kernel__)
- 		char *buf;
- 		int i;
+         char *buf;
+         int i;
  
- 		getInitTab();
- 		for (i = 0, buf = 0; i < 16; i++)
- 			if (TTYmask & (1 << i))
+         getInitTab();
+         for (i = 0, buf = 0; i < 16; i++)
+             if (TTYmask & (1 << i))
 +#if defined(__linux__)
- 				strCat( &buf, ",tty%d", i + 1 );
+                 strCat(&buf, ",tty%d", i + 1);
 +#elif defined(__FreeBSD_kernel__)
-+				strCat( &buf, ",ttyv%x", i );
++                strCat(&buf, ",ttyv%x", i);
 +#endif
- 		if (buf) {
- 			ce->value = buf + 1;
- 			ce->active = ce->written = True;
-@@ -3072,7 +3078,7 @@ int main( int argc, char **argv )
- 			}
- 		}
- 	}
+         if (buf) {
+             ce->value = buf + 1;
+             ce->active = ce->written = True;
+@@ -3190,7 +3196,7 @@ int main(int argc, char **argv)
+             }
+         }
+     }
 -#ifdef __linux__
 +#if defined(__linux__) || defined(__FreeBSD_kernel__)
- 	if (!stat( "/etc/debian_version", &st )) { /* debian */
- 		defminuid = "1000";
- 		defmaxuid = "29999";
+     if (!stat("/etc/debian_version", &st)) { /* debian */
+         defminuid = "1000";
+         defmaxuid = "29999";
 --- a/kdm/config.def
 +++ b/kdm/config.def
-@@ -870,7 +870,7 @@ Description:
+@@ -873,7 +873,7 @@ Description:
   This option is for operating systems (<acronym>OS</acronym>s) with support
   for virtual terminals (<acronym>VT</acronym>s), by both &kdm; and the
   <acronym>OS</acronym>s itself.
@@ -206,68 +206,67 @@ FreeBSD (only kFreeBSD) while it could perfectly do so.
 +#endif
 +
  void *
- Calloc( size_t nmemb, size_t size )
+ Calloc(size_t nmemb, size_t size)
  {
-@@ -621,6 +630,29 @@ hexToBinary( char *out, const char *in )
+@@ -623,6 +632,29 @@ hexToBinary(char *out, const char *in)
  
  #undef atox
  
 +#ifdef HAVE_VTS
 +/* Get next free VT. Works only on virtual terminal devices */
 +static int
-+getNextFreeVT( const char *tty )
++getNextFreeVT(const char *tty)
 +{
-+	int fd, vt;
-+	char *dev;
++    int fd, vt;
++    char *dev;
 +
-+	vt = -1;
-+	dev = (char*) Malloc( strlen(tty) + 6 );
-+	sprintf( dev, "/dev/%s", tty );
++    vt = -1;
++    dev = (char*) Malloc(strlen(tty) + 6);
++    sprintf(dev, "/dev/%s", tty);
 +
-+	fd = open( dev, O_RDONLY );
-+        if (fd >= 0) {
-+                if (ioctl( fd, VT_OPENQRY, &vt ))
-+			vt = -1;
-+		close( fd );
-+        }
-+	free( dev );
-+	return vt;
++    fd = open(dev, O_RDONLY);
++    if (fd >= 0) {
++        if (ioctl(fd, VT_OPENQRY, &vt))
++            vt = -1;
++        close(fd);
++    }
++    free(dev);
++    return vt;
 +}
 +#endif
 +
  /* X -from ip6-addr does not work here, so i don't know whether this is needed.
  #define IP6_MAGIC
  */
-@@ -640,6 +672,10 @@ listSessions( int flags, struct display
+@@ -642,6 +674,10 @@ listSessions(int flags, struct display *
  #else
- 	STRUCTUTMP *ut;
+     STRUCTUTMP *ut;
  #endif
 +#ifdef HAVE_VTS
-+	int con_fvt;
-+	con_fvt = -2;
++    int con_fvt;
++    con_fvt = -2;
 +#endif
  
- 	for (di = displays; di; di = di->next)
- 		if (((flags & lstRemote) || (di->displayType & d_location) == dLocal) &&
-@@ -671,12 +707,20 @@ listSessions( int flags, struct display
- 				if (!(flags & lstRemote))
- 					continue;
- 			} else {
-+				if (!*ut->ut_line)
-+					continue;
- 				/* hack around broken konsole which does not set ut_host. */
+     for (di = displays; di; di = di->next)
+         if (((flags & lstRemote) || (di->displayType & d_location) == dLocal) &&
+@@ -673,11 +709,19 @@ listSessions(int flags, struct display *
+                 if (!(flags & lstRemote))
+                     continue;
+             } else {
++                if (!*ut->ut_line)
++                    continue;
+                 /* hack around broken konsole which does not set ut_host. */
 +#ifdef HAVE_VTS
-+				if (con_fvt == -2)
-+					con_fvt = getNextFreeVT("console");
-+				if (con_fvt >= 0 && con_fvt != getNextFreeVT( ut->ut_line ))
-+					continue;
++                if (con_fvt == -2)
++                    con_fvt = getNextFreeVT("console");
++                if (con_fvt >= 0 && con_fvt != getNextFreeVT(ut->ut_line))
++                    continue;
 +#else
- 				/* this check is probably linux-specific. */
--				/* alternatively we could open the device and try VT_OPENQRY. */
- 				if (memcmp( ut->ut_line, "tty", 3 ) ||
- 				    !isdigit( ut->ut_line[3] ))
- 					continue;
+                 /* this check is probably linux-specific. */
+-                /* alternatively we could open the device and try VT_OPENQRY. */
+                 if (memcmp(ut->ut_line, "tty", 3) || !isdigit(ut->ut_line[3]))
+                     continue;
 +#endif
- 			}
- 			if (strNChrCnt( ut->ut_line, sizeof(ut->ut_line), ':' ))
- 				continue; /* x login */
+             }
+             if (strNChrCnt(ut->ut_line, sizeof(ut->ut_line), ':'))
+                 continue; /* x login */
diff --git a/debian/patches/series b/debian/patches/series
index e1bff26..57eeac4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,3 +17,4 @@ fix_target_link_libraries.diff
 enable_debianabimanager.diff
 initialize_variables_crashfix.diff
 enable_dlrestrcitions.diff
+kdm_vt_switching_on_kfreebsd.diff

-- 
KDE Base Workspace module packaging



More information about the pkg-kde-commits mailing list