Skip to main content\(\newcommand{\N}{\mathbb N} \newcommand{\Z}{\mathbb Z} \newcommand{\Q}{\mathbb Q} \newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 5.3 Files and Directories
Start by reading the
Files and Directories chapter, section 39.1. This section discusses the two key abstractions of
files and
directories.
Practice 5.3.1.
- inode number
- A number that serves as the low level name for a file.
- file
- a linear array of bytes you can read/write.
- directory
- a file whose contents are a list of pairs of a user-friendly filename and an inode number.
- absolute pathname
- the sequence of directories from the root directory to the file, concatenated by a special separator.
Read sections 39.2 and 39.3, about the interface for creating files.
Practice 5.3.2.
integer
-
string
-
complex object
-
a pointer
-
none of the above
-
Read sections 39.4, 39.5 about reading from and writing to files.
Practice 5.3.3.
Practice 5.3.4.
Which of the following calls to
lseek will position us at the end of the file, so that any subsequent write simply appends to the end?
lseek(fd, 0, SEEK_END)
-
lseek(fd, SEEK_END)
-
lseek(fd, 0, SEEK_CUR)
-
lseek(fd, -1, SEEK_SET)
-
Practice 5.3.5.
Read section 39.6 about the
fork and
dup calls and how they affect file descriptors.
Skim sections 39.7-39.10.
Read sections 39.11-39.13 about working with directories.
Practice 5.3.6.
Read sections 39.14, 39.15, about "hard links" and "symbolic links".
Skim through the remaining sections.
You have attempted
of
activities on this page.