libc: Add DT_* macros to dirent.h

This commit is contained in:
apio 2022-11-09 11:36:41 +01:00
parent accf7ee417
commit 59e03d0799
2 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,15 @@ struct dirent
char d_name[NAME_MAX];
};
#define DT_BLK 1 // This is a block device.
#define DT_CHR 2 // This is a character device.
#define DT_DIR 3 // This is a directory.
#define DT_FIFO 4 // This is a named pipe (FIFO).
#define DT_LNK 5 // This is a symbolic link.
#define DT_REG 6 // This is a regular file.
#define DT_SOCK 7 // This is a UNIX domain socket.
#define DT_UNKNOWN 0 // The file type could not be determined.
/* A stream representing a directory. */
typedef struct
{

View File

@ -46,7 +46,7 @@ extern "C"
result.d_ino = ent.inode;
result.d_reclen = sizeof(result);
result.d_off = ent.offset;
result.d_type = 0;
result.d_type = DT_UNKNOWN;
strlcpy(result.d_name, ent.name, NAME_MAX);
return &result;
}