Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 10:05:32PM -0800, Thomas Bushnell, BSG wrote: > I think it would be clearest to have A open it twice, one for reading, > and one for writing. The problem is getting the two matched together without race. The unique feature in my translator (which distinguishes it from a no

Re: run.c translator

2002-03-20 Thread Thomas Bushnell, BSG
Marcus Brinkmann <[EMAIL PROTECTED]> writes: > It's the canonical file interface. I mean, T is a translator on a node, > A opens the node with O_RDWR and starts to write to it and read from it. > Now when it has nothing more to write, I would like to signal the > translator about it, so it can c

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 02:08:46PM -0800, Thomas Bushnell, BSG wrote: > I'm pretty sure that's a bug; standard pipes shouldn't be > bidirectional. Roland, what do you think? In SVR4, they behave this way (acording to Stevens, who alos calls them stream pipes). > > What I was asking about is the

Re: run.c translator

2002-03-20 Thread Roland McGrath
Rather than just ignoring the offset, you should check for -1 and return ESPIPE otherwise, so pread/pwrite fail as they should. I'd say you should use getdport at the beginning and use io_read and the like directly instead of read. That is more efficient and also shows what the client calls look

Re: run.c translator

2002-03-20 Thread Niels Möller
[EMAIL PROTECTED] (Thomas Bushnell, BSG) writes: > I'm baffled. If it's a plain pipe, then you simply close the end > you're writing on, and the reader gets EOF. Well, I think there are systems where pipe gives you a bidirectional pipe, but where shutdown on the pipe gives you the ENOTSOCK erro

Re: run.c translator

2002-03-20 Thread Roland McGrath
> You ought to set some flag somewhere so that you get the PIPE_BUF > behaviour for pipes, but *not* for socketpairs, right? The PIPE_BUF behavior is part of AF_LOCAL sockets. ___ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/list

Re: run.c translator

2002-03-20 Thread Thomas Bushnell, BSG
[EMAIL PROTECTED] (Niels Möller) writes: > [EMAIL PROTECTED] (Thomas Bushnell, BSG) writes: > > > I'm baffled. If it's a plain pipe, then you simply close the end > > you're writing on, and the reader gets EOF. > > Well, I think there are systems where pipe gives you a bidirectional > pipe, bu

Re: run.c translator

2002-03-20 Thread Thomas Bushnell, BSG
Marcus Brinkmann <[EMAIL PROTECTED]> writes: > We are getting into muddy water again, because I was unprecise. > If we call the application A, the translator T and the forked program P, > then I have the normal file interface open(), read(), write() between A > and T, and a bidirectional pipe cr

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 04:40:32PM -0500, Marcus Brinkmann wrote: > Would I use shutdown even for the file interface between A and T, OTOH, the translator claims itself to be a pipe, so I guess shutdown is perfectly feasible. Sorry for all the confusion. One has to take the warning in the Hurd

Re: run.c translator

2002-03-20 Thread Niels Möller
Roland McGrath <[EMAIL PROTECTED]> writes: > Saying "bidirectional pipe" is descriptive too. :-) They're the same thing. > As we discussed in great detail here at the time, `pipe' now creates a > bidirectional pipe, i.e. it creates a socketpair and does not call > shutdown. You ought to set some

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 10:03:16PM +0100, Niels M?ller wrote: > Does your run-translator get any interesting rpc if the process that > opened the translated node calls shutdown on its fd? I would think it gets the shutdown rpc :) Marcus ___ Bug-hurd

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 12:55:36PM -0800, Thomas Bushnell, BSG wrote: > Marcus Brinkmann <[EMAIL PROTECTED]> writes: > > > The implementation is using the Hurd's IO interface. It seems I was not > > clear enough in my original mail. The translator creates a pipe to the > > forked program, and t

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Tue, Mar 19, 2002 at 02:54:24PM -0800, Thomas Bushnell, BSG wrote: > I'm baffled. If it's a plain pipe, then you simply close the end > you're writing on, and the reader gets EOF. > > I assumed the implementation used socketpairs, where closing your > writing half would prevent you from also

Re: run.c translator

2002-03-20 Thread Roland McGrath
> Then you are using a bidirectional pipe: you should really call it a > socketpair. (Exactly how are you creating it?) Saying "bidirectional pipe" is descriptive too. :-) They're the same thing. As we discussed in great detail here at the time, `pipe' now creates a bidirectional pipe, i.e. it c

Re: run.c translator

2002-03-20 Thread Niels Möller
Marcus Brinkmann <[EMAIL PROTECTED]> writes: > Now, suppose you have a program like wc that collects data and returns > a summary of that data. It will read from stdin until it gets EOF, and > then print from stdout. But if I use the above translator, I have only > one filedescriptor, and I can

Re: run.c translator

2002-03-20 Thread Thomas Bushnell, BSG
Marcus Brinkmann <[EMAIL PROTECTED]> writes: > The implementation is using the Hurd's IO interface. It seems I was not > clear enough in my original mail. The translator creates a pipe to the > forked program, and translates io_read into a pipe read and io_write > into a pipe write. The transl

Re: run.c translator

2002-03-20 Thread Marcus Brinkmann
On Wed, Mar 20, 2002 at 09:25:21PM +0100, Oystein Viggen wrote: > It's cheating, but wouldn't the following in most cases do the same as > filter? > > #!/bin/bash > `showtrans $1 | cut -d \ -f 2-` Sure, that's a neat trick, too (you might need to strip more options from it that are specific to

Re: run.c translator

2002-03-20 Thread Oystein Viggen
* [Marcus Brinkmann] > So I am considering to write a "filter" program that has two threads > and takes a filename as an argument. One thread reads on stdin and > writes to the opened file, the other thread reads from the file and > writes to stdout. This should work rather well, and can be us

Re: run.c translator

2002-03-20 Thread Thomas Bushnell, BSG
[EMAIL PROTECTED] (Niels Möller) writes: > [EMAIL PROTECTED] (Thomas Bushnell, BSG) writes: > > > You want the "shutdown" call, which should do the right thing. > > Does shutdown work on plain pipes, or is it it necessary to use > socketpair instead of pipe? (Not that that is usually a problem,

Re: run.c translator

2002-03-19 Thread Niels Möller
[EMAIL PROTECTED] (Thomas Bushnell, BSG) writes: > You want the "shutdown" call, which should do the right thing. Does shutdown work on plain pipes, or is it it necessary to use socketpair instead of pipe? (Not that that is usually a problem, I'd recommend socketpair everytime, except if one act

Re: run.c translator

2002-03-18 Thread Thomas Bushnell, BSG
Marcus Brinkmann <[EMAIL PROTECTED]> writes: > However, there is a fundamental problem in all this because we can't > properly signal an EOF condition. After all, we only have one file > descriptor open to the run translator, and how can we signal that there is > nothing left to read to it? Whe

run.c translator

2002-03-18 Thread Marcus Brinkmann
Hi, I have cleaned up my run.c translator for inclusion in the Hurd, please let me know if I can check it in (it's supposed to be a single file in trans/run.c). I think it is a simple translator to learn from by beginners, but it also provides a useful functionality. It's one