kernel+stat: Handle pipes correctly in stat()
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9cdfdbc6f9
commit
3a51807fa6
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,11 @@ class Pipe
|
||||
class PipeInodeBase : public VFS::FileInode
|
||||
{
|
||||
public:
|
||||
VFS::InodeType type() const override
|
||||
{
|
||||
return VFS::InodeType::FIFO;
|
||||
}
|
||||
|
||||
Result<void> truncate(usize) override
|
||||
{
|
||||
return err(ENOTSUP);
|
||||
|
@ -14,7 +14,8 @@ namespace VFS
|
||||
RegularFile,
|
||||
Directory,
|
||||
Device,
|
||||
Symlink
|
||||
Symlink,
|
||||
FIFO,
|
||||
};
|
||||
|
||||
class Inode;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 <stdint.h> header instead."
|
||||
#endif
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user