The Rise of Unix. The Seeds of its Fall. / A Chronicle of the Unix Wars

It’s not mine, rather it’s Asianometry‘s. It’s a nice overview of the rise of Unix. I’d recommend checking it out, it’s pretty good. And of course, as I’m referenced!

The Rise of Unix. The Seeds of its Fall.

And part 2: A Chronicle of the Unix Wars

A Chronicle of the Unix Wars (youtube.com)

Years ago I had tried to make these old OS’s accessible to the masses with a simple windows installer where you could click & run these ancient artifacts. Say 4.2BSD.

Download BSD4.2-install-0.3.exe (Ancient UNIX/BSD emulation on Windows) (sourceforge.net)

Installing should be pretty straight forward, I just put the license as a click through and accept defaults.

Starting BSD via ‘RUN BSD42’ and the emulator will fire up, and being up a console program (Tera Term) giving you the console access. Windows will probably warn you that it requested network access. This will allow you to access the VAX over the network, including being able to telnet into the VAX via ‘Attach a PTY’ which will spawn another Tera Term, prompting you to login.

telnettting into the VAX

You can login as root, there is no password, and now you are up and running your virtual VAX with 4.2BSD!

All the items

I converted many of the old documents into PDF’s so you may want to start with the Beginners guide to Unix. I thought this was a great way to bring a complex system to the masses, but I’m not sure if I succeded.

776 downloads

As it sits now, since 2007 it’s had 776 downloads. I’d never really gotten any feedback so I’d hoped it got at least a few people launched into the bewildering world of ancient Unix. Of course I tried to make many more packages but I’d been unsure if any of them went anywhere. It’s why I found these videos so interesting as at least the image artifacts got used for something!

But in the off hand, maybe this can encourage some Unix curious into a larger world.

Other downloads in the same scope are:

Enjoy!

cflow

This is just me rambling……

Anyways I was looking at some source, and instead of me trying to make heads or tails of it, it’d be more fun to have the machine try to do so, and in this endeavor I thought I’d try cflow.

So let’s try something terribly simply, like the fortune program from Unix 32v:

#include stdio.h

char line[500];
char bline[500];

main()
{
        double p;
        register char * l;
        long t;
        FILE *f;

        f = fopen("/usr/games/lib/fortunes", "r");
        if (f == NULL) {
                printf("Memory fault -- core dumped\n");
                exit(1);
        }
        time(&t);
        srand(getpid() + (int)((t>>16) + t));
        p = 1.;
        for(;;) {
                l = fgets(line, 500, f);
                if(l == NULL)
                        break;
                if(rand() < 2147483648./p)
                        strcpy(bline, line);
                p += 1.;
        }
        fputs(bline, stdout);
        return(0);
}

This is a simple program, to say the least.  So running cflow gives me this:

# cflow fortune.c
main() :
    fopen()
    printf()
    exit()
    time()
    srand()
    getpid()
    fgets()
    rand()
    strcpy()
    fputs()

Simple, right?  Now let’s add in the C pre-processor, and add in the 32v include paths….

# cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n fortune.c
    1 main() :
    2     fopen()
    3     printf()
    4     exit()
    5     time()
    6     srand()
    7     getpid()
    8     fgets()
    9     rand()
   10     strcpy()
   11     fputs()

OK same thing, I can’t say I was expecting anything else.  But now let’s add in libc:

# cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n fortune.c ../libc/gen/*.c ../libc/stdio/*.c
    1 main() [main () at ../libc/gen/ttytest.c:2]:
    2     fopen() [struct _iobuf fopen (file, mode) at ../libc/stdio/fopen.c:5]
    3     printf() [printf (fmt, args) at ../libc/stdio/printf.c:3]:
    4     exit()
    5     time()
    6     srand()
    7     getpid()
    8     fgets() [char *fgets (s, n, iop) at ../libc/stdio/fgets.c:4]
    9     rand() [rand () at ../libc/gen/rand.c:9]
   10     strcpy()
   11     fputs()
   12     ttyname() [char *ttyname (f) at ../libc/gen/ttyname.c:17]:
   13         isatty() [if (isatty (( & _iob[1]) _file)) at ../libc/stdio/flsbuf.c:24]:
   14             gtty() [gtty (fd, ap) at ../libc/gen/stty.c:13]:
   15                 ioctl()
   16         fstat()
   17         open()
   18         read()
   19         strcpy()
   20         strcat()
   21         stat()
   22         close()

Isn’t that cool?  Now what does the kernel do?

I went ahead and renamed the main function call in the 32v kernel so that way it doesn’t mesh the main’s but here is the call flow:

    # cflow --cpp='/usr/bin/cpp -nostdinc -I../../include -I../../include/sys -I.' -n  fortune.c ../libc/gen/*.c ../libc/stdio/*.c ../sys/sys/*.c
    1 main() [main () at ../libc/gen/ttytest.c:2]:
    2     fopen() [struct _iobuf fopen (file, mode) at ../libc/stdio/fopen.c:5]
    3     printf() [printf (fmt, args) at ../libc/stdio/printf.c:3]:
    4     exit() [exit (rv) at ../sys/sys/sys1.c:343]:
    5         closef()
    6         plock()
    7         iput()
    8         xfree() [xfree () at ../sys/sys/text.c:127]
    9         acct() [acct () at ../sys/sys/acct.c:51]:
   10             plock()
   11             compress()
   12             writei()
   13             prele()
   14         memfree()
   15         wakeup()
   16         setrun()
   17         swtch() [swtch () at ../sys/sys/slp.c:417]:
   18             save() [if (save (u u_ssav)) at ../sys/sys/text.c:253]
   19             resume()
   20             spl6()
   21             idle()
   22             spl0()
   23     srand()
   24     getpid() [getpid () at ../sys/sys/sys4.c:120]:
   25     fgets() [char *fgets (s, n, iop) at ../libc/stdio/fgets.c:4]
   26     rand() [rand () at ../libc/gen/rand.c:9]
   27     strcpy()
   28     fputs()
   29     ttyname() [char *ttyname (f) at ../libc/gen/ttyname.c:17]:
   30         isatty() [if (isatty (( & _iob[1]) _file)) at ../libc/stdio/flsbuf.c:24]:
   31             gtty() [gtty () at ../sys/sys/tty.c:90]:
   32                 ioctl() [ioctl () at ../sys/sys/tty.c:102]:
   33                     getf()
   34         fstat() [fstat () at ../sys/sys/sys3.c:18]:
   35             getf()
   36             stat1()
   37         open() [open () at ../sys/sys/sys2.c:80]
   38         read() [read () at ../sys/sys/sys2.c:12]:
   39             rdwr()
   40         strcpy()
   41         strcat()
   42         stat() [stat () at ../sys/sys/sys3.c:36]:
   43             namei() [struct inode namei (func, flag) at ../sys/sys/nami.c:21]
   44             uchar() [uchar () at ../sys/sys/nami.c:216]:
   45                 fubyte()
   46             stat1()
   47             iput()
   48         close() [close () at ../sys/sys/sys2.c:163]

For something more aggressive, check out the QuakeWorld Server, and UAE 0.4

I saw this git/Unix archive mentioned on TUHS

And I thought that I should broadcast it to the world. Diomidis Spinellis has gone through the hard work of going through all the old legacy Unix source code, making it easily available here.  Even more fun it to just find somewhere with a couple of GB free, and clone it!

git clone https://github.com/dspinellis/unix-history-repo

With that done, you can then ‘check’ out the repo from any of the major releases and get the source!  For example to see 4.4 BSD, you would type in:

cd unix-history-repo
git checkout BSD-4_4

Pretty cool!

