Having passed through inprocess with an ordinary character under ordinary

Having passed through inprocess with an ordinary

This preview shows page 45 - 47 out of 140 pages.

causes an immediate return. Having passed through in_process with an ordinary character under ordinary conditions, let us now go back to the start of in_process and look at what happens in less ordinary circumstances. First, we will look at the character escape, which allows a character which
Image of page 45
ordinarily has a special effect to be passed on to the user process. If a character escape is in effect, the tp->tty_escaped flag is set, and when this is detected (on line 14510) the flag is reset immediately and the IN_ESC bit, bit V in Fig. 3-40, is added to the current character. This causes special processing when the character is echoedescaped control characters are displayed as "^" plus the character to make them visible. The IN_ESC bit also prevents the character from being recognized by tests for special characters. The next few lines process the escape character itself, the LNEXT character (CTRL-V by default). When the LNEXT code is detected the tp->tty_escaped flag is set, and rawecho is called twice to output a "^'' followed by a backspace. This reminds the user at the keyboard that an escape is in effect, and when the following character is echoed, it overwrites the "^''. The LNEXT character is an example of one that affects later characters (in this case, only the very next character). It is not placed in the queue, and the loop restarts after the two calls to rawecho. The order of these two tests is important, making it possible to enter the LNEXT character itself twice in a row, in order to pass the second copy on to a process as actual data. [Page 346] The next special character processed by in_process is the REPRINT character (CTRL-R). When it is found a call to reprint ensues (line 14525), causing the current echoed output to be redisplayed. The REPRINT itself is then discarded with no effect upon the input queue. Going into detail on the handling of every special character would be tedious, and the source code of in_process is straightforward. We will mention just a few more points. One is that the use of special bits in the high byte of the 16-bit value placed in the input queue makes it easy to identify a class of characters that have similar effects. Thus, EOT (CTRL-D), LF, and the alternate EOL character (undefined by default) are all marked by the EOT bit, bit D in Fig. 3-40 (lines 14566 to 14573), making later recognition easy. Finally, we will justify the peculiar behavior of in_transfer noted earlier.A reply is not generated each time it terminates, although in the calls to in_transfer we have seen previously, it seemed that a reply would always be generated upon return. Recall that the call to in_transfer made by in_process when the input queue is full (line 14639) has no effect when canonical mode is in effect. But if noncanonical processing is desired, every character is marked with the EOT bit on line 14618, and thus every character is counted by tp->tty_eotct on line 14636. In turn, this causes entry into the main loop of in_transfer when it is called because of a full input queue in noncanonical mode. On such occasions
Image of page 46
Image of page 47

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