Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jul 2019 15:07:31 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r350130 - stable/12/lib/libnv
Message-ID:  <201907191507.x6JF7VfT051440@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907191507.x6JF7VfT051440>