18.17 rdwr (5731)

“read” and “write” perform similar operations and share much code. The two system calls, “read” (5711) and “write” (5720), call “rdwr” immediately to:

5736:

Convert the user program file identification to a pointer in the file table;

5739:

Check that the operation (read or write) is in accordance with the mode with which the file was opened;

5743:

Set up various standard locations in “u” with the appropriate parameters;

5746:

“pipes” get special treatment right from the start!

5755:

Call “readi” or “writei” as appropriate;

5756:

Update the file offset by, and set the value returned to the user program to, the number of characters actually transferred.