From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Thu, 3 Feb 2011 15:27:59 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.37-rc6-18+; KDE/4.5.5; x86_64; ; ) References: <201102031245.33842.dexen.devries@gmail.com> <201102031444.40895.dexen.devries@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201102031527.59587.dexen.devries@gmail.com> Subject: Re: [9fans] files vs. directories Topicbox-Message-UUID: aad3ce24-ead6-11e9-9d60-3106f5b1d025 On Thursday, February 03, 2011 03:15:29 pm roger peppe wrote: > On 3 February 2011 13:44, dexen deVries wrote: > > On Thursday, February 03, 2011 02:36:40 pm roger peppe wrote: > >> On 3 February 2011 11:45, dexen deVries wrot= e: > >> > read(open("/foo")) returns byte stream under entry `foo' in the root > >> > object. > >> >=20 > >> > readdir("/foo") returns `bar' (and possibly others) -- entries in > >> > hierarchical section of object `/foo'. > >>=20 > >> there's no distinction between readdir and read in plan 9. > >=20 > > 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. >=20 > i don't think that helps you. >=20 > under plan 9, reading a directory is this: >=20 > translate(read(open(dir))) >=20 > 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=20 files in other OSes (from userland perspective). =20 > oh yes, maintaining the usual semantics for cp becomes tricky. >=20 > mkdir z > cp x.c z >=20 > 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= =20 me. Theoretically, it's prone to race condition: suppose somebody removes t= he=20 dir `z' right between `mkdir' and `cp'. You `cp x.c z', and end up with `z'= =20 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=20 bytestream, whatever `z' happens to be right now. Creating `z' in the proce= ss,=20 if not present. If you want to have `z/x.c', you'd state that explicitly as= =20 `cp x.c z/x.c'. nb., with the current semantics you *could* say `cp x.c z/' to be unambiguo= us=20 you want to create a child of `z', but it seems to be common not to use=20 trailing slash unless 100% necessary. =2D-=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] > 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