From 3e89b64168e77c413823002dd58be6a081970629 Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Sun, 24 May 2015 16:47:13 +0000 Subject: [PATCH] Put the correct value for the abi_nfdbits parameter of kern_select() for all supported Linuxulators. Differential Revision: https://reviews.freebsd.org/D1093 Reviewed by: trasz --- sys/amd64/linux/linux.h | 1 + sys/amd64/linux32/linux.h | 1 + sys/compat/linux/linux_misc.c | 4 ++-- sys/compat/linux/linux_misc.h | 3 +++ sys/i386/linux/linux.h | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 2ade33c19544..0845809422f5 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -82,6 +82,7 @@ typedef l_long l_time_t; typedef l_int l_timer_t; typedef l_int l_mqd_t; typedef l_size_t l_socklen_t; +typedef l_ulong l_fd_mask; typedef struct { l_int val[2]; diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 035973823dbb..001c86b8ea6f 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -95,6 +95,7 @@ typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; typedef l_int l_mqd_t; +typedef l_ulong l_fd_mask; typedef struct { l_int val[2]; diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 72d376cc1666..21303d72a462 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -531,7 +531,7 @@ linux_select(struct thread *td, struct linux_select_args *args) tvp = NULL; error = kern_select(td, args->nfds, args->readfds, args->writefds, - args->exceptfds, tvp, sizeof(l_int) * 8); + args->exceptfds, tvp, LINUX_NFDBITS); #ifdef DEBUG if (ldebug(select)) @@ -2181,7 +2181,7 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args) tvp = NULL; error = kern_pselect(td, args->nfds, args->readfds, args->writefds, - args->exceptfds, tvp, ssp, sizeof(l_int) * 8); + args->exceptfds, tvp, ssp, LINUX_NFDBITS); if (error == 0 && args->tsp != NULL) { if (td->td_retval[0] != 0) { diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index 1fbbd4898f6e..2fef8e773273 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -33,6 +33,9 @@ #include + /* bits per mask */ +#define LINUX_NFDBITS sizeof(l_fd_mask) * 8 + /* * Miscellaneous */ diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index cffa5c2d746a..3087dac112f6 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -89,6 +89,7 @@ typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; typedef l_int l_mqd_t; +typedef l_ulong l_fd_mask; typedef struct { l_int val[2];