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

Method getcwd

source/kernel/kprocess.cpp:1915–1930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913}
1914
1915U32 KProcess::getcwd(U32 buffer, U32 size) {
1916 if (size==0) {
1917 return -K_EINVAL;
1918 }
1919 if (!this->memory->canWrite(buffer, size)) {
1920 return -K_EFAULT;
1921 }
1922 std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(B(""), this->currentDirectory, true);
1923 if (!node || !node->isDirectory()) {
1924 return -K_ENOENT;
1925 }
1926 if ((U32)this->currentDirectory.length()+1>size)
1927 return -K_ERANGE;
1928 memory->strcpy(buffer, this->currentDirectory.c_str());
1929 return (U32)this->currentDirectory.length()+1;
1930}
1931
1932U32 KProcess::stat64(BString path, U32 buffer) {
1933 bool isLink = false;

Callers 1

syscall_getcwdFunction · 0.80

Calls 6

BFunction · 0.85
isDirectoryMethod · 0.80
strcpyMethod · 0.80
canWriteMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected