I better explain my problem. :)
I have a CGI for Apache. I wrote it in C, and it simply parses text
from a html textarea, giving another html in output. I made it as a
state machine which outputs and outputs according to the input
characters.

Apache communicates with the CGI process with two pipes linked to the
process' stdin and stdout.
But I think that apache code is like this:
while()
{
  read(socket,buffer)
  write(pipe_process1, buffer)
}
while()
{
  read(pipe_process2, buffer)
  write(socket,buffer)
}

Therefore, if I had a CGI similar to 'cat' (and I have), it would
deadlock due to the pipe_process2 not being read by apache if it gets
filled, the process blocks, and then pipe_process1 gets filled.

As I want the CGI to accept input from almost any length, I need a
"pipe buffer" big enough.

Then, based on Gorka suggestion (which I didn't understand as a
9pserver ;), I finally agreed on the easiest solution wrapping the CGI
with a sh script:
#!/bin/sh
head -n 10000000 > inputfile   # limiting the disk ussage to 10MB, raw cutting.
mycgi < inputfile
#EOF

That's all. I will not write any "superpipe" program, or any 9pserver,
because at the end I need the disk. The sh wrapper works well enough.

Thank you for your help in this non-plan9-related problem! Simply the
unicon documentation pointed to something strange in named pipes which
I couldn't check anywhere. :)

Regards,
Lluís

2007/9/6, Gorka Guardiola <[EMAIL PROTECTED]>:
> I wrote it without coffee... would be more like:
>
> generate_data > input &
> data_eater < output
>
> :-).
>
> And input and output can come from a stupid fileserver like pipefs...
> or pipebackedbyaharddiskfs :-).
> --
> - curiosity sKilled the cat
>

Reply via email to