“pipes” are different from other files in that two separate offsets into the file are kept – one for “read” operations and one for “write” operations. The “write” offset is actually the same as the file size.
the parameter passed to “readp” is a pointer to a “file” array entry, from which an “inode” pointer can be extracted;
“plock” (7862) ensures that only one operation takes place at a time: either “read” or “write”;
If a process wishing to write to a “pipe” has been blocked because the pipe was “full” (or rather because the valid part of the file had reached the file limit), it will have signified its predicament by setting the “IWRITE” flag in “ip-i_mode”;
Release the lock before going to sleep;
“i_count” is the number of file table entries pointing at the “inode”. If this is less than two, then the group of “writers” must be extinct;
A process waiting for input will raise the “IREAD” flag. Since a pipe cannot be full and empty simultaneously, no more than one of the flaqs “IWRITE” or “IREAD” should be set at any one time;
“prele” unlocks the file and “wakes up” any process waiting for the pipe.