aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/unix
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-07 15:52:40 +0200
committerBjörn Gustavsson <[email protected]>2016-04-07 15:52:40 +0200
commite28b9ae141691d9db0670c2fdb7e0c840f354a26 (patch)
treec14e8641b37c086bee3479ad5115f6dfffaf1ba6 /erts/emulator/drivers/unix
parent89b762d4c9332a9a6416ff8b4f9ea5f6b9179779 (diff)
parent5ae46e823a8a52ed4e5b960ff62975894b1a8302 (diff)
downloadotp-e28b9ae141691d9db0670c2fdb7e0c840f354a26.tar.gz
otp-e28b9ae141691d9db0670c2fdb7e0c840f354a26.tar.bz2
otp-e28b9ae141691d9db0670c2fdb7e0c840f354a26.zip
Merge branch 'bjorn/erts/huge-file-fix/OTP-13461'
* bjorn/erts/huge-file-fix/OTP-13461: Handle multi-giga byte writes to files
Diffstat (limited to 'erts/emulator/drivers/unix')
-rw-r--r--erts/emulator/drivers/unix/unix_efile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c
index 81ed1996df..0861435264 100644
--- a/erts/emulator/drivers/unix/unix_efile.c
+++ b/erts/emulator/drivers/unix/unix_efile.c
@@ -638,12 +638,21 @@ efile_writev(Efile_error* errInfo, /* Where to return error codes */
do {
w = writev(fd, &iov[cnt], b);
} while (w < 0 && errno == EINTR);
+ if (w < 0 && errno == EINVAL) {
+ goto single_write;
+ }
} else
+ single_write:
/* Degenerated io vector - use regular write */
#endif
{
do {
- w = write(fd, iov[cnt].iov_base, iov[cnt].iov_len);
+ size_t iov_len = iov[cnt].iov_len;
+ size_t limit = 1024*1024*1024; /* 1GB */
+ if (iov_len > limit) {
+ iov_len = limit;
+ }
+ w = write(fd, iov[cnt].iov_base, iov_len);
} while (w < 0 && errno == EINTR);
ASSERT(w <= iov[cnt].iov_len ||
(w == -1 && errno != EINTR));