Skip to Content
UNIX Filesystems: Evolution, Design, and Implementation
book

UNIX Filesystems: Evolution, Design, and Implementation

by Steve D. Pate
January 2003
Intermediate to advanced content levelIntermediate to advanced
480 pages
13h 22m
English
Wiley
Content preview from UNIX Filesystems: Evolution, Design, and Implementation

Duplicate File Descriptors

The section File Descriptors, in Chapter 2, introduced the concept of file descriptors. Typically a file descriptor is returned in response to an open() or creat() system call. The dup() system call allows a user to duplicate an existing open file descriptor.

#include <unistd.h>

int dup(int fildes);

There are a number of uses for dup() that are really beyond the scope of this book. However, the shell often uses dup() when connecting the input and output streams of processes via pipes.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Design and Implementation of the FreeBSD Operating System, 2nd Edition

Design and Implementation of the FreeBSD Operating System, 2nd Edition

Marshall Kirk McKusick, George V. Neville-Neil, Robert N.M. Watson

Publisher Resources

ISBN: 9780471456759Purchase book