1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

Kernel: Strongly typed user & group ID's

Prior to this change, both uid_t and gid_t were typedef'ed to `u32`.
This made it easy to use them interchangeably. Let's not allow that.

This patch adds UserID and GroupID using the AK::DistinctNumeric
mechanism we've already been employing for pid_t/ProcessID.
This commit is contained in:
Andreas Kling 2021-08-28 22:11:16 +02:00
parent 59335bd8ea
commit ae197deb6b
44 changed files with 172 additions and 169 deletions

View file

@ -24,10 +24,10 @@ public:
Writer
};
static RefPtr<FIFO> try_create(uid_t);
static RefPtr<FIFO> try_create(UserID);
virtual ~FIFO() override;
uid_t uid() const { return m_uid; }
UserID uid() const { return m_uid; }
KResultOr<NonnullRefPtr<FileDescription>> open_direction(Direction);
KResultOr<NonnullRefPtr<FileDescription>> open_direction_blocking(Direction);
@ -49,13 +49,13 @@ private:
virtual StringView class_name() const override { return "FIFO"; }
virtual bool is_fifo() const override { return true; }
explicit FIFO(uid_t, NonnullOwnPtr<DoubleBuffer> buffer);
explicit FIFO(UserID, NonnullOwnPtr<DoubleBuffer> buffer);
unsigned m_writers { 0 };
unsigned m_readers { 0 };
NonnullOwnPtr<DoubleBuffer> m_buffer;
uid_t m_uid { 0 };
UserID m_uid { 0 };
int m_fifo_id { 0 };