1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 19:15:07 +00:00

Add chown() syscall and a simple /bin/chown program.

This commit is contained in:
Andreas Kling 2019-02-27 12:32:53 +01:00
parent 711e2b2651
commit 1d2529b4a1
19 changed files with 130 additions and 5 deletions

View file

@ -72,6 +72,11 @@ Vector<Process*> Process::all_processes()
return processes;
}
bool Process::in_group(gid_t gid) const
{
return m_gids.contains(gid);
}
Region* Process::allocate_region(LinearAddress laddr, size_t size, String&& name, bool is_readable, bool is_writable, bool commit)
{
size = PAGE_ROUND_UP(size);
@ -2157,6 +2162,13 @@ int Process::sys$chmod(const char* pathname, mode_t mode)
return VFS::the().chmod(String(pathname), mode, cwd_inode());
}
int Process::sys$chown(const char* pathname, uid_t uid, gid_t gid)
{
if (!validate_read_str(pathname))
return -EFAULT;
return VFS::the().chown(String(pathname), uid, gid, cwd_inode());
}
void Process::finalize()
{
ASSERT(current == g_finalizer);