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

Method lseek

source/kernel/kprocess.cpp:958–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956}
957
958U32 KProcess::lseek(FD fildes, S32 offset, U32 whence) {
959 KFileDescriptorPtr fd = this->getFileDescriptor(fildes);
960 S64 pos = 0;
961
962 if (!fd) {
963 return -K_EBADF;
964 }
965 if (whence == 0) {
966 pos = offset;
967 } else if (whence == 1) {
968 pos = offset + fd->kobject->getPos();
969 } else if (whence == 2) {
970 pos = fd->kobject->length() + offset;
971 } else {
972 return -K_EINVAL;
973 }
974 return (U32)fd->kobject->seek(pos);
975}
976
977U32 KProcess::chmod(BString path, U32 mode) {
978 std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(this->currentDirectory, path, true);

Callers 1

syscall_lseekFunction · 0.80

Calls 4

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

Tested by

no test coverage detected