Next | What's a file? | 8 |
So suppose a process, running as user fred, tries to open a file
What happens?
Let's suppose the system already knows the inode for the file
(We'll see in a minute how it gets the inode.)
First it checks the uid in the inode to see if it matches the uid in the process
uid_t i_uid; mjd
Nope.
Then it checks to see if the gid in the inode to see if it matches the gid in the process
gid_t i_gid; users
Yep.
Then it gets the file mode and masks out the right set of three bits:
umode_t i_mode; drwxr-xr-x
In this case, drwxr-xr-x
If the process is opening for writing, the kernel says "no"
If for reading, "yes"
Next | Copyright © 2007 M. J. Dominus |