Re: [PATCH -mm] swsusp/pm: refuse to suspend devices if wrong console is active

From: Pavel Machek
Date: Mon Feb 20 2006 - 05:36:59 EST


On Ne 19-02-06 21:35:26, Andrew Morton wrote:
> "Rafael J. Wysocki" <rjw@xxxxxxx> wrote:
> >
> > 1) Remove the console-switching code from the suspend part of the swsusp
> > userland interface and let the userland tools switch the console.
> >
> > 2) It is unsafe to suspend devices if the hardware is controlled by X. Add
> > an extra check to prevent this from happening.
> >
> > ...
> > @@ -82,6 +85,12 @@ int device_suspend(pm_message_t state)
> > {
> > int error = 0;
> >
> > + /* It is unsafe to suspend devices while X has control of the
> > + * hardware. Make sure we are running on a kernel-controlled console.
> > + */
> > + if (vc_cons[fg_console].d->vc_mode != KD_TEXT)
> > + return -EINVAL;
> > +
> > down(&dpm_sem);
>
> Does this mean that swsusp simply won't work if invoked while X is running
> and being displayed? If so, that sounds like a pretty severe limitation.

No, no. Kernel with switch to text console before doing this in swsusp
case, and userspace has to switch to text console before doing this in
uswsusp case.

This is just a sanity check, to guard against misuse by uswsusp
program.

Pavel
--
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/