The Linux Programming Interface
File Locking 1137 The semantics of fcntl() lock inheritance and release are an architectural blem- ish. For example, they make t ...
1138 Chapter 55 Linux, like many other UNIX implementations, also allows fcntl() record locks to be mandatory. This means that e ...
File Locking 1139 in blocking mode, the system call blocks. If the file was opened with the O_NONBLOCK flag, the system call imm ...
1140 Chapter 55 Mandatory locking caveats Mandatory locks do less for us than we might at first expect, and have some poten- tia ...
File Locking 1141 The type of lock, either READ or WRITE (corresponding to shared and exclusive locks for fcntl()). The process ...
1142 Chapter 55 is employing a technique to ensure that only one instance of the daemon is run- ning at a time. We describe this ...
File Locking 1143 process ID of the daemon. It also allows an extra sanity checkâwe can verify whether that process ID exists us ...
1144 Chapter 55 int createPidFile(const char *progName, const char *pidFile, int flags) { int fd; char buf[BUF_SIZE]; fd = open( ...
File Locking 1145 open(file, O_CREAT | O_EXCL,...) plus unlink(file) SUSv3 requires that an open() call with the flags O_CREAT a ...
1146 Chapter 55 If the link() call succeeds, we have obtained the lock. If it fails (EEXIST), then another process has the lock ...
File Locking 1147 locking on Linux are provided in [Bovet & Cesati, 2005]. [Tanenbaum, 2007] and [Deitel et al., 2004] descr ...
1148 Chapter 55 55-7. If you have access to other UNIX implementations, use the program in Listing 55-2 (i_fcntl_locking.c) to s ...
Chapter 56: Sockets: Introduction Sockets are a method of IPC that allow data to be exchanged between applications, either on th ...
1150 Chapter 56 z Chapter 60 discusses the design of servers that use sockets. z Chapter 61 covers a range of advanced topics, i ...
Sockets: Introduction 1151 In some code, we may see constants with names such as PF_UNIX instead of AF_UNIX. In this context, AF ...
1152 Chapter 56 A stream socket is similar to using a pair of pipes to allow bidirectional communica- tion between two applicati ...
Sockets: Introduction 1153 Socket I/O can be performed using the conventional read() and write() system calls, or using a range ...
1154 Chapter 56 The sockfd argument is a file descriptor obtained from a previous call to socket(). The addr argument is a point ...
Sockets: Introduction 1155 If we define the _GNU_SOURCE feature test macro, then glibc prototypes the various socket system call ...
1156 Chapter 56 In most applications that employ stream sockets, the server performs the passive open, and the client performs t ...
«
55
56
57
58
59
60
61
62
63
64
»
Free download pdf