The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: clemc@ccc.com (Clem Cole)
Subject: [TUHS] Early non-Unix filesystems?
Date: Tue, 22 Mar 2016 20:54:54 -0400	[thread overview]
Message-ID: <CAC20D2PofGuk3WytQgespimunA6wM4waooHUSTb1s_uf-Z9NBg@mail.gmail.com> (raw)
In-Reply-To: <CAH_OBicA4WX3OoTQxO3FR63OpP-9b8zvGTcruxK8cKDrT-T5-g@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]

On Tue, Mar 22, 2016 at 1:21 AM, shawn wilson <ag4ve.us at gmail.com> wrote:

> Is that the last Unix that had a major number for file system objects? I
> hadn't run into this but, thinking about it, it's kinda smart (probably
> slower than specific execve kernel calls but still cool).


​I'm trying to parse your question a little and I think you may not quite
understand how “pre-BSD 4.2” UNIX systems worked.



In V7 the file system call works such that mknod(2) is used to create
special files and directories, it does it a little different than you
realize.  Generally, there is no need to use it to create a regular file,
although you could.   To wit the man page says:



SYNOPSIS

mknod(name, mode, addr)

char *name;



DESCRIPTION

*Mknod* creates a new file whose name is the null-terminated string pointed
to by name.  The mode of the new file (including directory and special file
bits) is initialized from mode. (The protection part of the mode is
modified by the process's mode mask; see umask(2)
<http://www.unix.com/man-page/v7/2/umask/>). The first block pointer of the
i-node is initialized from add. For ordinary files and directories addr is
normally zero.  In the case of a special file, addr specifies which special
file.





If you look at the code in mkdir.c (V7 mkdir.c source
<http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/mkdir.c>) you
see that what is being done is a mknod with addr=0 is being called and then
the two links.





. . .

if ((mknod(d, 040777, 0)) < 0) {        fprintf(stderr,"mkdir: cannot make
directory ­%s\n", d);

      ++Errors;

      return;

 }

chown(d, getuid(), getgid());

strcpy(dname, d);

strcat(dname, "/.");

if((link(d, dname)) < 0) {

      fprintf(stderr, "mkdir: cannot link %s\n", dname);

      unlink(d);

      ++Errors;

      return;

}

strcat(dname, ".");

if((link(pname, dname)) < 0) {         fprintf(stderr, "mkdir: cannot link
%s\n",dname);

      dname[strlen(dname)] = '\0';            unlink(dname);

      unlink(d);

      ++Errors;

}



Where as creating special files did mess with the “special file” bits in
the mode.
​ ​
If you look at the code in mknod.c (V7 mknod.c source
<http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/mknod.c>):

 . . .

if(*argv[2] == 'b')

      m = 060666; else

if(*argv[2] == 'c')

      m = 020666; else

      goto usage;

a = number(argv[3]);

if(a < 0)

      goto usage;

b = number(argv[4]);

if(b < 0)

      goto usage;

if(mknod(argv[1], m, (a<<8)|b) < 0)

      perror("mknod");

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20160322/5fbb89cc/attachment-0001.html>


  reply	other threads:[~2016-03-23  0:54 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  0:48 Warren Toomey
2016-03-18  2:49 ` Greg 'groggy' Lehey
2016-03-18  3:59 ` John Cowan
2016-03-18  5:11   ` Warren Toomey
2016-03-18 17:45     ` John Cowan
2016-03-18  8:00 ` Dave Horsfall
2016-03-18  8:42   ` Peter Jeremy
2016-03-18 13:04     ` Clem Cole
2016-03-18 17:12       ` scj
2016-03-18 17:45         ` Random832
2016-03-18 18:02           ` scj
2016-03-21 14:11             ` Dave Horsfall
2016-03-21 21:43               ` Greg 'groggy' Lehey
2016-03-21 22:57                 ` scj
2016-03-21 23:05                   ` Lyndon Nerenberg
2016-03-22  0:27                   ` Greg 'groggy' Lehey
2016-03-23 22:46                   ` Dave Horsfall
2016-03-24  0:32                     ` Ron Natalie
2016-03-24  0:43                       ` Milo Velimirovic
2016-03-24  0:47                         ` Ron Natalie
2016-03-24  1:05                     ` Clem Cole
2016-03-23  1:28                 ` Dave Horsfall
2016-03-23  1:51                   ` Milo Velimirovic
2016-03-23  6:49                   ` Greg 'groggy' Lehey
2016-03-23  7:02                     ` Peter Jeremy
2016-03-23  7:12                       ` Greg 'groggy' Lehey
2016-03-23 13:54                       ` Ron Natalie
2016-03-23 16:28                         ` John Cowan
2016-03-23  8:20                     ` Dave Horsfall
2016-03-21 11:07           ` Tony Finch
2016-03-21 12:06             ` John Cowan
2016-03-22  0:13               ` Greg 'groggy' Lehey
2016-03-22  0:48                 ` John Cowan
2016-03-18 17:01 ` Pat Barron
2016-03-22  5:21   ` shawn wilson
2016-03-23  0:54     ` Clem Cole [this message]
2016-03-23  1:07       ` Clem Cole
     [not found] <mailman.1.1458266402.23080.tuhs@minnie.tuhs.org>
2016-03-18  2:13 ` Johnny Billquist
2016-03-18  2:36   ` Charles Anthony
2016-03-18  2:26 Noel Chiappa
2016-03-22  0:56 Doug McIlroy
2016-03-23  1:58 Doug McIlroy
     [not found] <mailman.1.1458784801.4499.tuhs@minnie.tuhs.org>
2016-03-24 10:17 ` Johnny Billquist
2016-03-24 11:35   ` Ron Natalie
2016-03-24 11:37     ` Johnny Billquist
2016-03-24 22:50   ` Peter Jeremy
2016-03-24 23:06     ` Johnny Billquist
     [not found]       ` <9CBDF635-2FC9-4855-8419-0413EC0336A7@centurytel.net>
2016-03-25  0:35         ` Johnny Billquist
2016-03-27  0:48       ` Dave Horsfall
2016-03-24 19:13 Nemo
2016-03-24 19:54 ` Milo Velimirović
2016-03-26 21:05   ` Ronald Natalie
2016-03-26 21:34     ` Charles Anthony
2016-03-26 22:09       ` Ronald Natalie
2016-03-28 20:32       ` scj

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=CAC20D2PofGuk3WytQgespimunA6wM4waooHUSTb1s_uf-Z9NBg@mail.gmail.com \
    --to=clemc@ccc.com \
    /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).