pipe_inode_info: Contains generic state information about the pipe with fields such as base (which
points to the kernel buffer), len (which represents the number of bytes written into the buffer and yet to be
read), wait (which represents the wait queue), and start (which points to the read position in the kernel
buffer).
do_pipe(): Invoked through the pipe() system call, do_pipe() creates a pipe that performs the
following actions:
1. Allocates and initializes an inode.
2. Allocates a pipe_inode_info structure and stores its address in the i_pipe field of the
inode.
3. Allocates a page-frame buffer for the pipe buffer using __get_free_page(), which in turn
invokes alloc_pages() for the page allocation. Even though the allocated page is not
explicitly zeroed-out, because of the way pipe_read() and pipe_write() are written, it
is not possible to read beyond what the write channel writes. Therefore, there are no object reuse
issues.
pipe_read(): Invoked through the read() system call, pipe_read() reads the pipe buffer that the
base field of the pipe_info structure points to.
pipe_write(): Invoked through the write() system call, pipe_write() writes in the pipe buffer
pointed to by the base field of the pipe_info structure.
Because unnamed pipes can only be used by a process and its descendants that share file descriptors, there are
no DAC issues.
5.3.2 First-In First-Out Named pipes
A First-In First-Out (FIFO) named pipe is very similar to the unnamed pipe described in Section 5.3.1. Unlike
the unnamed pipe, a FIFO has an entry in the disk-based file system. A large portion of the internal
implementation of a FIFO pipe is identical to that of the unnamed pipe. Both use the same data structure,
pipe_inode_info, and the pipe_read() and pipe_write() routines. The only differences are that
FIFOs are visible on the system directory tree and are a bi-directional communication channel. Access
control on named pipes is also performed using interaction of processes with file descriptors in a similar
manner as for those of access control on regular files, as explained in Section 5.1.5 (DAC).

5.3.2.1 FIFO creation

FIFO exists as a persistent directory entry on the system directory tree. A FIFO is created with the VFS
mknod() system call, as follows:
1. The mknod() call uses the path name translation routines to obtain the dentry object of the
directory where the FIFO is to be created, and then invokes vfs_mknod().
2. The vfs_mknod() call crosses over to the disk-based file system layer by invoking the disk-based
file system version of mknod (ext3_mknod()) through the inode operations vector i_op.
3. A special FIFO inode is created and initialized. The file operation vector of the inode is set to
def_fifo_fops by a call to function init_special_inode(). The only valid file operation
in def_fifo_fops is fifo_open().
The creator of the FIFO becomes its owner. This ownership can be transferred to another user using the
chown() system call. The owner and root user are allowed to define and modify access rights associated
with the FIFO.
63