*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> fd (4)              



NAME    [Toc]    [Back]

       fd - file descriptor files

DESCRIPTION    [Toc]    [Back]

       The  /dev/fd  file  system is a pseudo-file system layered
       beneath the Virtual File System (VFS).  The file  descriptor
  files  (fd*)  are  those  files  that  are accessible
       through file descriptors.  The file  descriptors  use  the
       naming  convention  /dev/fd/0, /dev/fd/1, /dev/fd/2 and so
       on up to any number.

       To make the /dev/fd file system  known  to  the  operating
       system,  you  must  create  the directory with the correct
       privileges, then you must mount the file system.  The following
  steps  describe how to create the directory, mount
       the file system both manually and automatically,  and  how
       to  dismount  the  file system: Create the directory using
       the mkdir and chmod commands:  mkdir  /dev/fd;  chmod  777
       /dev/fd  Mount  the  file  system manually using the mount
       command: mount -t fdfs /dev/fd /dev/fd Mount the file system
 automatically by editing either the /etc/fstab file or
       the /sbin/bcheckrc file.

              Add the following entry  to  the  /etc/fstab  file:
              /dev/fd  /dev/fd  fdfs rw 0 0 This entry mounts the
              pseudodevice /dev/fd on the /dev/fd directory  with
              read/write  privileges.   The  file  system type is
              fdfs and the zeros  (0)  in  the  remaining  fields
              specify that the file system is not to be backed up
              nor can file system checks be performed by the fsck
              command as this is a virtual file system.

              Add the following entry to the /sbin/bcheckrc file:
              # # mount fdfs # echo 'Mounting /dev/fd filesystem'
              /sbin/mount  -a  -v -t fdfs Again, the /dev/fd file
              system should not be mounted in this manner  if  an
              entire  system is to be backed up starting from the
              root directory.  Dismount the file system using the
              umount  command:  umount  /dev/fd For correct truncate()
 behavior on fd files,  you  must  load  your
              program using the -lsys5 flag.

RESTRICTIONS    [Toc]    [Back]

       The /dev/fd file descriptors should not be exported.

EXAMPLES    [Toc]    [Back]

       The  following example show how the open and dup functions
       have the same effect if file descriptor n is opened:

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

       In the above example, the open function is  equal  to  the
       creat  function  and mode is ignored.  Using the dup function,
 subsequent reads or writes on the fd file descriptor
       files fail unless the original file descriptor enables the

ERRORS    [Toc]    [Back]

       The following error condition exists: The file  descriptor
       is not valid.


       Commands: chmod(1), mkdir(1), mount(8).

       Functions: creat(2), dup(2), open(2).  delim off

[ Back ]
 Similar pages
Name OS Title
pxfisatty IRIX Determines if file descriptor corresponds to a valid file descriptor
fattach Tru64 Attach a STREAMS-based file descriptor to a file in the file system name space
fdetach Tru64 Detach a STREAMS-based file descriptor from a file in the file system name space
AFopenfile IRIX allocate an AFfilehandle structure for an audio file identified by name / by a Unix file descriptor
AFidentifyfd IRIX retrieve the audio file format of a file descriptor / open AFfilehandle
AFgetfd IRIX get the Unix file descriptor for the file associated with an AFfilehandle structure
acl_set_fd Tru64 Sets the ACL on the file or directory designated by the file descriptor
isfdtype Tru64 Test a file descriptor for a specific file type
isastream Tru64 Determine if a file descriptor refers to a STREAMS file
fdetach Tru64 Detaches a STREAMS-based file descriptor from a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service