Files and Directories [POSIX Section 5]

Functions Implemented

DIR *opendir( const char *dirname ); 
struct dirent *readdir( DIR *dirp ); 
int readdir_r( DIR *dirp, struct dirent *entry,
               struct dirent **result ); 
void rewinddir( DIR *dirp ); 
int closedir( DIR *dirp ); 
int chdir( const char *path ); 
char *getcwd( char *buf, size_t size );
int open( const char * path , int oflag , ... ); 
int creat( const char * path, mode_t mode ); 
int link( const char *existing, const char *new ); 
int mkdir( const char *path, mode_t mode ); 
int unlink( const char *path ); 
int rmdir( const char *path ); 
int rename( const char *old, const char *new ); 
int stat( const char *path, struct stat *buf ); 
int fstat( int fd, struct stat *buf ); 
int access( const char *path, int amode ); 
long pathconf(const char *path, int name); 
long fpathconf(int fd, int name);

Functions Omitted

mode_t umask( mode_t cmask ); 
int mkfifo( const char *path, mode_t mode ); 
int chmod( const char *path, mode_t mode );			// TBA 
int fchmod( int fd, mode_t mode );				// TBA 
int chown( const char *path, uid_t owner, gid_t group ); 
int utime( const char *path, const struct utimbuf *times );	// TBA 
int ftruncate( int fd, off_t length );                          // TBA


  • If a call to open() or creat() supplies the third _mode_ parameter, it will currently be ignored.

  • Most of the functionality of these functions depends on the underlying filesystem.

  • Currently access() only checks the F_OK mode explicitly, the others are all assumed to be true by default.

  • The maximum number of open files allowed is supplied by the CYGNUM_FILEIO_NFILE option. The maximum number of file descriptors is supplied by the CYGNUM_FILEIO_NFD option.

Documentation license for this page: Open Publication License