Yep, funny you mention that -- in 1985 I wrote a computer-to-computer comms program that was a terminal with file I/O and special functions, sort of Kermit-on-steroids, and had to learn all about the SysV I/O for terminal and file control. Loved every minute of it. :)
> I had access to Unix source code...
Alas, although I could have (there was a nearby 3B5 that had full sources), I was not permitted to view them, because the company I was working for was developing a "Unix-like" industrial process control system from scratch and we had to have plausible deniability that we'd ever viewed the actual Unix sources.
I did Unix System V/386 device drivers around 1990, so I don't have any plausible deniability and have been careful to stay away from "standard" Unix utilities since then.