From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <45219fb00709061317x594e82a6vb43d136767f245ab@mail.gmail.com> Date: Thu, 6 Sep 2007 22:17:39 +0200 From: "=?ISO-8859-1?Q?Llu=EDs_Batlle?=" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Pipes on UNIX In-Reply-To: <599f06db0709060906t745766b4h2bc4fc499a16b417@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <45219fb00709060604s2d6fc50ex270cfcf30c36067a@mail.gmail.com> <140e7ec30709060657r72fbb10fjf118a72452a30a16@mail.gmail.com> <45219fb00709060702t14169959ne9636b1b7e3d0f0c@mail.gmail.com> <140e7ec30709060712g6194cd61r9e876be246b2e0ed@mail.gmail.com> <45219fb00709060742u11d68c49s5f18125a525c34e0@mail.gmail.com> <599f06db0709060747t16f7a038pe0f8d787b0a5f833@mail.gmail.com> <13426df10709060852x98559bref882bb9ace6d375@mail.gmail.com> <599f06db0709060906t745766b4h2bc4fc499a16b417@mail.gmail.com> Topicbox-Message-UUID: b9c1e1c2-ead2-11e9-9d60-3106f5b1d025 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 cutt= ing. 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=EDs 2007/9/6, Gorka Guardiola : > 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 >