Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 1996 08:03:45 -0700 (MST)
From:      Thomas Roell <roell@crab.xinside.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@freebsd.org, jkh@time.cdrom.com
Subject:   Re: Is our ASYNC I/O support for ttys broken?
Message-ID:  <199611131503.IAA09278@xeno.xinside.com>
In-Reply-To: <199611130816.TAA28631@godzilla.zeta.org.au>
References:  <199611130816.TAA28631@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
In your message of 13 November 1996 you write:

> >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?
> 
> 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
> F_SETOWN (although F_SETOWN takes you outside of POSIX) unless the
> corresponding change using tcsetpgrp() would work.  SIGIO for ASYNC
> socket i/o works better because the process or process group of the
> socket, and this is unrelated to the POSIX process group.

Would it be possible to change that behaviour in the future ?

> >  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.

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.

- Thomas  
-- 
Denver Office               THOMAS ROELL        /\      Das Reh springt hoch,
+1(303)298-7478             X INSIDE INC       /  \/\   das Reh springt weit,
1801 Broadway, Suite 1710                     /    \ \/\     was soll es tun,
Denver, CO 80202          roell@xinside.com  / Oelch! \ \     es hat ja Zeit.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611131503.IAA09278>