MCPcopy Create free account
hub / github.com/Bananymous/banan-os / create_file

Method create_file

kernel/kernel/Process.cpp:1380–1403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1378 }
1379
1380 BAN::ErrorOr<void> Process::create_file(int fd, const char* path, mode_t mode) const
1381 {
1382 switch (mode & Inode::Mode::TYPE_MASK)
1383 {
1384 case Inode::Mode::IFREG:
1385 case Inode::Mode::IFLNK:
1386 case Inode::Mode::IFIFO:
1387 case Inode::Mode::IFSOCK:
1388 break;
1389 default:
1390 ASSERT_NOT_REACHED();
1391 }
1392
1393 struct uid_gid_t { uid_t uid; gid_t gid; };
1394 const auto [uid, gid] = ({
1395 LockGuard _(m_process_lock);
1396 uid_gid_t { m_credentials.euid(), m_credentials.egid() };
1397 });
1398
1399 auto [parent, file_name] = TRY(find_parent_file(fd, path, O_EXEC | O_WRONLY));
1400 TRY(parent.inode->create_file(file_name, mode, uid, gid));
1401
1402 return {};
1403 }
1404
1405 BAN::ErrorOr<long> Process::open_inode(VirtualFileSystem::File&& file, int flags)
1406 {

Callers 2

sys_openatMethod · 0.45
sys_mkfifoatMethod · 0.45

Calls 2

euidMethod · 0.80
egidMethod · 0.80

Tested by

no test coverage detected