At the end of last week, I began to read the book Unix/linux System Programming Manual, the weekend time to see the fourth chapter, that this book than directly to see the Linux kernel is better to accept more, because from the code to start, you can better understand, such as the third chapter of the system call to explain, if only theoretical aspects may be more boring, So the code in this book, How to run it. download Code
The homepage of this book. There are two code versions:
Distribution Version:a Tarball of the source code that is includes extra material not shown into the book. Probably, this is the version of the code that you want.
Book Version:a tarball of the "source code as it appears in the" book.
Can download according to their own choice, I downloaded the first version, you can click on the link above to download, if the download failed, you can go to the homepage to download.
Download the code, after decompression, as shown in the following figure:
Execute make in the Tlpi-dist directory, then go to each file under separate view, you can find that each. c file generates the corresponding executable file. There is a make file in each subfolder, and the role of make can be understood as we write. c files to compile, Because you want to include the author's error print header file, use GCC no longer like us before gcc-o hello hello.c so simple, to use include include header file, and makefile is simpler, each time the code has changed directly in the corresponding directory to execute make, will generate a new executable file.
We take the fourth chapter of a code as an example:
We run the program before the first new Hello, which is stored in the content, execution,/copy will see the corresponding usage, this is the author of the use of Usageerr printed out content, and then we follow the prompts to execute, verify, when the corresponding code, execute make again, will regenerate the executable file .
For the Variable Parameters section of chapter Three, please refer to my notes, if you have any questions and questions, welcome to talk with me
If make error after downloading code, do not generate the corresponding executable file, please upgrade the GCC version, refer to Segmentfault response