23. Review#

23.1. Common File System System Calls#

Function

Reference

Brief Description

open()

here

Creates a file descriptor for file I/O

close()

here

Closes a file descriptor

read()

here

Copies bytes from file descriptor to buffer

write()

here

Copies bytes from buffer to file descriptor

lseek()

here

Sets the I/O offset in an open file descriptor

rename()

here

Renames a file/directory

link()

here

Adds a hard link to a file

unlink()

here

Decrement file reference count

opendir(), readdir(), dirent()

here

Enumerate names in a directory

stat(), fstat()

here

Returns file information

opendir(), rmdir()

here

Create/remove empty directory

23.2. Review Questions#