A system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is executed on. In other words, a system call is a way for programs to interact with the operating system. A computer program makes a system call when it makes a request to the operating system’s kernel. System call provides the services of the operating system to the user programs via Application Program Interface(API). It provides an interface between a process and operating system to allow user-level processes to request services of the operating system. System calls are the only entry points into the kernel system. All programs needing resources must use system calls
1. create()
This system call is used to create a new file. It creates a new file on disk, creates a file table entry, then sets the first unused file descriptor to point to the table file entry and then return it (or -1 upon failure).2. open()
This system call can be used to open a file, for either reading or writing purposes. The working principle in the OS is similar to that of create() , except for the first step. Instead of creating a file on the disk , it first reads the file from the disk.3. close()
This system call takes in a file descriptor (The ones created by the above two commands) and then closes the file which is pointed at by this file descriptor.4. read()
This system call reads a certain number of bytes (passed as parameters) into the ‘buf’ memory area. It updates the access time for the file as well.5. write()
This system call takes a file descriptor and a buffer and writes a certain number of bytes ( all 3 passed as parameters ) to the file associated with this file descriptor.6. lseek()
This system call is used to shift the location of the pointer of a file descriptor. This location can be set in either relative terms or absolute terms.7. dup()
This system call creates a copy of the file descriptor passed to it. This copy is exactly the same as the original. Both of them can be used interchangeably.8. link()
This system call creates a new directory entry for an existing file.9. unlink()
As the name suggests, this system does the opposite of what link() does. It simply removes the directory entry for an existing file10. access()
This system call checks whether or not the calling process can access a specific file or not (Passed to the call by as a parameter)11. chmod()
This system call is used to change the file’s mode bits (These are the bits which specify the access control for the file Who can do what kind of changes to the file) It takes in the path of the file whose permissions we want to change.12. chown()
This system call is used to change the owner and/or the group of the file (passed through a path or a file descriptor). Only a privileged process can change theownership of a file.