Date: Tue, 25 Aug 1998 22:32:24 +0200 From: freebsd-emulation@bland.fido.de (freebsd-emulation) To: freebsd-emulation@FreeBSD.ORG (UUCP) Subject: Linux termios problem Message-ID: <MSGID_242=3A7600=2F1.0_5e3114c0@Fido.DE>
next in thread | raw e-mail | index | archive | help
Hello! I am running FreeBSD 2.2.5 and seem to have a problem with the termios code of the Linux emulation. In order to implement something like "kbhit()" (a function to query if any characters are waiting in the console input queue), I use code similar to the following example program: #include <termios.h> #include <stdio.h> int main(void) { struct termios tios; char c; tcgetattr(0, &tios); tios.c_lflag &= ~(ICANON | ISIG); tios.c_lflag &= ~ECHO; tios.c_cc[VMIN] = 0; tios.c_cc[VTIME] = 0; tcsetattr(0, 0, &tios); setbuf(stdin, NULL); c = getchar(); return c; } With the flags that I set, the getchar() function is supposed to return immediately even if no character could be read. (In this case, it should return EOF and I afterwards have to clear the errorflag from stdin, but this does not matter for the test program). The code from above works if I compile it natively for FreeBSD, and it works if I compile it with the linux crossdevelopment package and run the executable on a Linux box. However, it does not work if I try to run the resulting Linux executable on FreeBSD in Linux emulation mode. There, the getchar() function blocks for a very long time (minutes) before it returns. Is this a bug in my code (if so, please tell me where), or is it a problem with the Linux emulation of FreeBSD? Viele Gruesse, Tobias To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MSGID_242=3A7600=2F1.0_5e3114c0>