Files Sysmte System Call
Files Sysmte System Call
Super block
• consists of
- the size of the file system
- the number of free blocks in the file system
- a list of free blocks available on the file system
- the index of the next free block in the free block list
- the size of the inode list
- the number of free inodes in the file system
- a list of free inodes in the file system
- the index of the next free inode in the free inode list
- lock fields for the free block and free inode lists
- a flag indicating that the super block has been modified
Algorithm for open
Open
• Fd=open(pathname, flags, modes);
– Pathname : file name
– Flags : type of the open
– Modes : file permission (esp for creat)
– Returns an integer called the user file descriptor
Data structures for open
Process B: fd1= open(''/etc/passwd", O_RDONLY);
fd2 ,.,. open("private", O_RDONLY);
Process A:
Read
• The syntax of the read system call is
number = read(fd, buffer, count)
Process A:
Tables after closing a file
Cp program
Cp …