How to find the type of pipe implementation
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > How to find the type of pipe implementation




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to find the type of pipe implementation  
Madhusudan Singh


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-21-04 11:36 PM

Linux implements half-duplex pipes, while Sun (or so I have read) provides
full duplex pipes. Is there an elegant way of finding out the kind of
implementation ?

Under Linux, popen() opens a uni-directional pipe to another process. Is
this still true under Sun ?





[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
DeMarcus


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 12:36 AM



Madhusudan Singh wrote:
> Linux implements half-duplex pipes, while Sun (or so I have read) provides
> full duplex pipes. Is there an elegant way of finding out the kind of
> implementation ?
>

I'm not sure what exactly you're gonna do, but I have a little tips. As
I remember it (I may be wrong) you can emulate full-duplex pipes with
sockets. I'm not sure if that fixed your problem though.

> Under Linux, popen() opens a uni-directional pipe to another process. Is
> this still true under Sun ?






[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
Rich Teer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 03:35 AM

On Wed, 21 Apr 2004, Madhusudan Singh wrote:

> Linux implements half-duplex pipes, while Sun (or so I have read) provides

Yes, that's correct.

> full duplex pipes. Is there an elegant way of finding out the kind of
> implementation ?

Call isastream() with the one of the pipe's fd's.  If it's a STREAMS
device, odds are its a full-duplex pipe.

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net





[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
Michael Kerrisk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 08:36 AM

On Thu, 22 Apr 2004 02:28:11 GMT, Rich Teer <rich.teer@rite-group.com>
wrote:

>On Wed, 21 Apr 2004, Madhusudan Singh wrote:
> 
>
>Yes, that's correct.
> 
>
>Call isastream() with the one of the pipe's fd's.  If it's a STREAMS
>device, odds are its a full-duplex pipe.

Yes, but that's not sufficient.  On the BSDs, pipes are implemented
using socket, and are bidrirectional.

Cheers,

Michael





[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
Michael Kerrisk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 08:36 AM

On Wed, 21 Apr 2004 18:41:04 -0400, Madhusudan Singh
<spammers-go-here@yahoo.com> wrote:

>Linux implements half-duplex pipes, while Sun (or so I have read) provides
>full duplex pipes.

This is correct.

>Is there an elegant way of finding out the kind of
>implementation ?

Why do you need to know?  Making use of the non-standard,
bidirectional feature that is available in some pipes implementations
is non-portable.

There is no "elegant" way of determining this, as far as I know.  (See
also my other post in this thread.)  The simplest way would be to
write a small program that creates a pipe and tries to write on both
ends.

>Under Linux, popen() opens a uni-directional pipe to another process. Is
>this still true under Sun ?

This is the nature of popen(), and has nothing to do with the
underlying pipes implementation.  The Solaris(8) popen man page says:

The command argument consists of a shell command line.  The
mode  argument is an I/O mode, either r for reading or w for
writing.

In other words, it's EITHER read OR write.

Cheers,

Michael





[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
Arto Huusko


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 01:38 PM

Michael Kerrisk wrote:
> On Thu, 22 Apr 2004 02:28:11 GMT, Rich Teer <rich.teer@rite-group.com>
> wrote:
> 
>
> Yes, but that's not sufficient.  On the BSDs, pipes are implemented
> using socket, and are bidrirectional.

And newer versions of the BSDs (at least Net and Free) again don't
use sockets. But I can't remember whether the new pipe implementation
is bidirectional (IIRC, it is not).

Wouldn't it be best to not guess about the pipe implementation, and
go directly with the sockets. That would be more portable in any
case.

--
Arto Huusko





[ Post a follow-up to this message ]



    Re: How to find the type of pipe implementation  
Michael Kerrisk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-22-04 03:44 PM

On Thu, 22 Apr 2004 15:03:42 +0300, Arto Huusko
<arto.huusko@novogroup.com> wrote:

>Michael Kerrisk wrote: 
>
>And newer versions of the BSDs (at least Net and Free) again don't
>use sockets. But I can't remember whether the new pipe implementation
>is bidirectional (IIRC, it is not).

I haven't checked the BSD code, but can you say more about this?  I
just now did a quick test on FreeBSD 5.1, and pipes seem to be
bidirectional...

Cheers,

Michael





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:39 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register