Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Mechiel Lukkien
On Sat, Dec 05, 2009 at 08:24:45AM -1000, Tim Newsham wrote: ps. if you wanted to hide this ugliness of passing a buffer and fd to a child process instead of just passing an fd, you could still solve it in userland without a syscall. Write a library that does buffered IO. Include unget() if

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread erik quanstrom
since file descriptors are so essential, it may help to have tools to use them. yesterday evening i hacked up devbuf.c and devjoin.c after reading this thread. both offer a file new. for devbuf.c you can write data to it, then later consume it (yes, you could just use a pipe instead).

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread roger peppe
2009/12/5 Bakul Shah bakul+pl...@bitblocks.com:       int newfd = fdfork(oldfd); i'm not sure that there needs to be a new syscall to enable this. a driver would be adequate. here's one possibility: the driver implements buffered streams - i.e. reads are lazy, but previous reads can be

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread roger peppe
2009/12/7 Mechiel Lukkien mech...@xs4all.nl: i've attached devbuf.c and devjoin.c, as example (for inferno). [saw this just after i'd posted] that's funny - you even chose the same device character for devbuf! to be honest, your devbuf.c is almost synomous with a pipe. for buffer sizes of 64K,

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Francisco J Ballesteros
Hmmm. That's what a cat device do, only that it does so by looking at the sizes and not at eof indications. Also, it depends on seek pos., which wont work for streams. Perhaps a streamcat, although I don't like to have cats and streamcats. Perhaps yet another option. fs is already larger than

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Charles Forsyth
i wonder if there's a way of perverting fs(3) i made the comment fairly idly, so i shouldn't take it too seriously.

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Sam Watkins
On Mon, Dec 07, 2009 at 12:24:05PM +, roger peppe wrote: if you wanted it, an fd join driver could be simply implemented in a similar way: bind '#j4.5' /mnt/joined open /mnt/joined/data to get a (read-only) fd that satisfies reads from fd 4 until eof, then fd 5. That's not what I meant

Re: [9fans] keyboard events in sam

2009-12-07 Thread Lorenzo Bolla
To be more precise, I meant samterm, not sam. Sorry for the noise. L. On Mon, Dec 7, 2009 at 2:13 PM, Lorenzo Bolla lbo...@gmail.com wrote: Hi all, looking at sam sources from plan9port, it seems that CTRL-0 and CTRL-p (and followings, like CTRL-1 and CTRL-q, CTRL-2 and CTRL-r, etc)

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Francisco J Ballesteros
I think he wants copyfile + a kproc. On 07/12/2009, at 15:37, rogpe...@gmail.com wrote: 2009/12/7 Sam Watkins s...@nipl.net: I meant for example if a process is reading from its stdin a open file 'A' and writing to stdout the input of a pipe 'B', rather than looping and forwarding data it

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread roger peppe
2009/12/7 Francisco J Ballesteros n...@lsub.org: I think he wants copyfile + a kproc. yup, i was thinking of inferno's sys-stream(). but neither is in a position to do the kind of redundancy optimisation that sam was talking about, AFAICS. at least it can avoid copying by calling bread and

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread erik quanstrom
fs is already larger than it was, there's an experimental ongoing version that knows enough of partitioning to help usb and others on that respect. why not just use sdloop(3)? - erik

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread Francisco J Ballesteros
It seems that changing a bit fs(3) can suffice and is generic enough for all usages required. In the end it might result in code removed instead of adding code, but time will tell. As of today, it's only an experiment. On Mon, Dec 7, 2009 at 5:10 PM, erik quanstrom quans...@coraid.com wrote: fs

Re: [9fans] keyboard events in sam

2009-12-07 Thread Russ Cox
sam(1) says ``Text may be typed and edited as in rio(1); also the escape key (ESC) selects (sets dot to) text typed since the last mouse button hit.'' rio(1) has a subsection titled ``Text windows.'' Ctrl-0 isn't a real control sequence (if you look at the output of ascii, the valid control

Re: [9fans] keyboard events in sam

2009-12-07 Thread Lorenzo Bolla
On Mon, Dec 7, 2009 at 4:17 PM, Russ Cox r...@swtch.com wrote: sam(1) says ``Text may be typed and edited as in rio(1); also the escape key (ESC) selects (sets dot to) text typed since the last mouse button hit.'' rio(1) has a subsection titled ``Text windows.'' This subsection is in

Re: [9fans] ideas for helpful system io functions

2009-12-07 Thread roger peppe
2009/12/7 Nathaniel W Filardo n...@cs.jhu.edu: fd1 := open(/foo1, ORDWR); fd2 := open(/foo2, ORDWR); fd3 := fdjoin(fd1, fd2); what is going to happen? something has got to initiate the requests to actually shift the data, and it's not clear which direction the data will flow. file to