Kernel/LibC: Implement fchmod
This commit is contained in:
@@ -119,8 +119,9 @@ namespace Kernel
|
||||
|
||||
BAN::ErrorOr<long> sys_pread(int fd, void* buffer, size_t count, off_t offset);
|
||||
|
||||
BAN::ErrorOr<long> sys_chmod(const char*, mode_t);
|
||||
BAN::ErrorOr<long> sys_chown(const char*, uid_t, gid_t);
|
||||
BAN::ErrorOr<long> sys_chmod(const char* path, mode_t mode);
|
||||
BAN::ErrorOr<long> sys_fchmod(int fildes, mode_t mode);
|
||||
BAN::ErrorOr<long> sys_chown(const char* path, uid_t uid, gid_t gid);
|
||||
|
||||
BAN::ErrorOr<long> sys_socket(int domain, int type, int protocol);
|
||||
BAN::ErrorOr<long> sys_getsockname(int socket, sockaddr* address, socklen_t* address_len);
|
||||
|
||||
@@ -1103,6 +1103,18 @@ namespace Kernel
|
||||
return 0;
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_fchmod(int fildes, mode_t mode)
|
||||
{
|
||||
if (mode & S_IFMASK)
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
|
||||
LockGuard _(m_process_lock);
|
||||
auto inode = TRY(m_open_file_descriptors.inode_of(fildes));
|
||||
TRY(inode->chmod(mode));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_chown(const char* path, uid_t uid, gid_t gid)
|
||||
{
|
||||
LockGuard _(m_process_lock);
|
||||
|
||||
Reference in New Issue
Block a user