Re: How do I make a circular pipe?

From: Rob Landley (telomerase@yahoo.com)
Date: Sat Apr 14 2001 - 12:44:46 EST


> > Apparently, the pipe
> > fd's evaporate when the process does an execve.
>
> Check out:
>
> #include <unistd.h>
> #include <fcntl.h>
>
> /* ... */
>
> fcntl (fd, F_SETFD, (long) FD_CLOEXEC);
>
> to set/reset the close on exec bit.

Cool. That's EXACTLY what I was looking for. Thanks.

Thanks also to the people who pointed out pppd's "pty"
option (yes I read the docs on that, but they're a bit
cryptic). And yes, my pseudo-code example used fd[0]
twice. Thanks. You can stop emailing me now. :)

> You might want to check out something like Stevens
> advanced UNIX programming, though it is probably
> somewhat dated :-)

I've got about fifteen books with names like that, but
strangely in real world situations I keep trying to
use the man pages instead. Sad, I know...

> At a guess I would say that the reason is you don't
> have as much control with pipes as you do with
> devices. Under the standard termios, you can tell
> the system to not return from the read until either
n
> characters have been read, or a given character such
> as a newline has been read. You can also switch to
> alternative line disciplines that are more targeted
> to a given application such as PPP, etc.

Hmmm. And the reason these cool toys aren't available
as some kind of wrapper around a normal read-from-fd
is...? (Performance?)

> You probably want to check out pseudo tty's (pty's),
> which allow you to create your own terminal.

This occurred to me in the car on the way home after
five hours messing with this. (Of course. :)

> Here is the glibc documentation,

Thanks.

Info. Never thought to check info. Here I am
checking linuxdoc's howtos, man pages, and google...
Sigh... I don't suppose there's an info2html tool
anywhere?

Well what do you know, there is. (I LIKE Google.)

http://www.cs.dartmouth.edu/~jonh/info2html/

Rob

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
-
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 : Sun Apr 15 2001 - 21:00:23 EST