Or is it possible at all that some process or something else could block a virtual terminal? Or what could be a reason that an application hangs when trying to access the VT1?
It seems, while that is happening, it is hanging in the function ioctl
. Esp., this is the code which fails:
int vtno = 1;
const char* vtname = "/dev/tty1";
int fd = open(vtname, O_RDWR|O_NDELAY, 0);
if (ioctl(fd, VT_ACTIVATE, vtno) < 0)
printf("VT_ACTIVATE failed: %s\n", strerror(errno));
if (ioctl(fd, VT_WAITACTIVE, vtno) < 0)
printf("VT_WAITACTIVE failed: %s\n", strerror(errno));
It hangs in the second ioctl
. When I interrupt it, I get this message:
VT_WAITACTIVE failed: Interrupted system call
Also, while it is waiting there, if I do a chvt 1
from another terminal, that also hangs.