Re: forkpty with streams

From: Andries Brouwer (aebr@win.tue.nl)
Date: Fri Jul 25 2003 - 10:27:51 EST


On Thu, Jul 24, 2003 at 11:28:36PM +0000, Andrew Barton wrote:

> I've got the 2.4 kernel, and I'm trying to use the forkpty() system call

forkpty is not a system call

> with the standard I/O stream functions. The calls to forkpty() and
> fdopen() and fprintf() all return successfully, but the data never seems
> to get to the child process.

> pid = forkpty (&fd, 0, 0, 0);
> if (pid == 0) {
> execlp ("sh", "sh", (void *)0);
> } else {
> F = fdopen (fd, "w");
> fprintf (F, "exit\n");
> fflush (F);
> wait (0);
> }

Let me see. Your sh gets input from this pseudotty and sends its
output there again. But you never read that filedescriptor.
No doubt things will improve if you let the parent read from fd.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:26 EST