1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +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

@ -63,7 +63,7 @@ KResultOr<SocketPair> LocalSocket::create_connected_pair(int type)
memcpy(socket->m_address.sun_path, "[socketpair]", 13);
auto& process = Process::current();
socket->m_acceptor = { process.pid().value(), process.uid(), process.gid() };
socket->m_acceptor = { process.pid().value(), process.uid().value(), process.gid().value() };
socket->set_connected(true);
socket->set_connect_side_role(Role::Connected);
@ -456,7 +456,7 @@ KResult LocalSocket::chmod(FileDescription&, mode_t mode)
return KSuccess;
}
KResult LocalSocket::chown(FileDescription&, uid_t uid, gid_t gid)
KResult LocalSocket::chown(FileDescription&, UserID uid, GroupID gid)
{
if (m_file)
return m_file->chown(uid, gid);