On Fri, 7 Jul 2006 13:25:20 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Apparently we have used wrond console ioctls around freeze() in
> suspend_system() and in a wrong order.  The appended patch fixes
> this.
> 
> Comments welcome.

Just some questions. You told me this was a hack to get the user not 
to switch VTs. 

I guess the VT_ACTIVATE before the freeze is need  because we can't
be sure the user didn't switch since the last time with switched.
Is the second needed, because there is a (slim) chance they did just before 
the freeze after the first VT_ACTIVATE?

Why do we switch to KD_GRAPHIC just before freeze and KD_TEXT just after?
Shouldn't we KDGETMODE and restore that?

> 
> -- 
>  suspend.c |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> Index: suspend/suspend.c
> ===================================================================
> --- suspend.orig/suspend.c
> +++ suspend/suspend.c
> @@ -620,11 +620,6 @@ static void shutdown(void)
>       while(1);
>  }
> 
> -#define switch_vt_mode(fd, vt, ioc1, ioc2)   ioctl(fd, KDSKBMODE, ioc1); \
> -                                             ioctl(fd, VT_ACTIVATE, vt); \
> -                                             ioctl(fd, VT_WAITACTIVE, vt); \
> -                                             ioctl(fd, KDSKBMODE, ioc2);
> -
>  int suspend_system(int snapshot_fd, int resume_fd, int vt_fd, int vt_no)
>  {
>       loff_t avail_swap;
> @@ -641,9 +636,15 @@ int suspend_system(int snapshot_fd, int 
>               return ENOSPC;
>       }
>  
> -     switch_vt_mode(vt_fd, vt_no, K_MEDIUMRAW, KD_GRAPHICS);
> +     ioctl(vt_fd, KDSKBMODE, K_MEDIUMRAW);
> +     ioctl(vt_fd, VT_ACTIVATE, vt_no);
> +     ioctl(vt_fd, VT_WAITACTIVE, vt_no);
> +     ioctl(vt_fd, KDSETMODE, KD_GRAPHICS);
>       error = freeze(snapshot_fd);
> -     switch_vt_mode(vt_fd, vt_no, KD_TEXT, K_XLATE);
> +     ioctl(vt_fd, KDSETMODE, KD_TEXT);
> +     ioctl(vt_fd, KDSKBMODE, K_XLATE);
> +     ioctl(vt_fd, VT_ACTIVATE, vt_no);
> +     ioctl(vt_fd, VT_WAITACTIVE, vt_no);
>  
>       splash.switch_to();
>       splash.progress(15);

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to