MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / Free

Method Free

src/filesystem/file_descriptor.cpp:89–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89auto FileDescriptorTable::Free(int fd) -> Expected<void> {
90 if (fd < 0 || fd >= kMaxFd) {
91 return std::unexpected(Error(ErrorCode::kFsInvalidFd));
92 }
93
94 LockGuard guard(lock_);
95
96 if (table_[fd] == nullptr) {
97 return std::unexpected(Error(ErrorCode::kFsInvalidFd));
98 }
99
100 table_[fd] = nullptr;
101 --open_count_;
102
103 return {};
104}
105
106auto FileDescriptorTable::Dup(int old_fd, int new_fd) -> Expected<int> {
107 if (old_fd < 0 || old_fd >= kMaxFd) {

Callers

nothing calls this directly

Calls 1

ErrorClass · 0.85

Tested by

no test coverage detected