| 2169 | } |
| 2170 | |
| 2171 | U32 KProcess::getCurrentDirectoryFromDirFD(FD dirfd, BString& currentDirectory) { |
| 2172 | U32 result = 0; |
| 2173 | if (dirfd==-100) { // AT_FDCWD |
| 2174 | currentDirectory = this->currentDirectory; |
| 2175 | } else { |
| 2176 | KFileDescriptorPtr fd = this->getFileDescriptor(dirfd); |
| 2177 | if (!fd) { |
| 2178 | result = -K_EBADF; |
| 2179 | } else if (fd->kobject->type!=KTYPE_FILE){ |
| 2180 | result = -K_ENOTDIR; |
| 2181 | } else { |
| 2182 | std::shared_ptr<KFile> f = std::dynamic_pointer_cast<KFile>(fd->kobject); |
| 2183 | currentDirectory = f->openFile->node->path; |
| 2184 | } |
| 2185 | } |
| 2186 | return result; |
| 2187 | } |
| 2188 | |
| 2189 | U32 KProcess::openat(FD dirfd, BString path, U32 flags) { |
| 2190 | BString dir; |
no test coverage detected