“read” and “write” perform similar operations and share much code. The two system calls, “read” (5711) and “write” (5720), call “rdwr” immediately to:
Convert the user program file identification to a pointer in the file table;
Check that the operation (read or write) is in accordance with the mode with which the file was opened;
Set up various standard locations in “u” with the appropriate parameters;
“pipes” get special treatment right from the start!
Call “readi” or “writei” as appropriate;
Update the file offset by, and set the value returned to the user program to, the number of characters actually transferred.