Miscellaneous System Calls

Miscellaneous System Calls

Various other system calls exist as well. We will consider just four of them here. The chdir call changes the current working directory. After the call


an open on the file xyz will open /usr/ast/test/xyz. The idea of a working directory eliminates the need for typing (long) complete path names all the time.   

In UNIX every file has a mode used for protection. The mode contains the read-write-execute bits for the owner, group, and others. The chmod  system call makes it possible to change the mode of a file. For instance, to make a file readonly by everyone except the owner, one could execute

    chmod("file", 0644);

The kill system call is the way users and user processes send signals. If a process is prepared to catch a particular signal, then when it arrives, a signal handler is run. If the process is not prepared to handle a signal, then its arrival kills the process (hence the name of the call).

POSIX defines several procedures for dealing with time. For instance, time just returns the current time in seconds, with 0 corresponding to Jan.1, 1970 at midnight (just as the day was starting, not ending). On computers using 32-bit words, the maximum value time can return is 232 - 1 seconds (assuming an unsigned integer is used). This value corresponds to a little over 136 years. Thus in the year 2106, 32-bit UNIX systems  will go berserk, not unlike the famous Y2K problem that would have wreaked havoc with the world's computers in 2000, were it not for the  huge effort the IT industry put into fixing the problem. If you currently have a 32-bit UNIX system, you are advised to trade it in for a 64-bit one sometime before the year 2106.


system calls, process, unix