Use a platform-independent constant for PKG_MAX_SIZE.
This constant determines the number of rights libnv will attempt to transmit in a given control message. In practice, the upper limit defined by the kernel is machine-dependent and is smaller on 64-bit kernels than on 32-bit kernels. To ensure that a 32-bit libnv works as expected when run on a 64-bit kernel, use a limit that will work on both 32-bit and 64-bit kernels. PR: 238511 Discussed with: oshogbo MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20942
This commit is contained in:
parent
a0c215448b
commit
9c639de682
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user