aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix/sys.c
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2015-08-20 10:14:16 +0200
committerHenrik Nord <[email protected]>2015-08-20 10:14:16 +0200
commite3a5ad489d6e6cc190b609f8648b6af993c1b333 (patch)
treee1d401a2e0a74ba22f6d5b908a793eea8b37f88b /erts/emulator/sys/unix/sys.c
parenta2670f0822fc6729df956c8ec8c381340ff0a5fb (diff)
parent6b4c2dbd1b4a30f421611987acec6315c62ac9d5 (diff)
downloadotp-e3a5ad489d6e6cc190b609f8648b6af993c1b333.tar.gz
otp-e3a5ad489d6e6cc190b609f8648b6af993c1b333.tar.bz2
otp-e3a5ad489d6e6cc190b609f8648b6af993c1b333.zip
Merge branch 'maint-18' into maint
Diffstat (limited to 'erts/emulator/sys/unix/sys.c')
-rw-r--r--erts/emulator/sys/unix/sys.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index b036b20b7b..8d7da3e47e 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -2527,7 +2527,7 @@ fd_async(void *async_data)
SysIOVec *iov0;
SysIOVec *iov;
int iovlen;
- int err;
+ int err = 0;
/* much of this code is stolen from efile_drv:invoke_writev */
driver_pdl_lock(dd->blocking->pdl);
iov0 = driver_peekq(dd->port_num, &iovlen);
@@ -2542,8 +2542,11 @@ fd_async(void *async_data)
memcpy(iov,iov0,iovlen*sizeof(SysIOVec));
driver_pdl_unlock(dd->blocking->pdl);
- res = writev(dd->ofd, iov, iovlen);
- err = errno;
+ do {
+ res = writev(dd->ofd, iov, iovlen);
+ } while (res < 0 && errno == EINTR);
+ if (res < 0)
+ err = errno;
erts_free(ERTS_ALC_T_SYS_WRITE_BUF, iov);
}
@@ -2582,7 +2585,12 @@ void fd_ready_async(ErlDrvData drv_data,
return /* 0; */;
}
} else if (dd->blocking->res < 0) {
- driver_failure_posix(port_num, dd->blocking->err);
+ if (dd->blocking->err == ERRNO_BLOCK) {
+ set_busy_port(port_num, 1);
+ /* still data left to write in queue */
+ driver_async(port_num, &dd->blocking->pkey, fd_async, dd, NULL);
+ } else
+ driver_failure_posix(port_num, dd->blocking->err);
return; /* -1; */
}
return; /* 0; */