diff --git a/apps/stat.cpp b/apps/stat.cpp index ff3d905c..721c49c5 100644 --- a/apps/stat.cpp +++ b/apps/stat.cpp @@ -11,6 +11,7 @@ static const char* file_type(mode_t mode) case S_IFDIR: return "directory"; case S_IFCHR: return "character special device"; case S_IFLNK: return "symbolic link"; + case S_IFIFO: return "pipe"; default: return "unknown file type"; } } diff --git a/kernel/src/fs/Pipe.h b/kernel/src/fs/Pipe.h index 441f59d1..e95a2424 100644 --- a/kernel/src/fs/Pipe.h +++ b/kernel/src/fs/Pipe.h @@ -30,6 +30,11 @@ class Pipe class PipeInodeBase : public VFS::FileInode { public: + VFS::InodeType type() const override + { + return VFS::InodeType::FIFO; + } + Result truncate(usize) override { return err(ENOTSUP); diff --git a/kernel/src/fs/VFS.h b/kernel/src/fs/VFS.h index 6f63c238..b6b1851e 100644 --- a/kernel/src/fs/VFS.h +++ b/kernel/src/fs/VFS.h @@ -14,7 +14,8 @@ namespace VFS RegularFile, Directory, Device, - Symlink + Symlink, + FIFO, }; class Inode; diff --git a/kernel/src/sys/stat.cpp b/kernel/src/sys/stat.cpp index ef8eb25f..f2146828 100644 --- a/kernel/src/sys/stat.cpp +++ b/kernel/src/sys/stat.cpp @@ -15,6 +15,7 @@ static mode_t make_mode(mode_t mode, VFS::InodeType type) case VFS::InodeType::Directory: result |= S_IFDIR; break; case VFS::InodeType::Device: result |= S_IFCHR; break; case VFS::InodeType::Symlink: result |= S_IFLNK; break; + case VFS::InodeType::FIFO: result |= S_IFIFO; break; default: break; } diff --git a/libc/include/bits/fixed-size-types.h b/libc/include/bits/fixed-size-types.h index 0b700841..dde7116f 100644 --- a/libc/include/bits/fixed-size-types.h +++ b/libc/include/bits/fixed-size-types.h @@ -3,7 +3,7 @@ #ifndef _BITS_FIXED_SIZE_TYPES_H #define _BITS_FIXED_SIZE_TYPES_H -#if !defined(_SYS_TYPES_H) && !defined(_BITS_SETJMP_TYPES_H) +#if !defined(_SYS_TYPES_H) && !defined(_BITS_SETJMP_TYPES_H) && !defined(_BITS_MAKEDEV_H) #error "Never include bits/fixed-size-types.h, use the standard header instead." #endif diff --git a/libc/include/bits/modes.h b/libc/include/bits/modes.h index ba43766c..8929750d 100644 --- a/libc/include/bits/modes.h +++ b/libc/include/bits/modes.h @@ -6,6 +6,7 @@ #define S_IFMT 070000 #define S_IFREG 000000 #define S_IFLNK 010000 +#define S_IFIFO 020000 #define S_IFDIR 040000 #define S_IFCHR 050000 @@ -15,6 +16,7 @@ #define S_ISDIR(mode) __CHECK_TYPE(mode, S_IFDIR) #define S_ISCHR(mode) __CHECK_TYPE(mode, S_IFCHR) #define S_ISLNK(mode) __CHECK_TYPE(mode, S_IFLNK) +#define S_ISFIFO(mode) __CHECK_TYPE(mode, S_IFIFO) #define S_IRWXU 0700 #define S_IRUSR 0400