Kernel: Add support for named pipes
These only copy inodes stat when created, if you fchmod/fchown a named pipe, the change will not be visible on the filesystem
This commit is contained in:
@@ -5,13 +5,17 @@
|
||||
#include <kernel/Memory/ByteRingBuffer.h>
|
||||
#include <kernel/ThreadBlocker.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
class Pipe : public Inode
|
||||
class Pipe : public Inode, public BAN::Weakable<Pipe>
|
||||
{
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::RefPtr<Inode>> create(const Credentials&);
|
||||
static BAN::ErrorOr<BAN::RefPtr<Inode>> open(BAN::RefPtr<Inode>, int status_flags);
|
||||
static BAN::ErrorOr<BAN::RefPtr<Inode>> create(uid_t, gid_t);
|
||||
~Pipe();
|
||||
|
||||
void on_close(int status_flags) override;
|
||||
void on_clone(int status_flags) override;
|
||||
@@ -31,7 +35,7 @@ namespace Kernel
|
||||
virtual BAN::ErrorOr<long> ioctl_impl(int, void*) override;
|
||||
|
||||
private:
|
||||
Pipe(const Credentials&);
|
||||
Pipe(const struct stat&);
|
||||
|
||||
private:
|
||||
Mutex m_mutex;
|
||||
@@ -39,8 +43,10 @@ namespace Kernel
|
||||
|
||||
BAN::UniqPtr<ByteRingBuffer> m_buffer;
|
||||
|
||||
BAN::Atomic<uint32_t> m_writing_count { 1 };
|
||||
BAN::Atomic<uint32_t> m_reading_count { 1 };
|
||||
BAN::Atomic<uint32_t> m_writing_count { 0 };
|
||||
BAN::Atomic<uint32_t> m_reading_count { 0 };
|
||||
|
||||
BAN::RefPtr<Inode> m_named_inode;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user