9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: serge@euler.Berkeley.EDU serge@euler.Berkeley.EDU
Subject: no need for cd
Date: Wed,  8 Mar 1995 16:27:13 -0500	[thread overview]
Message-ID: <19950308212713.04FnuBXU3AGJ235R52Pp4g5wJnvKS3UYftL4y0qR6ZE@z> (raw)

Just for fun (:-), given that

	+ current working directory is a (per-)process (file system)
	  specific information 

and

	+ Plan9/Brazil/VSTa/(Mach?) have a general mechanism for manipulating
	  this (i.e. mount)
	
then

	+ it may be possible to eliminate/emulate cd/pwd via mount, e.g.

		+ reserve (by convention only, of course :-) a
		  directory, say "/@" (a fat ".", ala sam :-), or
		  possibly something else, easier to type, e.g. without
		  the need for a shift key, say ",")
		+ in libc/kernel: chdir(char *dir) { mount(dir, "/@"); }
		+ in rc/sh/bin: fn pwd { mount | grep /@ | awk ... }
		+ make the kernel prepend the string "/@" if the file
		  name does not begin with "/" and resolve the pathname again

It may also be possible to eliminate "." and "..", but only if they are
the first (and only, e.g. no "./." or "../..") thing at the front of a
pathname, since then they refer to process specific state (anywhere
else in a pathname they refer to a directory specific state):

		+ reserve (by convention again :-) a directory, say /@@
		  (see above :-)
		+ in libc/kernel: chdir(char *dir) {
					mount(dir, "/@");
					mount(basename(dir), "/@@"); }
		+ make the kernel translate leading "./" and "../" to
		  "/@/" and "/@@/ (for compatibility only, e.g. new
		  programs don't need that and can use "/@" and "/@@"
		  directly)

Come to think of it, if the kernel just threw out (ala sed) all
occurrences of "./" and "xxx/../" in pathnames, we wouldn't even need
the above.  (Didn't the Plan9 people say that mount entries are hashed,
so that ".." can refer to arbitrary directories, depending on what
you've mounted?  E.g. this won't change any semantics.)  We might even
be able call use "/." instead of "/@" and "/.." instead of "/@@".

(It's been too quiet here lately :-)






             reply	other threads:[~1995-03-08 21:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-08 21:27 serge [this message]
1995-03-09  0:09 Scott
1995-03-09  4:49 rob
1995-03-09  7:30 David
1995-03-09  8:18 David
1995-03-11  1:06 serge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19950308212713.04FnuBXU3AGJ235R52Pp4g5wJnvKS3UYftL4y0qR6ZE@z \
    --to=serge@euler.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).