Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 1996 04:34:53 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, roell@crab.xinside.com
Cc:        hackers@freebsd.org, jkh@time.cdrom.com
Subject:   Re: Is our ASYNC I/O support for ttys broken?
Message-ID:  <199611131734.EAA11083@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> 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



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