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

Method pwrite64

source/kernel/kprocess.cpp:1891–1913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1889}
1890
1891U32 KProcess::pwrite64(KThread* thread, FD fildes, U32 address, U32 len, U64 offset) {
1892 KFileDescriptorPtr fd = this->getFileDescriptor(fildes);
1893
1894 if (!fd) {
1895 return -K_EBADF;
1896 }
1897 if (fd->kobject->type==KTYPE_NATIVE_SOCKET || fd->kobject->type==KTYPE_UNIX_SOCKET) {
1898 return -K_ESPIPE;
1899 }
1900 if (fd->kobject->type!=KTYPE_FILE) {
1901 return -K_EINVAL;
1902 }
1903 std::shared_ptr<KFile> p = std::dynamic_pointer_cast<KFile>(fd->kobject);
1904 FsOpenNode* openNode = p->openFile;
1905
1906 if (openNode->node->isDirectory()) {
1907 return -K_EISDIR;
1908 }
1909 if (!this->memory->canRead(address, len)) {
1910 return -K_EFAULT;
1911 }
1912 return p->pwrite(thread, address, (S64)offset, len);
1913}
1914
1915U32 KProcess::getcwd(U32 buffer, U32 size) {
1916 if (size==0) {

Callers 1

syscall_pwrite64Function · 0.80

Calls 4

getFileDescriptorMethod · 0.95
isDirectoryMethod · 0.80
pwriteMethod · 0.80
canReadMethod · 0.45

Tested by

no test coverage detected