aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-08-14 19:45:44 +0200
committerLukas Larsson <[email protected]>2015-12-15 10:05:45 +0100
commit9612b1fff77dc50e797f23b587321c90ceffe953 (patch)
treee329daa4a71978798e059dcca5d37a6af242ccc5 /erts/emulator/sys
parent898ca7f86dff3fe21c9bf2e5018c7fb93dca158e (diff)
downloadotp-9612b1fff77dc50e797f23b587321c90ceffe953.tar.gz
otp-9612b1fff77dc50e797f23b587321c90ceffe953.tar.bz2
otp-9612b1fff77dc50e797f23b587321c90ceffe953.zip
erts: Fix uds socket handling for os x
OS X is very strict in what it requires of you and also gives strange error codes for some errors. In this commit we remap EMSGSIZE to EMFILE and also precisely tune the amount of data we send on the socket so that we can recv only that data. If we try to recv more, recvmsg fails with EPIPE if the remote end has been closed.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/unix/sys_uds.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/sys_uds.c b/erts/emulator/sys/unix/sys_uds.c
index daebcb307b..015d0346a1 100644
--- a/erts/emulator/sys/unix/sys_uds.c
+++ b/erts/emulator/sys/unix/sys_uds.c
@@ -38,6 +38,14 @@ sys_uds_readv(int fd, struct iovec *iov, size_t iov_len,
msg.msg_controllen = sizeof(ancillary_buff);
if((res = recvmsg(fd, &msg, flags)) < 0) {
+#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
+ /* When some OS X versions run out of fd's
+ they give EMSGSIZE instead of EMFILE.
+ We remap this as we want the correct
+ error to appear for the user */
+ if (errno == EMSGSIZE)
+ errno = EMFILE;
+#endif
return res;
}