Skip to content

Commit 8d28fb0

Browse files
author
Vladimir Kotal
committed
finish spellcheck of the file
1 parent e7a8742 commit 8d28fb0

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

file-api.tex

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
provided.
3434
\item Functions from a header file \texttt{stdio.h} (e.g. \funnm{fopen}(),
3535
\funnm{fprintf}(), and \funnm{fscanf}()), and their file handle \texttt{FILE}
36-
are defined in the standard libc library and use standard system calls like
37-
\funnm{open}(), \funnm{write}(), and \funnm{read}(). From those functions, we
38-
will only use functions for printing to the terminal output like
36+
are defined in the standard \texttt{libc} library and use standard system calls
37+
like \funnm{open}(), \funnm{write}(), and \funnm{read}(). From those functions,
38+
we will only use functions for printing to the terminal output like
3939
\funnm{fprintf}().
4040
\end{itemize}
4141

@@ -281,8 +281,8 @@
281281
can \texttt{rm} all hard links to a specific file but if a process has the file
282282
still open, the file data remains on the disk until the process closes the file
283283
or terminates.
284-
\item If a process needs a temporary file, it can create it, unlink it right
285-
away, and work with it using the existing file descriptor. When the file
284+
\item If a process needs a temporary file, it can create it, \texttt{unlink} it
285+
right away, and work with it using the existing file descriptor. When the file
286286
descriptor is closed (and all of its possible duplicates), the file data is
287287
released.
288288
\item Even \texttt{close} may fail. For example, some filesystems may write the
@@ -541,7 +541,9 @@
541541

542542
%%%%%
543543

544+
ifdef([[[NOSPELLCHECK]]], [[[
544545
\pdfbookmark[1]{dup, dup2}{dup}
546+
]]])
545547

546548
\begin{slide}
547549
\sltitle{Descriptor duplication: \texttt{dup()}, \texttt{dup2()}}
@@ -609,8 +611,9 @@
609611
will learn about the \texttt{exec} calls on page \pageref{EXEC}.
610612
\item To fully understand how redirection works it is good to draw the file
611613
descriptor table for each step and where the slots point to. For example, for
612-
the \nth{2} example in the slide, we have the initial state, after \texttt{close(1)}
613-
and \texttt{open("out", ...)}, and the final state, as follows:
614+
the \nth{2} example in the slide, we have the initial state, after
615+
\texttt{close(1)} and \texttt{open("out", ...)}, and the final state, as
616+
follows:
614617

615618
\begin{verbatim}
616619
+-------+ +-------+ +-------+
@@ -622,7 +625,7 @@
622625
+-------+ +-------+ +-------+
623626
\end{verbatim}
624627

