SGI pipe problem 
Author Message
 SGI pipe problem

Hi,
I am using wish8.0 on an SGI O2 running IRIX6.3

I am using the following procedure (InitXtal) to open a command
pipeline for writing and which reads from a named pipe (fifo) using
a fileevent loop.

My problem is that on the O2, the output read from the fifo
appears to be buffered in lengths of 2048 or some such characters,
despite my best intentions to fconfigure  it to read in line mode.

The rest of the code works by writing a few simple commands into the
 XtalInPipe. The defaultCommand does extensive operations using those
commands and writes considerable amount of text to stdout, redirected to
 fifoOutName.

I don't understand why the buffering is happening. It works perfectly OK
on a DEC alpha.

Suggestions welcomed
thanks
Doug
--------------------------------------------------------------------

proc InitXtal { } {
        global XtalPipe
        global XtalInPipe
        global XtalOutPipe
        global fifoOutName
        global makeFifo
        global LineNum
        global XtalInitiated
        global defaultCommand
        global XtalHaltCommand

        eval " exec  /bin/sh -c  \"$makeFifo $fifoOutName\"  "
        set XtalOutPipe [open $fifoOutName  r+ ]
       fconfigure $XtalOutPipe -blocking 0 -buffering line -buffersize 0

        set XtalInPipe  [open "|$defaultCommand >& $fifoOutName &" w ]

        set XtalInitiated True
        set XtalHaltCommand 0

        # start an event handler to process XtalOutPipe output
        fileevent $XtalOutPipe readable {
            flush $XtalOutPipe
            gets $XtalOutPipe line
            if [eof $XtalOutPipe]  {
                DestroyXtal
            } else {
               .frout.lstout insert  end  "\n$line"
               .frout.lstout see end
               if { [lsearch -regexp $line "Failure*" ] >= 0 } {
                   set XtalHaltCommand 1
              .pcb.button5 config -text "Restart" -command "RestartXtal"
                   incr LineNum -1
                   RaiseCurLine  $LineNum sunken red
                  .pcb.button1 config -state disabled
                  .pcb.button2 config -state disabled
                  .pcb.button3 config -state disabled
                  .pcb.button4 config -state disabled
                  .pcb.button5 config -state normal
                }
            }
        }

Quote:
}



Sat, 18 Mar 2000 03:00:00 GMT  
 SGI pipe problem


Quote:
>Hi,
>I am using wish8.0 on an SGI O2 running IRIX6.3

>I am using the following procedure (InitXtal) to open a command
>pipeline for writing and which reads from a named pipe (fifo) using
>a fileevent loop.

>My problem is that on the O2, the output read from the fifo
>appears to be buffered in lengths of 2048 or some such characters,
>despite my best intentions to fconfigure  it to read in line mode.

.
.
.
You problem is not specific to TCL. It has to do with the normal
implementation of standard output (or pipes) on most operating
systems.

Standard output buffer control is only effective from within the
program doing the output. Attempting to fconfigure a channel you want
to read from will have no impact. The buffering control must be
performed from within the external application that is sending data.



Sun, 19 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. pipe.close -> Broken pipe/DRb madness

2. avoid a blocking operation on a (named) pipe / timeout on a pipe

3. Turning off pipe buffering, or flushing pipe?

4. VRML EAI problem on SGI

5. VRML EAI loading problem on SGI

6. A possible solution to problems installing CosmoPlayer (from sgi.cosmoplayer)

7. Latest Cosmo player from SGI - problems with install

8. Problem with SGI ADA95 1.2

9. Having Problems Loading GNAT on SGI

10. f77 problems on a SGI system

11. SGI fortran compilation problem

12. Memory allocation problem on SGI (works with Compaq on PC)

 

 
Powered by phpBB® Forum Software