From owner-freebsd-hackers Tue Nov 12 16:04:22 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA05534 for hackers-outgoing; Tue, 12 Nov 1996 16:04:22 -0800 (PST) Received: from time.cdrom.com (time.cdrom.com [204.216.27.226]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA05493 for ; Tue, 12 Nov 1996 16:03:59 -0800 (PST) Received: from time.cdrom.com (localhost [127.0.0.1]) by time.cdrom.com (8.8.2/8.6.9) with ESMTP id QAA29413 for ; Tue, 12 Nov 1996 16:04:01 -0800 (PST) To: hackers@freebsd.org Subject: Is our ASYNC I/O support for ttys broken? Date: Tue, 12 Nov 1996 16:04:01 -0800 Message-ID: <29402.847843441@time.cdrom.com> From: "Jordan K. Hubbard" Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Thomas Roell over at X Inside just sent me this little snippet, complaining that ASYNC I/O was broken in FreeBSD where it worked with Linux and SVR4. Any comments? #include #include #include #include int fd; void signal_handler( int signo ) { char buf[64]; printf("bazoing %d\n", read(fd, buf, sizeof(buf))); } main() { struct sigaction sa; sa.sa_handler = signal_handler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); sigaction(SIGIO, &sa, NULL); fd = open("/dev/ttyd0", O_RDONLY | O_NONBLOCK); fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | FASYNC); fcntl(fd, F_SETOWN, getpid()); for (;;) { sleep(10000); } } And yes indeed, the signal handler never goes off when you're trying to talk to a standard TTY device. I changed the /dev/ttyd0 in the example to /dev/cuaa1, which is where my mouse is (and from which I can provably read data with cat) and the signal handler was never called. Jordan