Kernel/LibC: Implement fchmod
This commit is contained in:
parent
2ce7205c80
commit
991ae4383a
|
@ -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_pread(int fd, void* buffer, size_t count, off_t offset);
|
||||||
|
|
||||||
BAN::ErrorOr<long> sys_chmod(const char*, mode_t);
|
BAN::ErrorOr<long> sys_chmod(const char* path, mode_t mode);
|
||||||
BAN::ErrorOr<long> sys_chown(const char*, uid_t, gid_t);
|
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_socket(int domain, int type, int protocol);
|
||||||
BAN::ErrorOr<long> sys_getsockname(int socket, sockaddr* address, socklen_t* address_len);
|
BAN::ErrorOr<long> sys_getsockname(int socket, sockaddr* address, socklen_t* address_len);
|
||||||
|
|
|
@ -1103,6 +1103,18 @@ namespace Kernel
|
||||||
return 0;
|
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)
|
BAN::ErrorOr<long> Process::sys_chown(const char* path, uid_t uid, gid_t gid)
|
||||||
{
|
{
|
||||||
LockGuard _(m_process_lock);
|
LockGuard _(m_process_lock);
|
||||||
|
|
|
@ -55,6 +55,7 @@ __BEGIN_DECLS
|
||||||
O(SYS_TTY_CTRL, tty_ctrl) \
|
O(SYS_TTY_CTRL, tty_ctrl) \
|
||||||
O(SYS_POWEROFF, poweroff) \
|
O(SYS_POWEROFF, poweroff) \
|
||||||
O(SYS_CHMOD, chmod) \
|
O(SYS_CHMOD, chmod) \
|
||||||
|
O(SYS_FCHMOD, fchmod) \
|
||||||
O(SYS_CREATE, create) \
|
O(SYS_CREATE, create) \
|
||||||
O(SYS_CREATE_DIR, create_dir) \
|
O(SYS_CREATE_DIR, create_dir) \
|
||||||
O(SYS_UNLINK, unlink) \
|
O(SYS_UNLINK, unlink) \
|
||||||
|
|
|
@ -13,9 +13,9 @@ int chmod(const char* path, mode_t mode)
|
||||||
return syscall(SYS_CHMOD, path, mode);
|
return syscall(SYS_CHMOD, path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fchmod(int, mode_t)
|
int fchmod(int fildes, mode_t mode)
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
return syscall(SYS_FCHMOD, fildes, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstat(int fildes, struct stat* buf)
|
int fstat(int fildes, struct stat* buf)
|
||||||
|
|
Loading…
Reference in New Issue