From owner-freebsd-emulation Tue Aug 25 21:22:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA06023 for freebsd-emulation-outgoing; Tue, 25 Aug 1998 21:22:04 -0700 (PDT) (envelope-from owner-freebsd-emulation@FreeBSD.ORG) Received: from morannon.fido.de (morannon.faho.RWTH-Aachen.DE [134.130.57.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA05993 for ; Tue, 25 Aug 1998 21:22:00 -0700 (PDT) (envelope-from freebsd-emulation@bland.fido.de) Received: from morannon-ftn.fido.de (news@localhost) by morannon.fido.de (8.8.7/8.8.5/morannon-check-4.4) with FIDOGATE id GAA02476; Wed, 26 Aug 1998 06:25:46 +0200 Received: by sungate-ftn.fido.de (FIDOGATE 4.2.9) id AA02274; Wed, 26 Aug 1998 06:25:13 +0200 Date: Tue, 25 Aug 1998 22:32:24 +0200 From: freebsd-emulation@bland.fido.de (freebsd-emulation) Reply-To: tobi@bland.fido.de (Tobias Ernst) Subject: Linux termios problem Message-ID: To: freebsd-emulation@FreeBSD.ORG (UUCP) Organization: Fido.DE domain gateway (IN e.V.) Lines: 46 X-Gateway: FIDO morannon.fido.de [FIDOGATE 4.2.9] X-FTN-From: freebsd-emulation @ 242:7600/1.0 X-FTN-To: UUCP @ 242:4900/99.0 X-FTN-Via: 242:7600/2@fido.de @19980826.023129.UTC FastEcho 1.45a 41347 X-FTN-Via: FIDOGATE/ftntoss 242:1000/1, Wed Aug 26 1998 at 06:25:08 MEST X-FTN-Domain: Z242@fidode MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 #include 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