diff options
author | Lukas Larsson <[email protected]> | 2018-08-03 09:38:53 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2018-08-03 09:38:53 +0200 |
commit | 795d6ea47785a4e833e8c7829e67f48816f6372a (patch) | |
tree | 6ac9f3693c4dc26fc1cc17d363f5bb311f175436 /erts/emulator/sys/unix/sys_uds.c | |
parent | 68528b5ea9f87d52d5bcb0eb0301359008c83fc7 (diff) | |
parent | 48bbcab1b0d51ed19ab5676aa712e976bc76ee97 (diff) | |
download | otp-795d6ea47785a4e833e8c7829e67f48816f6372a.tar.gz otp-795d6ea47785a4e833e8c7829e67f48816f6372a.tar.bz2 otp-795d6ea47785a4e833e8c7829e67f48816f6372a.zip |
Merge branch 'lukas/erts/etoomanyrefs_forker/OTP-15210' into maint
* lukas/erts/etoomanyrefs_forker/OTP-15210:
erts: Handle EMFILE errors in forker_driver for write
Diffstat (limited to 'erts/emulator/sys/unix/sys_uds.c')
-rw-r--r-- | erts/emulator/sys/unix/sys_uds.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys_uds.c b/erts/emulator/sys/unix/sys_uds.c index c328fd00bb..39a4866065 100644 --- a/erts/emulator/sys/unix/sys_uds.c +++ b/erts/emulator/sys/unix/sys_uds.c @@ -132,7 +132,7 @@ sys_uds_writev(int fd, struct iovec *iov, size_t iov_len, struct msghdr msg; struct cmsghdr *cmsg = NULL; - int res, i; + int res, i, error; /* initialize socket message */ memset(&msg, 0, sizeof(struct msghdr)); @@ -173,11 +173,22 @@ sys_uds_writev(int fd, struct iovec *iov, size_t iov_len, res = sendmsg(fd, &msg, flags); +#ifdef ETOOMANYREFS + /* Linux may give ETOOMANYREFS when there are too many fds in transit. + We map this to EMFILE as bsd and other use this error code and we want + the behaviour to be the same on all OSs */ + if (errno == ETOOMANYREFS) + errno = EMFILE; +#endif + error = errno; + if (iov_len > MAXIOV) free(iov[0].iov_base); free(msg.msg_control); + errno = error; + return res; } |