DEVFD

Section: Devices and Network Interfaces (4)
Updated: 5 December 1995
Index Return to Main Contents
 

NAME

/dev/fd/#, /dev/stdin, /dev/stdout, /dev/stderr - file descriptor files  

SYNOPSIS

pseudo-device devfd15  

DESCRIPTION

The files /dev/fd/0 through /dev/fd/15 refer to file descriptors which can be accessed through the file system. We are limited to File Descriptor 15 because of a Kernel Bug in NeXTSTEP 3.3 which causes a panic when `/usr/etc/mknod /dev/fd/16 c 1 16' is performed (don't try this at home kiddys). The driver can accept up to descriptor 255 if you wish to risk making your own nodes, or wish to expand the limit in the PostLoader. If the file descriptor is open and the mode the file is being opened with is a subset of the mode of the existing descriptor, the call:

fd = open("/dev/fd/n", mode);

and the call:

fd = fcntl(n, F_DUPFD, 0);

are equivalent.

Opening the files /dev/stdin , /dev/stdout and /dev/stderr is equivalent to the following calls:

fd = fcntl(0, F_DUPFD, 0);
fd = fcntl(1, F_DUPFD, 0);
fd = fcntl(2, F_DUPFD, 0);

Flags to the open(2) call other than O_RDONLY , O_WRONLY and O_RDWR are ignored.  

FILES

/dev/fd/#
/dev/stdin
/dev/stdout
/dev/stderr
 

SEE ALSO

tty(4)  

DIAGNOSTICS

/dev/fd/n: Bad file number

File descriptor n wasn't open before trying to open /dev/fd/n.

/dev/fd/n: Permission denied

Requested mode isn't a subset of the mode of the existing descriptor.  

HISTORY

Derived from the /dev/fd driver written for V7 UNIX I wrote in a previous life.


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILES
SEE ALSO
DIAGNOSTICS
HISTORY

This document was created by man2html, using the manual pages.
Time: 06:10:54 GMT, November 13, 2022