On Friday, 15 September 2006 21:39, Tim Dijkstra wrote:
> On Fri, 15 Sep 2006 11:06:36 +0200
> Pavel Machek <[EMAIL PROTECTED]> wrote:
> 
> > Hi!
> > 
> > > This patch will lock the VT that is active just after splash is
> > > initialized and release it just before the splash system is stopped.
> > > 
> > > I haven't tested it extensively with bootsplash.org, but it seems to
> > > work with that (in vmware) too.
> > > 
> > > Comments?
> > > 
> > 
> > > @@ -1027,6 +1030,75 @@
> > >  }
> > >  #endif
> > >  
> > > +
> > > +static void release_vt(int signo)
> > > +{
> > > + printf("Ignoring request to release VT\n");
> > > + ioctl(vfd, VT_RELDISP, 0);
> > > +}
> > > +
> > 
> > Is printf safe to call from signal handler?
> 
> It seems to work. But these were there mainly for testing, so  
> they can go.
>  
> > > +static int lock_vt()
> > 
> > (void).
> > 
> > > + error = ioctl(fd, VT_GETSTATE, &vtstat);
> > > + close(fd);
> > > + 
> > > + if ( error < 0 )
> > 
> > (error < 0), (no spaces) please.
> > 
> > > + /* Setting vt mode to VT_PROCESS means this process
> > > +  * will handle vt switching requests.
> > > +  * We installed handlers for release and acquire requests.
> > > +  */
> > 
> > Is it possible to just ignore those signals? Kernel will be unable to
> > switch, anyway, no?
> 
> I think we can drop the handler for the acquire event. That should
> never happen anyway.
> 
> Hmm, I could have sworn that I tested with SIG_IGN as a handler, and
> that it did not work. After testing it again, it does seem to do the
> trick ...
> 
> But installing that handler can't hurt, right? It does explicitly
> dismiss the switch. But indeed, after reading the linux source, I think 
> ignoring the signal works also.
>   
> > > + printf("Locked against VT switching\n");
> > 
> > This should be gone in final version.
> > 
> > Otherwise looks okay to me...
> >                                                                     Pavel
> 
> Rafael: 
> > It looks good to me too except for one thing: could we please return
> > well-defined error codes from lock_vt() instead of -1?
> 
> What do you propose? Return -errno?

For example:

error = ioctl(vfd, VT_GETMODE, &vtm);
if (error)
        return error;


-- 
You never change things by fighting the existing reality.
                R. Buckminster Fuller

-------------------------------------------------------------------------
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