Skip to content

Commit 64b08f7

Browse files
rsjordanVladimir Kotal
authored andcommitted
Update intro.tex
Mindr typos up to but not including "API vs ABI".
1 parent 0aaa4e2 commit 64b08f7

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

intro.tex

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
\item The text is currently being translated to English.
3939
\item This material is published under the
4040
\href{http://creativecommons.org/licenses/by-nc-sa/3.0/cz/}{Creative Commons
41-
BY-NC-SA 3.0} license and is always work in progress, see the history on
41+
BY-NC-SA 3.0} license and is always a work in progress, see the history on
4242
GitHub:\\
4343
\url{https://github.com/devnull-cz/unix-linux-prog-in-c}
4444
\item To download the latest version, go to the \emph{releases} tab on GitHub.
@@ -48,7 +48,7 @@
4848
\item The source code files can be found on GitHub here:\\
4949
\url{https://github.com/devnull-cz/unix-linux-prog-in-c-src}
5050
\item In case you find any errors either in the text or in the example programs,
51-
we appreciate if you let us know. Especially do not hesitate to create new
51+
we would appreciate you letting us know. Especially do not hesitate to create new
5252
issues on \url{https://github.com/devnull-cz/unix-linux-prog-in-c/issues}.
5353
\end{itemize}
5454

@@ -118,7 +118,7 @@
118118

119119
\begin{itemize}
120120
\item Note that \emsl{Linux is a kernel}, not the whole system. In contrast to
121-
FreeBSD, for example, which covers both the kernel and the userland. It is
121+
FreeBSD for example, which covers both the kernel and the userland. It is
122122
better to say a ``Linux distribution'' if you discuss a whole system that is
123123
built around the Linux kernel.
124124
\item FreeBSD and NetBSD forked from 386BSD (now defunct) in 1993, OpenBSD
@@ -128,15 +128,15 @@
128128
\item Presently, the ``UNIX'' trademark can be only used by systems that passed
129129
conformance tests defined in the Single UNIX Specification (SUS).
130130
\item From those systems listed above, only Solaris, macOS, AIX, and HP-UX are
131-
UNIX~03 compliant (\url{http://www.opengroup.org/openbrand/register/}). Other,
132-
not certified systems, are often described as ``Unix-like'', even that in many
133-
cases they closely follow the standard. However, word ``Unix'' is often used
131+
UNIX~03 compliant (\url{http://www.opengroup.org/openbrand/register/}). Other
132+
uncertified systems, are often described as ``Unix-like'', even when in many
133+
cases they closely follow the standard. However, the word ``Unix'' is often used
134134
for systems from either group.
135135
\item The above list is a tiny fraction of the whole Unix world. Every
136-
proprietary Unix variant usually came from either UNIX~V or BSD, and added its
137-
own features. That is why there were quite a few standards as well, see page
138-
\pageref{UNIXSTANDARDS}. In the end vendors agreen upon a small set of those.
139-
\item If you are interested in detailed and up-to-date Unix system version
136+
proprietary Unix variant likely came from either UNIX~V or BSD, and added its
137+
own features. This resulted in quite a few standards as well, see page
138+
\pageref{UNIXSTANDARDS}. In the end vendors, agreed upon a small set of those.
139+
\item If you are interested in a detailed and up-to-date Unix system version
140140
history, go check \url{https://www.levenez.com/unix/}.
141141
\end{itemize}
142142

@@ -168,7 +168,7 @@
168168
\item standard of the The Open Group organization founded in 1996 via
169169
merging X/Open and OSF
170170
\item today at Version~4 (\emsl{SUSv4})
171-
\item the compliance is requisite condition for using the UNIX trademark
171+
\item compliance is a requisite condition for using the UNIX trademark
172172
\end{itemize2}
173173
\end{itemize}
174174
\end{slide}
@@ -180,25 +180,25 @@
180180
complex and incomprehensible on a first sight.
181181
\item AT\&T allowed the producers to call its own commercial UNIX variant
182182
``System V'' only if it complied to the SVID standard conditions. AT\&T also
183-
published \emph{System~V Verification Suite} (SVVS), that checked whether given
183+
published \emph{System~V Verification Suite} (SVVS), that checked whether a given
184184
system complies to the standard.
185-
\item POSIX (Portable Operating System Interface) is standardization effort
185+
\item POSIX (Portable Operating System Interface) is a standardization effort
186186
of the IEEE organization (Institute of Electrical and Electronics Engineers).
187-
\item SUSv4 is common standard of The Open Group, IEEE (Std. 1003.1, 2008
187+
\item SUSv4 is a common standard of The Open Group, IEEE (Std. 1003.1, 2008
188188
Edition) and ISO (ISO/IEC 9945-2008).
189-
\item To certify given system to Single Unix Specification it is necessary
189+
\item To certify a given system for the Single Unix Specification, it is necessary
190190
to pass a series of tests (on given architecture, e.g. 64-bit x86).
191-
The results of the tests are then evaluated. The tests itself are unified into
191+
The results of the tests are then evaluated. The tests themselves are unified into
192192
so called \emph{test suites}, which are sets of automatic tests that go through
193193
the system and verify if it implements the interfaces specified in the standard.
194-
For example for SUSv3 there are 10 such test suites.
194+
For example, for SUSv3 there are 10 such test suites.
195195
\item The interfaces specified by the POSIX.1-2008 standard are divided into 4
196196
basic groups: XSH (System Interfaces), XCU (Shell and Utilities), XBD
197-
(Base definitions). W.r.t. number of interfaces the biggest of them is XSH that
197+
(Base definitions). W.r.t. number of interfaces, the biggest of them is XSH which
198198
contains more than 1000 interfaces.
199-
\item The interface groups of POSIX together with the Xcurses group, that is
200-
part of Single Unix Specification (however not part of POSIX base in the IEEE Std
201-
1003.1-2001 standard) includes 1742 interfaces in total, which form Single Unix
199+
\item The interface groups of POSIX together with the Xcurses group, are part
200+
of the Single Unix Specification (however not part of POSIX base in the IEEE Std
201+
1003.1-2001 standard) which includes 1742 interfaces in total, which form the Single Unix
202202
Specification (2003). The SUS interface tables are here:
203203
\url{http://www.unix.org/version3/inttables.pdf}
204204
\item Commercial UNIXes largely follow the Single UNIX Specification, compliance
@@ -207,15 +207,15 @@
207207
UNIX V7 - do not mix it up with historical V7 UNIX). It is built on the POSIX
208208
base.
209209
\item We are going to follow SUSv4 for APIs in this lecture. The data structure
210-
definitions and algorithms used by kernel will be mostly based on
210+
definitions and algorithms used by the kernel will be mostly based on
211211
System~V Rel.~4 to keep things simple.
212-
\item On Solaris there is a extensive \texttt{standards(5)} manual page, where
212+
\item On Solaris there is an extensive \texttt{standards(5)} manual page, where
213213
lots of information about standards can be found in one place.
214214
Individual commands compliant to the standard are moreover placed
215215
into special directories, e.g. the \texttt{tr} program is located in
216216
\texttt{/usr/xpg4/bin/} and \texttt{/usr/xpg6/bin/} directories, in each there
217217
is a version of the program compliant to the respective standard.
218-
The options and behavior specified by the standard can be then relied on e.g.
218+
The options and behavior specified by the standard can be then relied upon e.g.
219219
when writing shell scripts.
220220
\item Also on Solaris, look into the
221221
\texttt{/usr/inc{}lude/sys/fea\-ture\-\_tests.h} header file.
@@ -270,7 +270,7 @@
270270
POSIX.4, because that was its original naming before renumbering.
271271
Most of this extension is optional, therefore the claim ``system supports
272272
POSIX.1b'' gives even worse testimony that ``system is POSIX compatible'', i.e.
273-
practially zero. The only mandatory part of POSIX.4 is simple addendum to
273+
practially zero. The only mandatory part of POSIX.4 is a simple addendum to
274274
signals compared to POSIX1990. It is therefore always necessary to state
275275
what exactly out of POSIX.4 is implemented -- e.g. shared memory, semaphores,
276276
real-time signals, memory locking, asynchronous I/O, timers, etc.
@@ -280,8 +280,8 @@
280280
\pageref{RWLOCKS}.
281281
\item \dots
282282
\end{itemize}
283-
\item The POSIX standars can be found on \url{http://www.open-std.org/}.
284-
The HTML version is freely available, PDF documents have to be paid.
283+
\item The POSIX standards can be found on \url{http://www.open-std.org/}.
284+
The HTML version is freely available, PDF documents have to be purchased.
285285
\end{itemize}
286286

287287

@@ -313,7 +313,7 @@
313313

314314
\begin{enumerate}
315315
\item A great book on Unix in general and compares SVR4.2, 4.4BSD, Solarix~2.x
316-
and Mach systems. The 2nd edition scheduled for 2005 never happened,
316+
and Mach systems. The 2nd edition, scheduled for 2005, never happened,
317317
unfortunately.
318318
\item UNIX classic book. On UNIX System~V Rel.~2, and partially 3 as well.
319319
While outdated, it is one of the best books ever written on Unix. In 1993 a
@@ -357,7 +357,7 @@
357357
net\-work\-ing. Not as detailed as books 1 and 3 but that could be to your
358358
advantage. We very much recommend this book, especially if you want just one.
359359
The author can see the big picture which is quite rare.
360-
\item Unix network programming classics, one of the best on the topic; there is
360+
\item Unix network programming classic, one of the best on the topic; there is
361361
also volume 2, \emsl{UNIX Network Programming, Volume 2: Interprocess
362362
Communications}, covering interprocess communication in great detail.
363363
\item Great book on programming with threads using POSIX API. Highly
@@ -397,8 +397,8 @@
397397
Solaris, the manual page section needs to be provided with the \texttt{-s}
398398
option, ie. ``\texttt{man -s 2 chmod}''.
399399
\item The \texttt{man} command uses a list of system directories to search for
400-
man pages. If you have manual pages some place else, perhaps in a local subtree
401-
after you unpacked a tar file you downloaded and want to check the
400+
man pages. If you have manual pages someplace else, perhaps in a local subtree
401+
after you unpacked a tar file you downloaded and you want to check the
402402
documentation, the \texttt{-M} option may come in handy.
403403
\item Sometimes there are entries for the same name in several sections. If
404404
unsure what you are looking for, use the \texttt{-a} option to get all manual
@@ -504,7 +504,7 @@
504504
\item Be careful when using tools like \texttt{hexdump} that by default print
505505
out a file as 16-bit numbers. The ordering of individual bytes may not be how
506506
they are stored in a file. For example, take FreeBSD on i386. The first number
507-
in the file is character ``i'' which represents lower 8 bits of the first 16-bit
507+
in the file is character ``i'' which represents the lower 8 bits of the first 16-bit
508508
number, so when the first two bytes are printed out as a 16-bit number, the byte
509509
representing ``i'', ie. ``69'', is shown as the second byte. Similarly for
510510
``kl''.
@@ -516,7 +516,7 @@
516516
0000004
517517
\end{verbatim}
518518

519-
You can use other output formats though, for example as hexa bytes and
519+
You can use other output formats though, for example as hex bytes and
520520
characters in the same output:
521521

522522
\begin{verbatim}
@@ -595,7 +595,7 @@
595595

596596
\begin{itemize}
597597
\item One of the most important thing of a C style (well, any style) is
598-
consistency. And often it is not that important what an exact C style a group
598+
consistency. And often it is not that important what exact C style a group
599599
of coders is going to pick as it is that one specific style is chosen and then
600600
religiously followed by all in the group. A good and rigorously followed cstyle
601601
leads to a smaller number of bugs in code.
@@ -730,8 +730,8 @@
730730
\item Non-trivial programs are often split into several source code files that
731731
contain related functions. Such files can be compiled independently, and you
732732
can even use different languages and different compilers for each file. The
733-
advantage is the speed of building as only modified files are re-compiled (see
734-
page \pageref{MAKE} on the \texttt{make} utility), and also flexibility as you
733+
advantage is the speed of building, as only modified files are re-compiled (see
734+
page \pageref{MAKE} on the \texttt{make} utility), and also flexibility, as you
735735
can use some of the files in other programs as well.
736736
\item The \emph{compiler} compiles each file into a corresponding object file.
737737
Instead of external function pointers in the compiled code, the object file
@@ -772,7 +772,7 @@
772772
\item In a situation where you need to fix code full of includes and conditional
773773
compilation, the output after the preprocessor phase may be very helpful to
774774
locate the problem.
775-
\item \texttt{cpp} (or \texttt{cc -E}) also allow you to see the whole tree of
775+
\item \texttt{cpp} (or \texttt{cc -E}) also allows you to see the whole tree of
776776
included files, printed on the standard error output. For that, use a separate
777777
\texttt{-H} option (not \texttt{-EH}) and redirect the output to
778778
\texttt{/dev/null}:
@@ -792,7 +792,7 @@
792792
etc...
793793
\end{verbatim}
794794

795-
\item You cannot nest comments in C so in order to temporarily disable code with
795+
\item You cannot nest comments in C, so in order to temporarily disable code with
796796
comments without deleting it, wrapping it in another comment will not work.
797797
So, the preprocessor to your rescue -- use the conditional compilation feature:
798798

@@ -845,7 +845,7 @@
845845
\sltitle{Compiler}
846846
\renewcommand{\arraystretch}{1.1}
847847
\begin{itemize}
848-
\item volání:\\
848+
\item volání:\\
849849
\texttt{cc [\emph{options}] \emph{file} \dots}
850850
\item the most important options:\\
851851
\begin{tabular}{ll}
@@ -856,7 +856,7 @@
856856
\texttt{-L\emph{directory}} & add a directory to search when using \texttt{-l}\\
857857
\texttt{-O\emph{level}} & optimalization level\\
858858
\texttt{-g} & compile with debug information\\
859-
\texttt{-D\emph{jméno}} & define a macro for the preprocessor\\
859+
\texttt{-D\emph{jméno}} & define a macro for the preprocessor\\
860860
\texttt{-I\emph{directory}} & add a directory to search for \texttt{\#include} files
861861
\end{tabular}
862862
\end{itemize}
@@ -907,7 +907,7 @@
907907
\end{slide}
908908

909909
\begin{itemize}
910-
\item The way how it works is that you use specific macros to define what you
910+
\item The way it works is that you use specific macros to define what you
911911
want (eg. \texttt{\_POSIX\_SOURCE}), and then you use other macros (eg.
912912
\texttt{\_POSIX\_VERSION}) to find out what you actually got. You always have
913913
to include \texttt{unistd.h} after you set the macros and use a compiler that
@@ -932,8 +932,8 @@
932932
the use of c99"
933933
cc: acomp failed for standards.c
934934
\end{verbatim}
935-
%\item zdroj maker pro standard tedy mù¾e být ji¾ na stranì
936-
%\pageref{UNIXSTANDARDS} zmiòovaný hla\-viè\-ko\-vý soubor
935+
%\item zdroj maker pro standard tedy mù¾e být ji¾ na stranì
936+
%\pageref{UNIXSTANDARDS} zmiòovaný hla\-viè\-ko\-vý soubor
937937
%\texttt{feature\_tests.h} na Solarisu.
938938
\item See the documentation for your compiler about what other macros can be
939939
used.
@@ -1122,7 +1122,7 @@
11221122
\end{slide}
11231123

11241124
\begin{itemize}
1125-
\item \emsl{Note that the line with a command starts with a tabulator, not
1125+
\item \emsl{Note that the line with a command starts with a tab, not
11261126
spaces.} Every command line is executed via its own shell invocation. If
11271127
multiple commands need to be executed via the same shell process, all but the
11281128
last line needs to be terminated with a backslash. See the following example
@@ -1182,7 +1182,7 @@
11821182
\item defining a macro on a command line: \\
11831183
\hspace*{5em}\texttt{make \emph{target} \emph{name}=\emph{string}}
11841184
\item macro invocation: \\
1185-
\hspace*{5em}\texttt{\$\emph{name}} (pouze jednoznakové
1185+
\hspace*{5em}\texttt{\$\emph{name}} (pouze jednoznakové
11861186
\texttt{\emph{name}}), \\
11871187
\hspace*{5em}\texttt{\$\{\emph{name}\}} or \texttt{\$(\emph{name})}
11881188
\item environment variables are accessible as macros (eg. \texttt{\$\{EDITOR\}})
@@ -1208,7 +1208,7 @@
12081208
or BSD.
12091209
\item To write a non-trivial \texttt{Makefile} that will work with
12101210
different \texttt{make} implementations is not a simple task. Therefore
1211-
projects as GNU Automake exist. For a simple conditional compilation where
1211+
projects as GNU Automake exist. For a simple conditional compilation, where
12121212
based on the system we need to set different options, the following code might
12131213
come in handy. A character ` is a back quote, and a ' is a normal single quote:
12141214

@@ -1292,7 +1292,7 @@
12921292
information.
12931293
\end{itemize}
12941294
\item Note that the dynamic linker does not run as a separate process (unless
1295-
you run it like that) even that it has its own \texttt{main()} function. It is
1295+
you run it like that) even though it has its own \texttt{main()} function. It is
12961296
used within an address space of an executed program. The program, dynamic
12971297
linker, and dynamic libraries constitute a single process.
12981298

@@ -1305,7 +1305,7 @@
13051305
\item What a dynamic linker is used is in section \texttt{.interp}, see
13061306
''\texttt{elf\-dump -i}'' and ``\texttt{ld -I}''. It means you could write your
13071307
own dynamic linker and set it via the \texttt{-I} option for \texttt{ld} to your
1308-
program. It is needed to say such an enterprise would not be an easy feat at
1308+
program. Needless to say, such an enterprise would not be an easy feat at
13091309
all.
13101310
\item To list the dynamic section, use \texttt{elfdump -d}, dynamic libraries
13111311
are set as \texttt{NEEDED}.
@@ -1319,15 +1319,15 @@
13191319
use \texttt{otool -L} instead.
13201320
\item What libraries are eventually used when running the program could be
13211321
different from what \texttt{ldd} shows. For example,
1322-
one could use the \texttt{LD\_PRELOAD} mechanism. For that reasons,
1323-
Solaris has a \texttt{pldd} command which provides for a running process
1324-
library dependencies. Example on \texttt{LD\_PRELOAD} with \texttt{gcc}: use
1322+
one could use the \texttt{LD\_PRELOAD} mechanism. For that reason,
1323+
Solaris has a \texttt{pldd} command which provides the library dependcies for a
1324+
running process. For an example on \texttt{LD\_PRELOAD} with \texttt{gcc}: use
13251325
already mentioned \texttt{Ma\-ke\-file01}, and compile
13261326
\example{basic-utils/preload.c} like this: ``\texttt{gcc -shared -o
13271327
lib\-pre\-load.so preload.c}''. Run the program then which interposes a system
13281328
call \texttt{close()}: ``\verb#LD_PRELOAD=./libpreload.so ./a.out#''.
1329-
\item Most of the information listed here can be found in a manual page for the
1330-
Solaris dynamic linker, \texttt{ld.so.1(1)}, and much more then in an excellent
1329+
\item Most of the information listed here can be found in the manual page for the
1330+
Solaris dynamic linker, \texttt{ld.so.1(1)}, and much more in the excellent
13311331
\emph{Linkers and Libraries Guide} on \texttt{docs.oracle.com}. If you use
13321332
FreeBSD, its dynamic linker is \texttt{ld-elf.so.1}, on Linux distros it is
13331333
usually \texttt{ld-linux.so.1}, it is \texttt{rld} on SGI IRIX etc.
@@ -1340,7 +1340,7 @@
13401340
\begin{verbatim}
13411341
LD_DEBUG=help date
13421342
\end{verbatim}
1343-
\item To tell the linker to look for dynamic libraries also in directories other
1343+
\item To tell the linker to also look for dynamic libraries in directories other
13441344
than the default ones (paths from \texttt{LD\_LIBRARY\_PA\-TH} are searched
13451345
first), use it like the following:
13461346
\begin{verbatim}
@@ -1362,7 +1362,7 @@
13621362
\url{http://xahlee.org/UnixResource\_dir/\_/ldpath.html}.
13631363

13641364
\par
1365-
This varible is often misused in the start-up scripts because the command(s)
1365+
This variable is often misused in the start-up scripts because the command(s)
13661366
is/are incorrectly linked and the dynamic linker would not otherwise find the
13671367
correct libraries. The typical side effect, however, is that the program(s)
13681368
subsequently start(s) additional programs that use the same libraries but as all
@@ -1811,7 +1811,7 @@
18111811
\end{itemize}
18121812

18131813
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1814-
% Konvence pøedávání parametrù a environmentových promìnných
1814+
% Konvence pøedávání parametrù a environmentových promìnných
18151815

18161816
\pdfbookmark[1]{argv, argc}{args}
18171817

0 commit comments

Comments
 (0)