Kernel/LibC/Userspace: Implement mkdir and creat

Touch now uses creat insteadd of open with O_CREAT flag
This commit is contained in:
2023-10-25 19:45:18 +03:00
parent e9b7cf332d
commit 6ee4d10651
11 changed files with 83 additions and 10 deletions

View File

@@ -746,6 +746,22 @@ namespace Kernel
return TRY(m_open_file_descriptors.write(fd, BAN::ByteSpan((uint8_t*)buffer, count)));
}
BAN::ErrorOr<long> Process::sys_create(const char* path, mode_t mode)
{
LockGuard _(m_lock);
validate_string_access(path);
TRY(create_file_or_dir(path, mode));
return 0;
}
BAN::ErrorOr<long> Process::sys_create_dir(const char* path, mode_t mode)
{
LockGuard _(m_lock);
validate_string_access(path);
TRY(create_file_or_dir(path, Inode::Mode::IFDIR | mode));
return 0;
}
BAN::ErrorOr<long> Process::sys_chmod(const char* path, mode_t mode)
{
if (mode & S_IFMASK)