The Linux Programming Interface
System Programming Concepts 57 void cmdLineErr(const char *format, ...) { va_list argList; fflush(stdout); / Flush any pending s ...
58 Chapter 3 Listing 3-4: Linux error names (x86-32 version) ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– lib/ena ...
System Programming Concepts 59 If the name argument is non-NULL, it should contain a string identifying the argu- ment in arg. T ...
60 Chapter 3 static void gnFail(const char *fname, const char *msg, const char *arg, const char *name) { fprintf(stderr, "%s err ...
System Programming Concepts 61 if (res > INT_MAX || res < INT_MIN) gnFail("getInt", "integer out of range", arg, name); re ...
62 Chapter 3 glibc headers don’t interpret the value 200112 for _POSIX_C_SOURCE.) If defined with the value 200809, also expose ...
System Programming Concepts 63 _POSIX_C_SOURCE, _XOPEN_SOURCE, and POSIX.1/SUS Only the _POSIX_C_SOURCE and _XOPEN_SOURCE featur ...
64 Chapter 3 Each of these types is defined using the C typedef feature. For example, the pid_t data type is intended for repres ...
System Programming Concepts 65 When discussing the data types in Table 3-1 in later chapters, we’ll often make statements that s ...
66 Chapter 3 Printing system data type values When printing values of one of the numeric system data types shown in Table 3-1 (e ...
System Programming Concepts 67 Although SUSv3 specifies structures such as sembuf, it is important to realize the following: z I ...
68 Chapter 3 is not required on Linux or by SUSv3, but because some other (especially older) implementations may require it, we ...
Chapter 4: File I/O: The Universal I/O Model................................................................. I/O MODEL We now s ...
70 Chapter 4 behalf by the shell, before the program is started. Or, more precisely, the program inherits copies of the shell’s ...
File I/O: The Universal I/O Model 71 We can use the program in Listing 4-1 as follows: $ ./copy oldfile newfile Listing 4-1: Usi ...
72 Chapter 4 4.2 Universality of I/O One of the distinguishing features of the UNIX I/O model is the concept of universality of ...
File I/O: The Universal I/O Model 73 We describe file permissions in detail in Section 15.4. Later, we’ll see that the per- miss ...
74 Chapter 4 if (close(STDIN_FILENO) == -1) /* Close file descriptor 0 */ errExit("close"); fd = open(pathname, O_RDONLY); if (f ...
File I/O: The Universal I/O Model 75 The constants in Table 4-3 are divided into the following groups: z File access mode flags: ...
76 Chapter 4 could result in open file descriptors being unintentionally passed to unsafe programs. (We say more about race cond ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf