KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
dirent.h File Reference

Directory entry functionality. More...

#include <kos/cdefs.h>
#include <unistd.h>
#include <stdint.h>
#include <kos/fs.h>
#include <kos/limits.h>

Go to the source code of this file.

Data Structures

struct  dirent
 POSIX directory entry structure. More...
 
struct  DIR
 Type representing a directory stream. More...
 

Macros

Directory File Types

POSIX file types for dirent::d_type

Remarks
These directory entry types are not part of the POSIX specifican per-se, but are used by BSD and glibc.
Todo
Ensure each VFS driver maps its directory types accordingly
#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)
 

Functions

DIRopendir (const char *name)
 Open a directory based on the specified name.
 
int closedir (DIR *dir)
 Closes a directory that was previously opened.
 
struct direntreaddir (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.
 

Detailed Description

Directory entry functionality.

This partially implements the standard POSIX dirent.h functionality.

Author
Megan Potter
Falco Girgis