[comp.unix.questions] TIOCEXCL and recovering from it.

coleman@cam.nist.gov (Sean Sheridan Coleman X5672) (04/19/91)

In a program I wrote, I set TIOEXCL bit on a serial line.
Unfortuantly, the bit wasn't removed when I did a CTRL-C.

My question is: Is there a way to clear this port without 
having to reboot since I have lost the file descriptor when I 
quit the program.


Sean Coleman
NIST
Boulder, CO

coleman@bldrdoc.gov

gwyn@smoke.brl.mil (Doug Gwyn) (04/21/91)

In article <8189@alpha.cam.nist.gov> coleman@cam.nist.gov (Sean Sheridan Coleman X5672) writes:
>In a program I wrote, I set TIOEXCL bit on a serial line.
>Unfortuantly, the bit wasn't removed when I did a CTRL-C.

Yes, that's why you need a SIGINT handler in your program.

>My question is: Is there a way to clear this port without 
>having to reboot since I have lost the file descriptor when I 
>quit the program.

I assume the problem is that some process still has the device open.
Basically, you'll have to kill the process.  (The TIOCEXCL is going
to prevent additional opens, which would be necessary in order to
apply a TIOCNXCL.)