To lock VT switching, try the following simple code.
This is nice because root can re-enable switching to
get a terminal if needed.

Compile the code below.
Run it in the first console with: vtlock lock /dev/tty
Next, enter startx -- vt1
You now have X on vt1, non-switchable.
For X on the usual vt7, lock it with: vtlock lock /dev/tty7


/* vtlock.c -- A simple virtual termnial [un]locker */
#include <linux/vt.h>
#include <fcntl.h>
#include <stdio.h>

int main(int argc, char *argv[]){
        int fd,lock;
        if (argc<2){
                fprintf(stderr,"Usage: %s lock|unlock <tty device>\n"
                                "\tlock or unlock the given tty.\n",
                                argv[0]);
                exit(-1);
        }
        if (!(fd=open(argv[2],O_RDONLY))) {
                fprintf(stderr,"Error: unable to open tty %s\n",argv[2]);
                exit(-1);
        }
        lock=!strcmp(argv[1],"lock");
        printf("Ioctl VT_%sLOCKSWITCH returned %d\n",lock?"":"UN",
                        ioctl(fd,lock?VT_LOCKSWITCH:VT_UNLOCKSWITCH));
        return(0);
}
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to