On Thursday, February 03, 2011 03:15:29 pm roger peppe wrote: > On 3 February 2011 13:44, dexen deVries <dexen.devr...@gmail.com> wrote: > > On Thursday, February 03, 2011 02:36:40 pm roger peppe wrote: > >> On 3 February 2011 11:45, dexen deVries <dexen.devr...@gmail.com> wrote: > >> > read(open("/foo")) returns byte stream under entry `foo' in the root > >> > object. > >> > > >> > readdir("/foo") returns `bar' (and possibly others) -- entries in > >> > hierarchical section of object `/foo'. > >> > >> there's no distinction between readdir and read in plan 9. > > > > Forgot about that. Still, you can't chdir() into an inode that doesn't > > indicate being a directory. And the bytestream returned by > > read(SOME_DIRECTORY) is fixed-format and doesn't provide any space for > > free- form bytestream. > > i don't think that helps you. > > under plan 9, reading a directory is this: > > translate(read(open(dir))) > > i don't see how you can make read(open(dir)) return > something different.
no contest there. I'd like to have a look at the handling of multiple forks of files in other OSes (from userland perspective). > oh yes, maintaining the usual semantics for cp becomes tricky. > > mkdir z > cp x.c z > > do i mean to write x.c to z itself, or to a new file within z? I have only linux experience with cp -- and this usage pattern always irked me. Theoretically, it's prone to race condition: suppose somebody removes the dir `z' right between `mkdir' and `cp'. You `cp x.c z', and end up with `z' file. It's unpredictable, unless you're on a single-process OS (yuck). I'd rather see `cp x.c z' always duplicates bytestream from x.c into z's bytestream, whatever `z' happens to be right now. Creating `z' in the process, if not present. If you want to have `z/x.c', you'd state that explicitly as `cp x.c z/x.c'. nb., with the current semantics you *could* say `cp x.c z/' to be unambiguous you want to create a child of `z', but it seems to be common not to use trailing slash unless 100% necessary. -- dexen deVries [[[↓][→]]] > how does a C compiler get to be that big? what is all that code doing? iterators, string objects, and a full set of C macros that ensure boundary conditions and improve interfaces. ron minnich, in response to Charles Forsyth http://9fans.net/archive/2011/02/90