diff options
author | Anton Kling <anton@kling.gg> | 2024-04-21 18:39:36 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-04-21 19:29:50 +0200 |
commit | 821eb5ff9ed60d4b1c7a50ebf406f22bc0da9bd4 (patch) | |
tree | 4562261e5bd41e215c277998f20d736d28a33430 /include | |
parent | a8959b3da1b160c84da6ead6f12188b1824d76e6 (diff) |
LibC: Add different isX() functions
Diffstat (limited to 'include')
-rw-r--r-- | include/dirent.h | 3 | ||||
-rw-r--r-- | include/sys/stat.h | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/dirent.h b/include/dirent.h index 153d36a..fd2eace 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -9,9 +9,6 @@ #include <unistd.h> #endif -#define S_ISREG(_m) (_m & (STAT_REG)) -#define S_ISDIR(_m) (_m & (STAT_DIR)) - struct dirent { ino_t d_ino; // File serial number. char d_name[PATH_MAX]; // Filename string of entry. diff --git a/include/sys/stat.h b/include/sys/stat.h index 9f3dfe9..e33b14e 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -5,6 +5,11 @@ #define STAT_REG (1 << 0) #define STAT_DIR (1 << 1) +#define STAT_FIFO (1 << 2) + +#define S_ISREG(_v) (((_v) >> 0) & 1) +#define S_ISDIR(_v) (((_v) >> 1) & 1) +#define S_ISFIFO(_v) (((_v) >> 2) & 1) struct stat { dev_t st_dev; // Device ID of device containing file. |