diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-27 12:32:53 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-27 12:32:53 +0100 |
commit | 1d2529b4a13a18900d36f9d3b914b1bca68d962f (patch) | |
tree | d3be7621ba3c925321aabe609d6622f41887cfe8 /Kernel/Process.cpp | |
parent | 711e2b2651505da91cef983df130118bc6b709d8 (diff) | |
download | serenity-1d2529b4a13a18900d36f9d3b914b1bca68d962f.zip |
Add chown() syscall and a simple /bin/chown program.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 252bed6945..e2e05805f6 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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); |