[TUHS] A question about ls(1)

Norman Wilson norman at oclsc.org
Sun Apr 28 06:11:21 AEST 2019


On Sat, Apr 27, 2019 at 09:38:27AM -0600, Warner Losh wrote:
  But I find this interesting, since the 8th edition was based on BSD 4.1c I
  thought....

`Based on' is an overstatement, except in the kernel.

The system described in the 8th Edition manual (as noted in the
past, there was only sort of a real V8 release) had a kernel
that started as 4.1x BSD.  I'm not sure of the value of x.
It had the Joy/Babaolgu paging code and the complicated changes
to signals, and a lot of the gratuitous asms, but not a trace
of the BSD networking API.  Neither was the BSD FFS present.

Local additions included Dennis's original stream implementation,
which completely replaced the old tty code and rewrote the drivers
for serial-port devices.  The tty driver (responsible for cooked
mode, interrupt and quit signals, and the like) was a stream
module.  The BSD-style `new tty line discipline' was a separate
module, for the few people who couldn't live without csh.

Tom Killian's original version of /proc and Peter Weinberger's original
network file system (neta) client were there.  These were accessed
through a file system switch, also Peter's work.

Instead of FFS, Peter made a simple speedup to the V7 file system:
adding 64 to the minor device number meant the file system used 4KiB
blocks.  The unused space at the end of the now-4KiB superblock was a
bitmap of free blocks, allowing somewhat-smarter block allocation.

There was a hacky implementation of TCP/IP which we didn't really use:
4.Y BSD (I don't know the value of Y) protocol code, wrapped up to
work as stream modules* and shoehorned in, with a custom API quite
different from the BSD one.  The work was done by a summer student,
Robert T. Morris, who later became rather famous for a smaller but
rather more troublesome bit of network code.  Our production network
was Datakit, which was also implemented as stream devices and modules
(it was the network whose use inspired the stream design, in fact).

[* Quite a while ago, someone asked how multiplexing was handled
in the stream world.  I meant to write a reply but never did.  In
a sentence, by a paired device driver and stream module.  If someone
wants more details I'll be glad to write more about that.]

That's just the kernel, though.  The user-mode world was largely
descended from V7 rather than from BSD.  Most people used sh, which
had been augmented a bit by Rob Pike (perhaps et al) to add functions
and a simple external history mechanism (Tom Duff's idea, I think).
wc had no uucp-dependent flags, and cat had no flags at all.  ls did
sniff at whether standard output was a tty and put things in columns.

Things mutated further as time went on, further diverging from and
discarding aspects of the BSD origin.  (I can take credit or blame
for a lot of that, though not all.)  But that happened later, and
is reflected in the 9th and especially 10th editions of the manual.

Norman Wilson
Toronto ON


More information about the TUHS mailing list