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

Method llseek

source/kernel/kprocess.cpp:1707–1730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1705}
1706
1707S64 KProcess::llseek(FD fildes, S64 offset, U32 whence) {
1708 KFileDescriptorPtr fd = this->getFileDescriptor(fildes);
1709 S64 pos = 0;
1710
1711 if (!fd) {
1712 return -K_EBADF;
1713 }
1714 if (whence==0) { // SEEK_SET
1715 pos = offset;
1716 } else if (whence==1) { // SEEK_CUR
1717 pos = fd->kobject->getPos();
1718 if (pos<0)
1719 return pos;
1720 pos+=offset;
1721 } else if (whence==2) { // SEEK_END
1722 pos = fd->kobject->length();
1723 if (pos<0)
1724 return pos;
1725 pos+=offset;
1726 } else {
1727 return -K_EINVAL;
1728 }
1729 return fd->kobject->seek(pos);
1730}
1731
1732U32 writeRecord(KMemory* memory, U32 dirp, U32 len, U32 count, U32 pos, bool is64, const char* name, U32 id, U32 type) {
1733 U32 recordLen = 0;

Callers 1

syscall_llseekFunction · 0.80

Calls 4

getFileDescriptorMethod · 0.95
getPosMethod · 0.45
lengthMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected