Subject: History (was Re: sysv ps(1) implementation)
To: Andrew Brown <email@example.com>
From: Greywolf <firstname.lastname@example.org>
Date: 06/09/2000 13:07:16
On Fri, 9 Jun 2000, Andrew Brown wrote:
# Date: Fri, 9 Jun 2000 14:52:10 -0400
# From: Andrew Brown <email@example.com>
# To: Greywolf <firstname.lastname@example.org>
# Cc: NetBSD Userlevel Technical Discussion List <email@example.com>
# Subject: Re: sysv ps(1) implementation [was: ps(1) sysv silliness]
# >[mkdir/mknod not; i remember now it was that mkdir had to be setuid
# > because the _rename_ call hadn't been implemented yet, that was it!
# > so mkdir was, more or less (modulo GC and error checking)
# > char *cp;
# > mkdir(path);
# > link(path, cp = strspl(path, "/."));
# > link(getcwd(), cp = strspl(path, "/.."));
# i'm sure someone will correct if i'm wrong, but wasn't it more like
# system("mkdir path"); /* with some sprintf() magic */
# chown(getuid(), path);
# chgrp(getgid(), path);
# because mkdir (the program) actually did
# char *cp;
# mknod(path, 0777, however_you_describe_a_directory);
# link(path, cp = strspl(path, "/."));
# link(getcwd(), cp = strspl(path, "/.."));
Possibly; I know it used to be possible to make a directory with
mknod...I think I was getting confused again, because rename(2) didn't
exist until 4.2BSD, and mkdir() didn't come in until 4.2, either,
at least not properly implemented (why, I'm not sure), because
mkdir was setuid root (we had a hacked version by which mkdir ^D
would grant a root shell), and I know about rename (which was a Berkeley
invention, thank you!) because every version of SysV I used until SVR4
would not allow a mortal user to mv(1) a directory -- mv used link/unlink.
I think it would have been mknod(path, 040777, 0) since the final arg
is the major/minor of the device.
# since mknod was used to make directories and was limited to use by
# root processes?
# ps - what's strspl()?
"string splice" -- a string concatenator with allocation. One
would have free()d the cp between the link calls :-)
Implementation thereof is left as an exercise for the user.
This is probably getting too far afield; for the newcomers, the history
might be kind of cool but not on topic...so I changed it.
Does anyone maintain a UNIX trivia site?
BSD: It spanks the knickers off those other operating systems.