Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] - نسخه متنی

W. Richard Stevens; Stephen A. Rago

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






  • Exercises


    19.1

    When we remotely log in to a BSD system using either telnet or rlogin, the ownership of the PTY slave and its permissions are set, as we described in

    Section 19.3.2

    How does this happen?

    Figure 19.9

    to invoke a set-user-ID program to change the ownership and protection of the PTY slave device on a BSD system (similar to what the Solaris version of the grantpt function does).

    19.3

    Use the pty program to determine the values used by your system to initialize a slave PTY's termios structure and winsize structure.

    Figure 19.13

    as a single process using either select or poll.

    19.5

    In the child process after pty_fork returns, standard input, standard output, and standard error are all open for readwrite. Can you change standard input to be read-only and the other two to be write-only?

    19.6

    In Figure 19.14, identify which process groups are foreground and which are background, and identify the session leaders.

    19.7

    In Figure 19.14, in what order do the processes terminate when we type the end-of-file character? Verify this with process accounting, if possible.

    19.8

    The script(1) program normally adds to the beginning of the output file a line with the starting time, and to the end of the output file another line with the ending time. Add these features to the simple shell script that we showed.

    19.9

    Explain why the contents of the file data are output to the terminal in the following example, when the program ttyname only generates output and never reads its input.


    $

    cat data

    a file with two lines
    hello,
    world
    $

    pty -i < data ttyname

    -i says ignore eof on stdin
    hello,

    where did these two lines come from?
    world
    fd 0: /dev/ttyp5

    we expect these three lines from ttyname
    fd 1: /dev/ttyp5
    fd 2: /dev/ttyp5

    Section 19.7

    Read back from the slave to verify that the signal was caught. Follow this with the parent setting the window size of the PTY slave and read back the slave's output again. Have the parent exit and determine whether the slave process also terminates; if so, how does it terminate?


  • / 369