From owner-freebsd-hackers Wed Nov 13 09:35:48 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA00215 for hackers-outgoing; Wed, 13 Nov 1996 09:35:48 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA00206 for ; Wed, 13 Nov 1996 09:35:41 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.7.6/8.6.9) id EAA11083; Thu, 14 Nov 1996 04:34:53 +1100 Date: Thu, 14 Nov 1996 04:34:53 +1100 From: Bruce Evans Message-Id: <199611131734.EAA11083@godzilla.zeta.org.au> To: bde@zeta.org.au, roell@crab.xinside.com Subject: Re: Is our ASYNC I/O support for ttys broken? Cc: hackers@freebsd.org, jkh@time.cdrom.com Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >> The status hasn't changed since he complained a year or so ago. >> SIGIO for ASYNC tty i/o is only sent to the process group of the tty, >> and process group stuff is limited by it being POSIX conformant >> with few extensions - the process group can not be changed using >Would it be possible to change that behaviour in the future ? Of course. >> > fd = open("/dev/ttyd0", O_RDONLY | O_NONBLOCK); >> > >> > fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | FASYNC); >> > fcntl(fd, F_SETOWN, getpid()); >> >> The second fcntl is guaranteed to fail, since `fd' isn't a controlling >> terminal. To make fd a controlling terminal, something like the following >> must be done: >> >> fork() >> wait in parent, continue as follows in child: >> setsid(); /* become a session leader with no ctty */ >> open as above >> first fcntl as above >> ioctl(fd, TIOCSCTTY, NULL); /* make fd the ctty */ >> second fcntl as above > >Tried that already. Doesn't work. It works with getpid() replaced by `-getpgrp()'. >Problem is that I really don't want to spawn subprocesses for >io-stuff. On the other hand asynchronous input is really mandatory if >you have a heavily loaded box and run CDE and/or OpenGL/PEX apps. Is this for the X server? It's already in the background and doesn't have a controlling terminal (at least for XFree :-) so no additional processes are required for handling one mouse. Bruce