Fixed another stupid bug in all readv()/writev() versions: the position of

the read/write access was only correct for the first entry in the iovec.
These functions should be updated to use read_pages()/write_pages() where
possible, anyway - right now, they only save some kernel calls, while they
could be processed by the device at once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14413 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-10-18 19:51:47 +00:00
parent 28953e6c2b
commit 0fc0129604

View File

@ -469,12 +469,13 @@ _user_readv(int fd, off_t pos, const iovec *userVecs, size_t count)
else
bytesRead += (ssize_t)length;
descriptor->pos = pos + length;
pos += vecs[i].iov_len;
}
} else
bytesRead = B_BAD_VALUE;
status = bytesRead;
descriptor->pos = pos;
err2:
free(vecs);
@ -571,12 +572,13 @@ _user_writev(int fd, off_t pos, const iovec *userVecs, size_t count)
else
bytesWritten += (ssize_t)length;
descriptor->pos = pos + length;
pos += vecs[i].iov_len;
}
} else
bytesWritten = B_BAD_VALUE;
status = bytesWritten;
descriptor->pos = pos;
err2:
free(vecs);
@ -775,11 +777,12 @@ _kern_readv(int fd, off_t pos, const iovec *vecs, size_t count)
else
bytesRead += (ssize_t)length;
descriptor->pos = pos + length;
pos += vecs[i].iov_len;
}
} else
bytesRead = B_BAD_VALUE;
descriptor->pos = pos;
put_fd(descriptor);
return bytesRead;
}
@ -853,11 +856,12 @@ _kern_writev(int fd, off_t pos, const iovec *vecs, size_t count)
else
bytesWritten += (ssize_t)length;
descriptor->pos = pos + length;
pos += vecs[i].iov_len;
}
} else
bytesWritten = B_BAD_VALUE;
descriptor->pos = pos;
put_fd(descriptor);
return bytesWritten;
}