File System Objects

Modern UNIX file systems support the following types of file system objects:

  • Regular Files (S_IFREG)

  • Directories (S_IFDIR)

  • Character Devices (S_IFCHR)

  • Block Devices (S_IFBLK)

  • Named Pipes (S_IFIFO)

  • Sockets (S_IFSOCK)

  • Symbolic Links (S_IFLNK)

The C macro names given within parentheses are provided by the include file <sys/stat.h> (see stat(2)). You'll see more of these in Chapter 6, "Managing Files and Their Properties."

Regular Files

A regular file is generally what is most important to users of a system. It stores the data that the user wants to retrieve and work with at a later time. The UNIX file system presents this data as a continuous stream of bytes.

A regular file consists of any number of data bytes, from zero to some ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.