|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
POSIX-standard APIs for managing the filesystem More...
Files | |
| file | libgen.h |
| Definitions for pattern matching functions. | |
| file | dirent.h |
| Directory entry functionality. | |
| file | ioctl.h |
| Header for terminal control operations. | |
| file | uio.h |
| Header for vector I/O. | |
Data Structures | |
| struct | dirent |
| POSIX directory entry structure. More... | |
| struct | DIR |
| Type representing a directory stream. More... | |
| struct | iovec |
| I/O vector structure. More... | |
Macros | |
| #define | UIO_MAXIOV IOV_MAX |
| Old alias for the maximum length of an iovec. | |
Functions | |
| char * | basename (char *path) |
| Get the last component of a pathname. | |
| char * | dirname (char *path) |
| Get the parent directory of a file pathname. | |
| DIR * | opendir (const char *name) |
| Open a directory based on the specified name. | |
| int | closedir (DIR *dir) |
| Closes a directory that was previously opened. | |
| struct dirent * | readdir (DIR *dir) |
| Read an entry from a directory stream. | |
| int | dirfd (DIR *dirp) |
| Retrieve the file descriptor of an opened directory stream. | |
| void | rewinddir (DIR *dir) |
| Rewind a directory stream to the start of the directory. | |
| int | scandir (const char *__RESTRICT dir, struct dirent ***__RESTRICT namelist, int(*filter)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **)) |
| Scan, filter, and sort files within a directory. | |
| int | alphasort (const struct dirent **a, const struct dirent **b) |
| Comparison function for sorting directory entries alphabetically. | |
| void | seekdir (DIR *dir, off_t offset) |
| Not implemented. | |
| off_t | telldir (DIR *dir) |
| Not implemented. | |
Directory File Types | |
POSIX file types for dirent::d_type
| |
| #define | DT_UNKNOWN 0 |
| Unknown. | |
| #define | DT_FIFO 1 |
| Named Pipe or FIFO. | |
| #define | DT_CHR 2 |
| Character Device. | |
| #define | DT_DIR 4 |
| Directory. | |
| #define | DT_BLK 6 |
| Block Device. | |
| #define | DT_REG 8 |
| Regular File. | |
| #define | DT_LNK 10 |
| Symbolic Link. | |
| #define | DT_SOCK 12 |
| Local-Domain Socket. | |
| #define | DT_WHT 14 |
| Whiteout (ignored) | |
POSIX-standard APIs for managing the filesystem
| #define DT_BLK 6 |
Block Device.
| #define DT_CHR 2 |
Character Device.
| #define DT_DIR 4 |
Directory.
Referenced by browse_directory().
| #define DT_FIFO 1 |
Named Pipe or FIFO.
| #define DT_LNK 10 |
Symbolic Link.
| #define DT_REG 8 |
Regular File.
| #define DT_SOCK 12 |
Local-Domain Socket.
| #define DT_UNKNOWN 0 |
Unknown.
| #define DT_WHT 14 |
Whiteout (ignored)
| #define UIO_MAXIOV IOV_MAX |
Old alias for the maximum length of an iovec.
Comparison function for sorting directory entries alphabetically.
Sorts two directory entries, a and b in alphabetical order.
| a | The first directory entry to sort |
| b | The second directory entry to sort |
| Returns | an integer value greater than, equal to, or less than zero, depending on whether the name of the directory entry pointed to by a is lexically greater than, equal to, or less than the directory entry pointed to by b. |
| char * basename | ( | char * | path | ) |
Get the last component of a pathname.
This function retrieves the basename from a given path. The basename of a path is the non-directory component thereof, minus any trailing '/' characters. This function does not attempt to perform any sort of path resolution.
| path | The path to extract the basename from. |
Referenced by delete_file(), and main().
| int closedir | ( | DIR * | dir | ) |
Closes a directory that was previously opened.
This function is used to close a directory stream that was previously opened with the opendir() function. You must do this to clean up any resources associated with the directory stream.
| dir | The directory stream to close. |
Referenced by browse_directory(), main(), and printdir().
| int dirfd | ( | DIR * | dirp | ) |
Retrieve the file descriptor of an opened directory stream.
This function retrieves the file descriptor of a directory stream that was previously opened with opendir().
| dirp | The directory stream to retrieve the descriptor of. |
| char * dirname | ( | char * | path | ) |
Get the parent directory of a file pathname.
This function retrieves the name of the parent directory of the file pathname specified. This function does not attempt to perform any sort of path resolution to check for the existence of the specified directory or to resolve any symbolic links.
| path | The path to extract the parent directory from. |
| DIR * opendir | ( | const char * | name | ) |
Open a directory based on the specified name.
The directory specified is opened if it exists. A directory stream object is returned for accessing the entries of the directory.
| name | The name of the directory to open. |
Referenced by browse_directory(), main(), and printdir().
Read an entry from a directory stream.
This function reads the next entry from the directory stream provided, returning the directory entry associated with the next object in the directory.
| dir | The directory stream to read from. |
Referenced by browse_directory(), main(), and printdir().
| void rewinddir | ( | DIR * | dir | ) |
Rewind a directory stream to the start of the directory.
This function rewinds the directory stream so that the next call to the readdir() function will return the first entry in the directory.
| dir | The directory stream to rewind. |
Referenced by printdir().
| int scandir | ( | const char *__RESTRICT | dir, |
| struct dirent ***__RESTRICT | namelist, | ||
| int(* | filter )(const struct dirent *), | ||
| int(* | compar )(const struct dirent **, const struct dirent **) ) |
Scan, filter, and sort files within a directory.
This function scans through all files within the directory located at the path given by dir, calling filter on each entry. Entries for which filter returns nonzero are stored within namelist and are sorted using qsort() with the comparison function, compar. The resulting directory entries are accumulated and stored witin namelist.
filter and compar may be NULL, if you do not wish to filter or sort the files.namelist are each independently heap-allocated, then the list itself heap allocated, so each entry must be freed within the list followed by the list itself.| dir | The path to the directory to scan |
| namelist | A pointer through which the list of entries will be returned. |
| filter | The callback used to filter each directory entry (returning 1 for inclusion, 0 for exclusion). |
| compar | The callback passed to qsort() to sort namelist by |
| >=0 | On success, the number of directory entries within namelist is returned |
| -1 | On failure, -1 is returned and errno is set |
| void seekdir | ( | DIR * | dir, |
| off_t | offset ) |
Not implemented.
| off_t telldir | ( | DIR * | dir | ) |
Not implemented.