ABSTRACT

This chapter explains the concept of system programming, file descriptors in Linux, several system calls and C library functions for manipulating directories and file attributes. It discusses the execution details of a system call in Linux, the concept of per-process file descriptor tables, system wide file tables, and inode tables. Linux provides two application programming interface (API) for software development: the language libraries and the System call interface (SCI). The chapter also discusses the concept of file holes in Linux, several small programs to illustrate the use of various system calls for the input/output (I/O) and management of file data and attributes, and the concept of blocking I/O and restarting a system call. It covers the following system calls, library calls, and primitives: access(), chdir(), chmod(), chown(), close(), closedir(), creat(), fclose(), fopen(), fread(), fstat(), fwrite(), lseek(), lstat(), mkdir(), opendir(), printf(), read(), readdir(), rename(), rewinddir(), seekdir(), stat(), telldir(), truncate(), umask(), unlink(), utime(), write().