aboutsummaryrefslogtreecommitdiff
path: root/lib/libnv
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-07-16 16:28:50 +0000
committerMark Johnston <markj@FreeBSD.org>2019-07-16 16:28:50 +0000
commit07cf2bb6938d765f0c2f2e4b29f2f21cd276a0fb (patch)
tree8e6daeeb2646c7f89fa12c1eabba7d219ece2ea9 /lib/libnv
parentccf7f8460be77b489592fb5076f2ff18299a0c82 (diff)
Notes
Diffstat (limited to 'lib/libnv')
-rw-r--r--lib/libnv/msgio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libnv/msgio.c b/lib/libnv/msgio.c
index ee64ce8c8609..7cec4c898f04 100644
--- a/lib/libnv/msgio.c
+++ b/lib/libnv/msgio.c
@@ -63,7 +63,13 @@ __FBSDID("$FreeBSD$");
/* Linux: arbitrary size, but must be lower than SCM_MAX_FD. */
#define PKG_MAX_SIZE ((64U - 1) * CMSG_SPACE(sizeof(int)))
#else
-#define PKG_MAX_SIZE (MCLBYTES / CMSG_SPACE(sizeof(int)) - 1)
+/*
+ * To work around limitations in 32-bit emulation on 64-bit kernels, use a
+ * machine-independent limit on the number of FDs per message. Each control
+ * message contains 1 FD and requires 12 bytes for the header, 4 pad bytes,
+ * 4 bytes for the descriptor, and another 4 pad bytes.
+ */
+#define PKG_MAX_SIZE (MCLBYTES / 24)
#endif
static int