Nonetheless the simplicity of process based designs

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rence between text files and binary files. A directory file contains information about other files. And a socket is a file that is used to communicate with another process across a network. Unix provides macro predicates for determining the file type. Figure 12.18 shows a subset. Each file type macro takes an st mode member as its argument. Macro S ISREG() S ISDIR() Description Is this a regular file? Is this a directory file? Figure 12.18: Some macros for determining the type of file. Defined in sys/stat.h 626 CHAPTER 12. NETWORK PROGRAMMING The protection bits in st mode can be tested using the bit masks in Figure 12.19. For example, the followst mode mask S IRUSR S IWUSR S IXUSR S IRGRP S IWGRP S IXGRP S IROTH S IWOTH S IXOTH Description User (owner) can read this file User (owner) can write this file User (owner) can execute this file Group members can read this file Group members can write this file Group members can execute this file Others (anyone) can read this file Others (anyone) can write this file Others (anyone) can execute this file Figure 12.19: Masks for checking protection bits. Defined in sys/stat.h ing code fragment checks if the current process has permiss...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online