Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - openpty or alternatives: (2 Items)
   
openpty or alternatives  
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?
Re: openpty or alternatives  
Pardon the noise. Sometimes after poring over arcane subjects, I just have to pose a question to get on track. Having 
found a few more references, I think this question displays a misunderstanding of basic pseudo-tty operation, and I 
think I'm on the right track now.