Author: arekm                        Date: Sun Jun 14 02:41:18 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel .3; VT_WAITACTIVE can hang, so don't use it

---- Files affected:
packages/suspend:
   suspend.spec (1.63 -> 1.64) , suspend-neverhang.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/suspend/suspend.spec
diff -u packages/suspend/suspend.spec:1.63 packages/suspend/suspend.spec:1.64
--- packages/suspend/suspend.spec:1.63  Mon Apr  6 16:49:31 2009
+++ packages/suspend/suspend.spec       Sun Jun 14 04:41:12 2009
@@ -16,7 +16,7 @@
 Summary(pl.UTF-8):     Zamrażanie w RAM/Dysku/Jedno i drugie
 Name:          suspend
 Version:       0.8
-Release:       0.%{snap}.2
+Release:       0.%{snap}.3
 License:       GPL v2
 Group:         Applications/System
 # cvs -z3 -d:pserver:[email protected]:/cvsroot/suspend co suspend
@@ -25,6 +25,7 @@
 Patch0:                %{name}-sys-file-range-write.patch
 Patch1:                %{name}-fadvise.patch
 Patch2:                %{name}-diet.patch
+Patch3:                %{name}-neverhang.patch
 URL:           http://sourceforge.net/projects/suspend
 BuildRequires: autoconf
 BuildRequires: automake
@@ -84,6 +85,7 @@
 %patch0 -p1
 %patch1 -p2
 %patch2 -p1
+%patch3 -p1
 
 cat >syscalltest.c <<EOF
 #include <stdio.h>
@@ -171,6 +173,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.64  2009/06/14 02:41:12  arekm
+- rel .3; VT_WAITACTIVE can hang, so don't use it
+
 Revision 1.63  2009/04/06 14:49:31  baggins
 - rel 2
 - added initrd package (built with dietlibc by default)

================================================================
Index: packages/suspend/suspend-neverhang.patch
diff -u /dev/null packages/suspend/suspend-neverhang.patch:1.1
--- /dev/null   Sun Jun 14 04:41:18 2009
+++ packages/suspend/suspend-neverhang.patch    Sun Jun 14 04:41:12 2009
@@ -0,0 +1,79 @@
+diff -urN suspend/s2ram-main.c suspend.new/s2ram-main.c
+--- suspend/s2ram-main.c       2007-12-19 16:35:13.000000000 +0100
++++ suspend.new/s2ram-main.c   2009-06-14 04:36:10.797977387 +0200
+@@ -86,8 +86,12 @@
+ 
+       /* switch to console 1 first, since we might be in X */
+       active_console = fgconsole();
+-      printf("Switching from vt%d to vt1\n", active_console);
+-      chvt(1);
++      printf("Switching from vt%d to vt1", active_console);
++      if (chvt(1))
++              printf("... succeeded\n");
++      else
++              printf("... failed\n");
++
+ 
+       ret = s2ram_hacks();
+       if (ret)
+@@ -98,8 +102,11 @@
+  out:
+       /* if we switched consoles before suspend, switch back */
+       if (active_console > 0) {
+-              printf("switching back to vt%d\n", active_console);
+-              chvt(active_console);
++              printf("switching back to vt%d", active_console);
++              if (chvt(active_console))
++                      printf("... succeeded\n");
++              else
++                      printf("... failed\n");
+       }
+ 
+       return ret;
+Pliki suspend/syscalltest i suspend.new/syscalltest różnią się
+diff -urN suspend/vt.c suspend.new/vt.c
+--- suspend/vt.c       2007-09-13 21:38:10.000000000 +0200
++++ suspend.new/vt.c   2009-06-14 04:34:11.231322284 +0200
+@@ -85,15 +85,24 @@
+       return vtstat.v_active;
+ }
+ 
+-void chvt(int num)
++int chvt(int num)
+ {
+-      int fd = getconsolefd();
+-      if (ioctl(fd, VT_ACTIVATE, num)) {
+-              perror("chvt: VT_ACTIVATE");
+-      }
+-      if (ioctl(fd, VT_WAITACTIVE, num)) {
+-              perror("VT_WAITACTIVE");
++#define       USER_WAIT_SLEEP_US              100000
++#define       USER_WAIT_MAX_ITERATIONS        50
++      int i, fd, active = 0;
++
++      for (i = 0; i < USER_WAIT_MAX_ITERATIONS; i++) {
++              if (fgconsole() == num) {
++                      active = 1;
++                      break;
++              }
++              fd = getconsolefd();
++              if (ioctl(fd, VT_ACTIVATE, num)) {
++                      perror("chvt: VT_ACTIVATE");
++              }
++              usleep(USER_WAIT_SLEEP_US);
+       }
++      return active;
+ }
+ 
+ int is_framebuffer(void)
+diff -urN suspend/vt.h suspend.new/vt.h
+--- suspend/vt.h       2006-03-16 22:19:01.000000000 +0100
++++ suspend.new/vt.h   2009-06-14 04:34:20.894655045 +0200
+@@ -5,6 +5,6 @@
+ int open_a_console(const char *fnam);
+ int getconsolefd(void);
+ int fgconsole(void);
+-void chvt(int num);
++int chvt(int num);
+ int is_framebuffer(void);
+ char *get_fbname(void);
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/suspend/suspend.spec?r1=1.63&r2=1.64&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to