October 21, 2022

BSD TCP/IP for Kyu - file and directory layout

When I untar the file "4.4BSD-Lite.tar.gz", what do I see? What is missing?

What you see is from the perspective of the filesystem root. So you see /etc, /dev, /tmp -- but the bulk of these are empty directories.

Pruning

I decide to get rid of the empty directories.

Also "sys" is a symbolic link to "usr/src/sys". Handy though this is, I get rid of this also since it just bloats the tags file I generate later for all of this.

Next I run "ctags -R ." -- I get a lot of "no such file" warnings. These are due to things like the following. Links to absolute filenames. We could write a script to fix these (and maybe we will someday). A glance at them shows that few if any are in the vital source tree so we ignore these for now. We can just run ctags again someday, capture the output and write a script to process all of the offending files if that ever seem worth doing.

cd etc
ls -al termcap
lrwxrwxrwx 1 tom tom 23 Mar 17  2016 termcap -> /usr/share/misc/termcap

Another annoyance is tags files scattered around in various places. Running grep finds all kinds of distracting thing in these. These are easily dealt with via:

find . -name tags -print
find . -name tags -delete

The sources

The Net/3 distribution contains a lot more than just the networking source. You can find the source for many utilities (cat, date, rm, ps, mount, fsck, ...).

We are interested in kernel sources, and they are found in usr/src/sys.

Kernel include files are in the "sys" directory.

For a network device driver, look at usr/src/sys/hp300/dev/if_le.c which is a fairly concise driver for the AMD 7990 "LANCE" network chip.

The hp300 is (was) a Motorola 68020 based machine, not unlike a sun3. It is more properly called an HP 9000 series model 300. These were introduced in 1985 and declared obsolete in 1997.

ANSI C

Sorry.

This is good old K and R C code from the good old days.

Interestingly the header files have ansi prototypes (enclosed in a __P macro) which allowed some level of compiler verification.


Have any comments? Questions? Drop me a line!

Kyu / [email protected]