The Linux Programming Interface
Terminals 1317 For example, to find out the current terminal output line speed, we would do the following: struct termios tp; sp ...
1318 Chapter 62 In each function, fd is a file descriptor that refers to a terminal or other remote device on a serial line. The ...
Terminals 1319 62.9 Terminal Window Size In a windowing environment, a screen-handling application needs to be able to monitor t ...
1320 Chapter 62 Listing 62-5: Monitoring changes in the terminal window size ––––––––––––––––––––––––––––––––––––––––––––––––––– ...
Terminals 1321 Note, however, that these events on their own are insufficient to change the actual dimensions of the displayed w ...
1322 Chapter 62 62.11 Summary On early UNIX systems, terminals were real hardware devices connected to a computer via serial lin ...
Terminals 1323 62.12 Exercises 62-1. Implement isatty(). (You may find it useful to read the description of tcgetattr() in Secti ...
...
ALTERNATIVE I/O MODELS This chapter discusses three alternatives to the conventional file I/O model that we have employed in mos ...
1326 Chapter 63 Disk files are a special case. As described in Chapter 13, the kernel employs the buffer cache to speed disk I/O ...
Alternative I/O Models 1327 Because of the limitations of both nonblocking I/O and the use of multiple threads or processes, one ...
1328 Chapter 63 Which technique? During the course of this chapter, we’ll consider the reasons we may choose one of these techni ...
Alternative I/O Models 1329 63.1.1 Level-Triggered and Edge-Triggered Notification Before discussing the various alternative I/O ...
1330 Chapter 63 starve other file descriptors of attention if we perform a large amount of I/O on one file descriptor. We consid ...
Alternative I/O Models 1331 We can use select() and poll() to monitor file descriptors for regular files, termi- nals, pseudoter ...
1332 Chapter 63 These macros operate as follows: z FD_ZERO() initializes the set pointed to by fdset to be empty. z FD_SET() add ...
Alternative I/O Models 1333 The timeout argument The timeout argument controls the blocking behavior of select(). It can be spec ...
1334 Chapter 63 If we use the Linux-specific personality() system call to set a personality that includes the STICKY_TIMEOUTS pe ...
Alternative I/O Models 1335 int main(int argc, char argv[]) { fd_set readfds, writefds; int ready, nfds, fd, numRead, j; struct ...
1336 Chapter 63 for (fd = 0; fd < nfds; fd++) printf("%d: %s%s\n", fd, FD_ISSET(fd, &readfds)? "r" : "", FD_ISSET(fd, &am ...
«
64
65
66
67
68
69
70
71
72
73
»
Free download pdf