[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread John Goerzen
On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote:
 John Goerzen wrote:

 So I have a need to write data to a POSIX named pipe (aka FIFO).  Long
 story involving a command that doesn't have an option to read data
 from stdin, but can from a named pipe.

 How about /dev/stdin?

Only works on Linux.

-- John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Brandon S. Allbery KF8NH


On Apr 16, 2008, at 11:16 , John Goerzen wrote:

On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote:

John Goerzen wrote:

So I have a need to write data to a POSIX named pipe (aka FIFO).   
Long

story involving a command that doesn't have an option to read data
from stdin, but can from a named pipe.


How about /dev/stdin?


Only works on Linux.


Hm.  I see it even on our ancient Solaris 8 boxes.  And I'm quite  
sure the *BSDs support it as well.  Just how ancient / weird is this  
POSIX platform of yours?


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Miguel Mitrofanov

You are insulting other Unixes. It works on Mac OS X, for example.

On 16 Apr 2008, at 19:16, John Goerzen wrote:

On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote:

John Goerzen wrote:

So I have a need to write data to a POSIX named pipe (aka FIFO).   
Long

story involving a command that doesn't have an option to read data
from stdin, but can from a named pipe.


How about /dev/stdin?


Only works on Linux.

-- John

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Brandon S. Allbery KF8NH


On Apr 16, 2008, at 13:23 , Miguel Mitrofanov wrote:

You are insulting other Unixes. It works on Mac OS X, for example.


Not just that, but IIRC Linux was late to the party:  Solaris got / 
dev/fd/ and /dev/stdin before Linux got /proc/$$/fd/ (which gets  
symlinked to /dev/fd/).


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Donn Cave


On Apr 16, 2008, at 10:25 AM, Brandon S. Allbery KF8NH wrote:


On Apr 16, 2008, at 13:23 , Miguel Mitrofanov wrote:

You are insulting other Unixes. It works on Mac OS X, for example.


Not just that, but IIRC Linux was late to the party:  Solaris got / 
dev/fd/ and /dev/stdin before Linux got /proc/$$/fd/ (which gets  
symlinked to /dev/fd/).


Yeah, among people who don't know much about UNIX, Linux gets a lot  
of credit for things it borrowed.  But /dev/stdin isn't a standard  
feature of UNIX, if you count AIX for example as a UNIX platform.   
And apparently you can compile Haskell programs on AIX - thanks to  
the original poster in this thread's work with GHC - so there you go.


Donn

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread John Goerzen
On Wed April 16 2008 12:20:37 pm Brandon S. Allbery KF8NH wrote:
 On Apr 16, 2008, at 11:16 , John Goerzen wrote:
  On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote:
  John Goerzen wrote:
  So I have a need to write data to a POSIX named pipe (aka FIFO).
  Long
  story involving a command that doesn't have an option to read data
  from stdin, but can from a named pipe.
 
  How about /dev/stdin?
 
  Only works on Linux.

 Hm.  I see it even on our ancient Solaris 8 boxes.  And I'm quite
 sure the *BSDs support it as well.  Just how ancient / weird is this
 POSIX platform of yours?


OK, so I shouldn't have said it only works on Linux, but as far as I can 
tell, it isn't standard (defined by POSIX).  I don't presently have easy 
access to non-Linux machines, but I do want to be as portable as possible.

-- John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Simon Marlow

Donn Cave wrote:

I have run into this problem, with Network.Socket (socket).  If I 
remember right,
ktrace showed me what was happening.  This isn't my favorite thing about 
Haskell.

Is there even a means provided to set it back to blocking?


There isn't a way right now to open a file using a blocking FD, however 
the IO library does support using blocking FDs (the std handles are left 
in blocking mode to avoid causing problems with pipes).  We could 
certainly add an interface to let you open files in blocking mode - just 
submit a feature request via GHC's Trac and we'll try to get around to 
it (or better still, send us a patch... the code is in 
GHC.Handle.fdToHandle).


Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Richard A. O'Keefe

One question is whether the program is statically or dynamically linked,
and if the latter, whether it is possible (as it is in many Unices) to
slide your own open(2) definition in between the program and the system
library.  If it is, it's possible to slide in something that fakes
/dev/stdin.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-15 Thread Joe Buehler

John Goerzen wrote:


So I have a need to write data to a POSIX named pipe (aka FIFO).  Long
story involving a command that doesn't have an option to read data
from stdin, but can from a named pipe.


How about /dev/stdin?

--
Joe Buehler

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe