aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/efile_drv.c
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2011-12-08 13:32:09 +0100
committerRaimo Niskanen <[email protected]>2011-12-20 12:07:41 +0100
commitb3db46435e2d32aa4197753bc95a81648f794021 (patch)
treec79295468315656a94f86f816ed914bdd830b312 /erts/emulator/drivers/common/efile_drv.c
parentd34e248f0913a337f1662e07b15298f9a082834b (diff)
downloadotp-b3db46435e2d32aa4197753bc95a81648f794021.tar.gz
otp-b3db46435e2d32aa4197753bc95a81648f794021.tar.bz2
otp-b3db46435e2d32aa4197753bc95a81648f794021.zip
erts: rewrite efile_writev to handle partial writes correctly
Diffstat (limited to 'erts/emulator/drivers/common/efile_drv.c')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index b132991a3b..36ed108b76 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -1385,7 +1385,11 @@ static void invoke_writev(void *data) {
size = d->c.writev.size;
}
- /* Copy the io vector to avoid locking the port que while writing */
+ /* Copy the io vector to avoid locking the port que while writing,
+ * also, both we and efile_writev might/will change the SysIOVec
+ * when segmenting or due to partial write and we do not want to
+ * tamper with the actual queue that we get from driver_peekq
+ */
MUTEX_LOCK(d->c.writev.q_mtx); /* Lock before accessing the port queue */
iov0 = driver_peekq(d->c.writev.port, &iovlen);
@@ -1424,7 +1428,7 @@ static void invoke_writev(void *data) {
} else {
d->result_ok = efile_writev(&d->errInfo,
d->flags, (int) d->fd,
- iov, iovcnt, size);
+ iov, iovcnt);
}
} else if (iovlen == 0) {
d->result_ok = 1;