Date: Thu, 29 May 2003 19:01:21 +0200 From: Gabriel Ambuehl <gaml@buz.ch> To: questions@freebsd.org Subject: portable coproccesses, openpty, forkpty? Message-ID: <77243311093.20030529190121@buz.ch>
next in thread | raw e-mail | index | archive | help
Hi, ok maybe I'm offtopic here, if so please excuse me ;-). I need to implement a coprocess feature (a.stdin gets fed to b.stdin and b.stdout becomes a.stdin, so basically replacing stdin with a processed version thereof). Now the most obvious approach would be to use pipes to redirect stdin/stdout of the two processes but unfortunately, Stevens' Advanced Programming in the UNIX environment notes that this will result in deadlocks if stdio is used. And as I tend to trust Stevens on such issues, I went looking further in the book and he says the only way to do totally transparent coprocesses is with ptys. Now as I understand it, BSD and SysV use different syntax to get ptys and so I'm wondering how to implement coprocesses in a portable way (on FreeBSD, it seems easy, forkpty does most of the work I need it to do but is it portable? Doesn't seem to be POSIX). I'd appreciate any comments, pointers, RTFM's, code snippets, whatever. TIA & regards, Gabriel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?77243311093.20030529190121>