svn commit: r350130 - stable/12/lib/libnv

Mark Johnston markj at FreeBSD.org
Fri Jul 19 15:07:31 UTC 2019


Author: markj
Date: Fri Jul 19 15:07:31 2019
New Revision: 350130
URL: https://svnweb.freebsd.org/changeset/base/350130

Log:
  MFC r350054:
  Use a platform-independent constant for PKG_MAX_SIZE.
  
  PR:	238511

Modified:
  stable/12/lib/libnv/msgio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libnv/msgio.c
==============================================================================
--- stable/12/lib/libnv/msgio.c	Fri Jul 19 15:07:30 2019	(r350129)
+++ stable/12/lib/libnv/msgio.c	Fri Jul 19 15:07:31 2019	(r350130)
@@ -58,7 +58,13 @@ __FBSDID("$FreeBSD$");
 #define	PJDLOG_ABORT(...)		abort()
 #endif
 
-#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)
 
 static int
 msghdr_add_fd(struct cmsghdr *cmsg, int fd)


More information about the svn-src-all mailing list