Directory System Call Support¶
Functions¶
-
DIR *opendir(const char *name)¶
Open a directory.
- Parameters
name – [in] Directory path to open
- Returns
a pointer to the directory stream. On error, NULL is returned, and errno is set appropriately.
-
struct dirent *readdir(DIR *dirp)¶
Read a directory.
- Parameters
dirp – [in] directory stream provided by opendir
- Returns
On success, a pointer to a dirent structure. (This structure may be statically allocated; do not attempt to free it.)
-
long telldir(DIR *dirp)¶
return current location in directory stream. This function may not supported by all filesystem drivers
- Parameters
dirp – [in] directory stream provided by opendir
- Returns
On success, function returns the current location in the directory stream. On error, -1 is returned, and errno is set appropriately
-
void rewinddir(DIR *dirp)¶
reset directory stream. This function may not supported by all filesystem drivers
- Parameters
dirp – [in] directory stream provided by opendir
Structures¶
-
struct dirent¶
Directory entry structure
Type Definitions¶
-
typedef void DIR¶
Directory stream pointer type
Enumerations¶
-
enum _dtype_e¶
File type flags for d_type
Values:
-
enumerator DT_UNKNOWN¶
The file type could not be determined
-
enumerator DT_FIFO¶
FIFO File type
-
enumerator DT_CHR¶
Special file type: Character device
-
enumerator DT_DIR¶
Directory
-
enumerator DT_BLK¶
Special file type: Block device
-
enumerator DT_REG¶
Regular File type
-
enumerator DT_LNK¶
File is a symbolic link
-
enumerator DT_SOCK¶
File is a UNIX domain socket
-
enumerator DT_UNKNOWN¶
