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