File Attributes
Inodes (14.4)
On a disk, each file has a unique record called an i-node
This contains information about the file
type
owner id,
group id
permissions
times last: accessed, modified, status change
number of hard links to the file
size in bytes
Blocks allocated to the file
Pointer to the data blocks of the file.
Look at the picture on page 258.
Hard Links.
This is really not a unique file type.
Multiple file names can point to the same file.
Because, as we will find out, a directory associates a sting with a i-node number
Think of a directory on the wall in a building.
Adelgren 152 Baker 159 Bennett 158
Ann Quinn is a exception.
Chairperson 107 Quinn 107
This is the idea of a hard link.
A hard link associates a file name with a i-node number
ln
oldfile
newfile
The files must be on the same file system.
ls -li
do this.
Symbolic links
Hard links are limited to file systems.
To overcome this, symbolic links are provided.
This can cross file system boundaries.
This
is
a new file type.
ln -s oldfile newfile
newfile, the link will hold the path to the old file.
If oldfile goes away, the link will still exist, but will be an error
There is a limit to the number of symbolic links in a chain (surprisingly not one).
These are used all over the place.
By the way, some system calls will behave differently for symbolic links than for regular files.
Character and Block Special files.
These are the interfaces to the devices on the system.
Character files are for character style i/o
Think mouse, keyboard, terminal
Block files are for disks and block writes.
Each has a major number, which is the routine to call when accessing the device.
Each has a minor number, which is the parameter to pass to the routine when accessing the device.
That is mostly what we will do with these.
mknod
is used to create them.
File systems are associated with block/special devices via the
mount
command.
Sockets
These are for unix-domain sockets.
A communications mechanism.
There is no direct way to create them at the command line
A call to
bind
with the proper arguments will create them.
probably one in /tmp/.X11-unix