MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / getCurrentDirectoryFromDirFD

Method getCurrentDirectoryFromDirFD

source/kernel/kprocess.cpp:2171–2187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2169}
2170
2171U32 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
2189U32 KProcess::openat(FD dirfd, BString path, U32 flags) {
2190 BString dir;

Callers 3

renameatMethod · 0.95
symlinkatMethod · 0.95
readlinkatMethod · 0.95

Calls 1

getFileDescriptorMethod · 0.95

Tested by

no test coverage detected