625-
\item You need to pay attention to the state of descriptors. The \nth{2} example
628+
\item You need to pay attention to the state of descriptors. The \nth{2} example
626629
will not work if the descriptor 0 is already closed, as
627630
\texttt{open} returns 0 (the first available descriptor) and \texttt{dup} fails
628631
while trying to duplicate an already closed descriptor. Possible
@@ -726,10 +729,12 @@
726729
\begin{slide}
727730
\sltitle{Get file status information: \texttt{stat()}}
728731
\setlength{\baselineskip}{0.9\baselineskip}
732+
ifdef([[[NOSPELLCHECK]]], [[[
729733
\texttt{int \funnm{stat}(const char *\emph{path}, struct stat *\emph{buf});\\
730734
int \funnm{fstat}(int \emph{fildes}, struct stat *\emph{buf});}
735+
]]])
731736
\begin{itemize}
732-
\item for a file specified by a path or a file descriptor, returns a struct
737+
\item for a file specified by a path or a file descriptor, returns a structure
733738
containing file information, such as:
734739
\begin{itemize}
735740
\item \texttt{st\_ino} \dots{} i-node number
@@ -794,8 +799,10 @@
794799
\item access right masks: \verb#S_IRUSR# (owner has read permission),
795800
\verb#S_IWGRP# (group has write permission), etc.
796801
\end{itemize}
802+
ifdef([[[NOSPELLCHECK]]], [[[
797803
\texttt{int \funnm{lstat}(const char *\emph{path}, struct stat
798804
*\emph{buf});}
805+
]]])
799806
\begin{itemize}
800807
\item if \emph{path} is a symlink, \texttt{stat()} returns information of the
801808
file the symlink refers to. This function returns information about the link
@@ -920,8 +927,8 @@
920927
\item Calling \texttt{unlink} on a hardlink will not release the file data if
921928
other hardlinks exists. You can delete the symlink's target in which case you
922929
end up with a \emph{broken link}.
923-
\item \texttt{readlink} is useful in situation when you want to unlink the
924-
symlink's target.
930+
\item \texttt{readlink} is useful in situation when you want to \texttt{unlink}
931+
the symlink's target.
925932
\item \emph{\texttt{bufsize}} is typically set as 1 byte less than the buffer
926933
size to accommodate the terminating \texttt{NULL} character.
927934
\end{itemize}
@@ -1092,7 +1099,7 @@
10921099
running the process would have had access to a file if it was not for the SUID
10931100
privileges. However, there is an inherent security hole in this approach.
10941101
The test and the subsequent action on the file is not an atomic operation. An
1095-
attacker could possibly unlink the file and immediately symlink it to a
1102+
attacker could possibly \texttt{unlink} the file and immediately symlink it to a
10961103
different file to what it actually had no rights to manipulate with. If the
10971104
timing is right, the SUID process will operate on that other file. The correct
10981105
solution is not to use the \texttt{access} call but return to the real UID/GID
@@ -1109,13 +1116,17 @@
11091116

11101117
\begin{slide}
11111118
\sltitle{Setting file permissions}
1119+
ifdef([[[NOSPELLCHECK]]], [[[
11121120
\texttt{int \funnm{chmod}(const char *\emph{path}, mode\_t \emph{mode});}
1121+
]]])
11131122
\begin{itemize}
11141123
\item changes permissions of file \emph{path} to \emph{mode}.
11151124
\item can be used by the file owner or root
11161125
\end{itemize}
1126+
ifdef([[[NOSPELLCHECK]]], [[[
11171127
\texttt{int \funnm{chown}(const char *\emph{path}, uid\_t \emph{owner},
11181128
gid\_t \emph{group});}
1129+
]]])
11191130
\begin{itemize}
11201131
\item changes file owner and group for \emph{path}. Value of
11211132
\texttt{-1} means do not change that ID.

unix_dict.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
personal_ws-1.1 en 325
1+
personal_ws-1.1 en 324
22
Illumos
33
Prog
44
Ctrl
@@ -11,8 +11,8 @@ cmd
1111
errnum
1212
dev
1313
DUPFD
14-
bsd
1514
redistributable
15+
bsd
1616
Ritchie
1717
userspace
1818
OpenSSH
@@ -33,8 +33,8 @@ userland
3333
TLI
3434
args
3535
argv
36-
UID
3736
UFS
37+
UID
3838
tracepoint
3939
DNS
4040
PCTS
@@ -88,7 +88,6 @@ XDR
8888
allocators
8989
pathmap
9090
makefile
91-
Makefile
9291
Butenhof
9392
Xinuos
9493
IEC
@@ -138,8 +137,8 @@ filesystems
138137
iOS
139138
Rago
140139
lstat
141-
ldd
142140
IPS
141+
ldd
143142
acomp
144143
gprof
145144
currentunix
@@ -300,12 +299,12 @@ pdftitle
300299
RDONLY
301300
environ
302301
chrooted
303-
Linkers
304302
linker's
303+
Linkers
305304
SAS
306305
CSRG
307-
symlink's
308306
symlinks
307+
symlink's
309308
OpenBSD
310309
SCO
311310
Xcurses

0 commit comments

Comments
 (0)