This is the mail archive of the
mailing list for the glibc project.
Re: device open close flow-control
- To: Linux glibc <glibc-linux at ricardo dot ecn dot wfu dot edu>
- Subject: Re: device open close flow-control
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Mon, 8 May 2000 09:49:40 -0700 (PDT)
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
On Mon, 8 May 2000, Roland Schwarz wrote:
> Now I want to 'close' the device on the sending side.
> But the close function does not return until the receiver
> has released his flow control. That is bad.
> What can I do about this? I want anyhow to force the
> connection closed.
This isn't a glibc problem or issue. It's a kernel issue. Read the source code
for the n_tty line discipline and the rs_serial.c driver. I think that if you
put the device into non-blocking mode (or open it with O_NONBLOCK) you can do a
close which doesn't wait.
I've just taken a cursory look at the n_tty_close code now and it appears to
wake up any processes that are blocked on a read but not ones that are blocked
on a write.
You might just want to do a timed-out select() or poll(), and then do
non-blocking writes to the tty.