Team BBL
Previous Page Next Page

Chapter 1

1.1

For this exercise, we use the following two arguments for the ls(1) command: -i prints the i-node number of the file or directory (we say more about i-nodes in Section 4.14), and -d prints information about a directory instead of information on all the files in the directory.

Execute the following:

   $ ls -ldi /etc/. /etc/..            -i says print i-node number
    162561 drwxr-xr-x  66 root     4096 Feb  5 03:59 /etc/./
         2 drwxr-xr-x  19 root     4096 Jan 15 07:25 /etc/../
   $ ls -ldi /. /..                    both . and .. have i-node number 2
         2 drwxr-xr-x  19 root     4096 Jan 15 07:25 /./
         2 drwxr-xr-x  19 root     4096 Jan 15 07:25 /../

1.2

The UNIX System is a multiprogramming, or multitasking, system. Other processes were running at the time this program was run.

1.3

Since the ptr argument to perror is a pointer, perror could modify the string that ptr points to. The qualifier const, however, says that perror does not modify what the pointer points to. On the other hand, the error number argument to strerror is an integer, and since C passes all arguments by value, the strerror function couldn't modify this value even if it wanted to. (If the handling of function arguments in C is not clear, you should review Section 5.2 of Kernighan and Ritchie [1988].)

1.4

It is possible for the calls to fflush, fprintf, and vprintf to modify errno. If they did modify its value and we didn't save it, the error message finally printed would be incorrect.

1.5

During the year 2038. We can solve the problem by making the time_t data type a 64-bit integer. If it is currently a 32-bit integer, applications will have to be recompiled to work properly. But the problem is worse. Some file systems and backup media store times in 32-bit integers. These would need to be updated as well, but we still need to be able to read the old format.

1.6

Approximately 248 days.

    Team BBL
    Previous Page Next Page