And it goes up to FreeBSD 10.0.1  Release tags are:

  • Epoch
  • Research-V1
  • Research-V3
  • Research-V4
  • Research-V5
  • Research-V6
  • BSD-1
  • BSD-2
  • Research-V7
  • Bell-32V
  • BSD-3
  • BSD-4
  • BSD-4_1_snap
  • BSD-4_1c_2
  • BSD-4_2
  • BSD-4_3
  • BSD-4_3_Reno
  • BSD-4_3_Net_1
  • BSD-4_3_Tahoe
  • BSD-4_3_Net_2
  • BSD-4_4
  • BSD-4_4_Lite1
  • BSD-4_4_Lite2
  • BSD-SCCS-END
  • 386BSD-0.0
  • 386BSD-0.1
  • FreeBSD-release/1.0, 1.1, 1.1.5
  • FreeBSD-release/2.0 2.0.5, 2.1.0, 2.1.5, 2.1.6, 2.1.6.1, 2.1.7, 2.2.0, 2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8
  • FreeBSD-release/3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0, 3.5.0
  • FreeBSD-release/4.0.0 4.1.0, 4.1.1, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.6.1, 4.6.2, 4.7.0, 4.8.0, 4.9.0, 4.10.0, 4.11.0
  • FreeBSD-release/5.0.0 5.1.0, 5.2.0, 5.2.1, 5.3.0, 5.4.0, 5.5.0
  • FreeBSD-release/6.0.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0
  • FreeBSD-release/7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0
  • FreeBSD-release/8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0
  • FreeBSD-release/9.0.0, 9.1.0, 9.2.0
  • FreeBSD-release/10.0.0, 10.1.0

Unix/32V multiuser…

Well I was reading through this post:

 
When it made mention that for multiuser operations to work on Unix v7 you have to enable modem control… I’ve never gotten the DZ to work on 32v so seeing that it’s basically just Unix v7 on the VAX it probably worked in the same manner.
 
So I changed the following line from my 32v’s dboot.ini from:
 
set dz lines=8
 
to
set dz lines=16
att dz -m 2311
And now SIMH will listen on TCP port 2311 and allow me to connect into it’s serial ports!
Another minor note, regarding porting SIMH to the SUA/SFU environment for Windows regarding the nanosleep debacle:
In sim_timer.c the lines:
(void) nanosleep (&treq, NULL);
will fail as SUA/SFU don’t have nanosleep, however you can replace it with usleep and it’ll work… I use this:
(void) usleep (milliseconds*1000);
And for some reason some time structures don’t get defined so above the defintion of uint32 sim_os_msec to satisfy ‘foo’, simply place in:
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
And above the definition of uint32 sim_os_ms_sleep_init (void) I placed in:
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
In the file sim_sock.c the line:
timerclear (&tz);
will fail as there is no timerclear… So I just replaced it with the following:
memset(&tz,0x0,sizeof(tz));
I then downloaded & build gnu make 3.81 and I’ve confirmed that 32v will load on the VAX11/780 emulator and it will idle ‘correctly’……
I know this is ‘clear as mud’ but it’ll help some people!

Added UNIX/32v to the sourceforge project

You can download UNIX/32v here: https://sourceforge.net/project/downloading.php?group_id=204974&filename=unix32v-0.3.exe&a=43027585

As a simple windows installer. Just install and run and you’ll be at the login: prompt in no time!

32v is the common ancestor to both 4BSD and SYSV. While primitave by modern standards, this is the version where all 32bit unix’s can be traced back to. This is also the release that was central in the AT&T vs CSRG lawsuit. It is basically a port of the PDP-11’s v7 unix onto the VAX 11/780. I left the default kernel which is restricted to 1MB of ram, and 2 disks.. Only one disk is currently being used.

This version is FREE thanks to the old Caldera license.

Sadly, the DZ11 seems to not be working correctly so this is limited to a single user.. I have made slight modifications to the bootloader & init to print the Caldera message, and to boot 32v into multi user mode.

For what it’s worth, this is a list of the games of 32v:
arithmetic
backgammon
bcd
ching
fish
fortune
hangman
number
quiz
random
trek
wump

This copy of 32v is made possible from the instructions found here:
http://zazie.tom-yam.or.jp/starunix/32v/32v.html (Thanks to Nao!!)