1 /* vi: set sw=4 ts=4: */
3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
10 #include <sys/types.h>
11 #include <sys/ioctl.h>
13 /* From <linux/vt.h> */
14 #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
19 int deallocvt_main(int argc, char *argv[])
23 if ((argc != 2) || (**(argv + 1) == '-')) {
26 #ifndef BB_FEATURE_TRIVIAL_HELP
27 "\nDeallocate unused virtual terminal /dev/ttyN\n"
34 fd = get_console_fd("/dev/console");
37 /* deallocate all unused consoles */
38 if (ioctl(fd, VT_DISALLOCATE, 0)) {
39 perror("VT_DISALLOCATE");
43 for (i = 1; i < argc; i++) {
46 fprintf(stderr, "%s: 0: illegal VT number\n", progname);
48 fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
50 else if (ioctl(fd, VT_DISALLOCATE, num)) {
51 perror("VT_DISALLOCATE");
52 fprintf(stderr, "%s: could not deallocate console %d\n",