Xref: utzoo comp.sys.att:5639 unix-pc.general:2326 Path: utzoo!utgpu!watmath!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.sys.att,unix-pc.general Subject: Re: Isn't it amazing what you find in the manuals? Keywords: unixpc locking manuals security disruption Message-ID: <1070@auspex.UUCP> Date: 24 Feb 89 22:46:34 GMT References: <481@uncle.UUCP> <6034@cbmvax.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 55 Yow. History time.... >Do they? SysV's lockf() is the posix-compatible locking facility which >uses the fcntl F_SETLK facility. I think BSD's lockf is similarly >implemented over their "native" locking system call, flock(). BSD doesn't *have* a "lockf", and it couldn't be implemented over "flock", anyway, since "flock" can only lock whole files, not regions of files. >I think locking(2) was an early experimental version of SysV locking. It's >called BASSLOCKING in the header files, after John Bass, who wrote the >code, I beleive. John Bass wrote the code at, if I remember correctly, Cal Poly State. He took it with him to Onyx, and also published it in an issue of the USENIX newsletter, ";login:". Various UNIX systems picked it up. I *think* he called the "sysent" entry for it "locking", but I don't remember. "fcntl" locking is a descendant of Bass locking. >>#define SYS_STTY 31 /* stty() */ >>#define SYS_GTTY 32 /* gtty() */ > >These are old V6 system calls, equivalent to ioctl(TIOC[GS]ETP), but >superceded by ioctl(TC[GS]ETA). Yeah, pretty much: Back in UNIX V6, there was no "ioctl" system call. Instead, there were "gtty" and "stty" system calls, that performed the rough equivalent of the TIOCGETP and TIOCSETP "ioctl"s, respectively. V7, as I remember, had "gtty" and "stty" system calls that *literally* performed TIOCGETP and TIOCSETP "ioctl"s; this was presumably for binary compatibility. They were carried into S3 and S5 and company. There were also library routines "gtty" and "stty" that performed the "ioctl"s in question; this was for source compatibility (the idea was presumably not to provide source compatibility through the system calls, in the hope that the system calls could eventually be nuked). UNIX/TS 1.0, which was a mostly-V7 system with some PWB/UNIX stuff in it and was basically the ancestor of S3 and S5, also had no "ioctl" call. Its tty driver was closer to V6's than V7's. I think it may have had an "ioctl" library routine that, when asked to do a TIOCGETP, did a "gtty", and when asked to do a TIOCSETP, did an "stty". The new tty driver, with TC[GS]ETA and company, arrived in S3; it had a "backward compatibility" feature so that it would still support TIOCGETP, TIOCSETP, *et al*. S3 had "ioctl", obviously. The old "gtty" and "stty" system calls were kept around; it appears that in S5R3 the "gtty" and "stty" library routines still invoke the system call, rather than calling "ioctl" with TIOCGETP and TIOCSETP, respectively, so it was probably that way in S3.