| 
                  UNIX File Descriptors
                   An Introduction  | 
            
| 
                   
                      
                     Prof. David Bernstein
                       | 
            
| Computer Science Department | 
| bernstdh@jmu.edu | 
               
            
         
            
         
         
            
         
         
            
         
         
            
         dup())
              open() is called multiple
              times for the same file)errno
         
         
            
         
                           EBADF
                         | 
                        
                           fd isn't a valid open file descriptor | 
                     
                           EMFILE
                         | 
                        The per-process limit has been reached | 
         
            
         
         
            
         /dev/fd:
      /dev/fd/n
                         where n is one of the
              process's open file descriptors/dev/fd is
              equivalent to reopening the oritinal file/dev/fd is
              equivalent to calling dup()
                     /dev/stdin, /dev/stdout, and
              /dev/stderr are symbolic links to
              /dev/fd/0, /dev/fd/1, and
              /dev/fd/2
                     
         
            
         FILE*
              not a file descriptorFILE* (i.e.,
              stream) with a file descriptor