During noncanonical input ttyeotct counts characters and ttymin is set from the

During noncanonical input ttyeotct counts characters

This preview shows page 32 - 34 out of 140 pages.

lines entered. During noncanonical input, tty_eotct counts characters and tty_min is set from the MIN field of the termios structure. The comparison of the two variables thus tells when a line is ready or when the minimum character count is reached, depending upon the mode. Tty_tmr is a timer for this tty, used for the TIME field of termios. Since queueing of output is handled by the device-specific code, the output section of tty declares no variables and consists entirely of pointers to devicespecific functions that write, echo, send a break signal, and cancel output. In the status section the flags tty_reprint, tty_escaped, and tty_inhibited indicate that the last character seen has a special meaning; for instance, when a CTRL-V (LNEXT) character is seen, tty_escaped is set to 1 to indicate that any special meaning of the next character is to be ignored. The next part of the structure holds data about DEV_READ, DEV_WRITE, and DEV_IOCTL operations in progress. There are two processes involved in each of these operations. The server managing the system call (normally FS) is identified in tty_incaller (line 13458). The server calls the tty driver on behalf of another process that needs to do an I/O operation, and this client is identified in tty_inproc (line 13459). As described in Fig. 3-33, during a read , characters are transferred directly from the terminal
Image of page 32
driver to a buffer within the memory space of the original caller. Tty_inproc and tty_in_vir locate this buffer. The next two variables, tty_inleft and tty_incum, count the characters still needed and those already transferred. Similar sets of variables are needed for a write system call. For ioctl there may be an immediate transfer of data between the requesting process and the driver, so a virtual address is needed, but there is no need for variables to mark the progress of an operation. An ioctl request may be postponed, for instance, until current output is complete, but when the time is right the request is carried out in a single operation. [Page 333] Finally, the tty structure includes some variables that fall into no other category, including pointers to the functions to handle the DEV_IOCTL and DEV_CLOSE operations at the device level, a POSIX-style termios structure, and a winsize structure that provides support for window-oriented screen displays. The last part of the structure provides storage for the input queue itself in the array tty_inbuf. Note that this is an array of u16_t, not of 8-bit char characters. Although applications and devices use 8-bit codes for characters, the C language requires the input function getchar to work with a larger data type so it can return a symbolic EOF value in addition to all 256 possible byte values. The tty_table, an array of tty structures, is declared as extern on line 13491. There is one array element for each terminal enabled by the NR_CONS, NR_RS_LINES, and NR_PTYS definitions in include/minix/config.h. For the configuration discussed in this book, two consoles are enabled, but MINIX 3 may be recompiled to add additional virtual consoles, one or two 2 serial lines, and up to 64 pseudo terminals.
Image of page 33
Image of page 34

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20
  • ASCII

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes