However if the user wants to slow the process in order to review the data on

However if the user wants to slow the process in

This preview shows page 59 - 61 out of 140 pages.

all the data requested in the original call. However, if the user wants to slow the process in order to review the data on the screen, he may enter a STOP (CTRL-S) character at the keyboard, resulting in raising of the tp->tty_inhibited flag. Cons_write returns immediately when this flag is raised, even though the write has not been completed. In such a case handle_events will continue to call cons_write, and when tp->tty_inhibited is finally reset, by the user entering a START (CTRL-Q) character, cons_write continues with the interrupted transfer. Cons_write's first argument is a pointer to the particular console's tty structure, so the first thing that must be done is to initialize cons, the pointer to this console's console structure (line 16049). Then, because handle_events calls cons_write whenever it runs, the first action is a test to see if there really is work to be done. A quick return is made if not (line 16056). Following this the main loop on lines 16061 to 16089 is entered. This loop is
Image of page 59
similar in structure to the main loop of in_transfer in tty.c. A local buffer that can hold 64 characters is filled by using the sys_vircopy kernel call to get the data from the client's buffer. Following this, the pointer to the source and the counts are updated, and then each character in the local buffer is transferred to the cons->c_ramqueue array, along with an attribute byte, for later transfer to the screen by flush. [Page 359] The transfer of characters from cons->c_ramqueue can be done in more than one way, as we saw in Fig. 3-35. Out_char can be called to do this for each character, but it is predictable that none of the special services of out_char will be needed if the character is a visible character, an escape sequence is not in progress, the screen width has not been exceeded, and cons->c_ramqueue is not full. If the full service of out_char is not needed, the character is placed directly into cons->c_ramqueue, along with the attribute byte (which is retrieved from cons->c_attr), and cons->c_rwords (which is the index into the queue), cons->c_column (which keeps track of the column on the screen), and tbuf, the pointer into the buffer, are all incremented. This direct placement of characters into cons- >c_ramqueue corresponds to the dashed line on the left side of Fig. 3-35. If needed, out_char is called (line 16082). It does all of the bookkeeping, and additionally calls flush, which does the final transfer to screen memory, when necessary. The transfer from the user buffer to the local buffer to the queue is repeated as long as tp- >tty_outleft indicates there are still characters to be transferred and the flag tp- >tty_inhibited has not been raised. When the transfer stops, whether because the write operation is complete or because tp->tty_inhibited has been raised, flush is called again to transfer the last characters in the queue to screen memory. If the operation is complete (tested by seeing if tp-->tty_outleft is zero), a reply message is sent by calling tty_reply lines 16096 and 16097).
Image of page 60
Image of page 61

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors