Norton Allen
12/29/2010 1:27 PM
post80625
|
I have a program that needs to allocate free pseudo terminals and ultimately connect them to some sort of display device
(may be pterm under Photon, may be 'screen' on an inbound ssh connection.)
For my first tests, I used pterm -N3 to allocate the ptys and tell me the device names, then I passed the device names
to the app, where I fopen()-ed them to initialize ncurses. All good.
Now I am thinking I would like the app to allocate the ptys, since it always needs to do that, so I looked for something
that would do that and found openpty(). Unfortunately openpty() seems to open the pty in some sort of exclusive mode [
Subsequent opens block on devc-pty], and I actually need to open the slave side more than once.
So I guess I have two questions:
1: Is there a better way to allocate a free pty?
2: Is there anything I can do to make loosen my hold on the pty that openpty() gives me?
|
|
|