Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Use the max limit (aka maxfiles or the moral equiva...
details: https://anonhg.NetBSD.org/src/rev/abecc1addf4a
branches: trunk
changeset: 451142:abecc1addf4a
user: christos <christos%NetBSD.org@localhost>
date: Tue May 07 20:10:21 2019 +0000
description:
Use the max limit (aka maxfiles or the moral equivalent of OPEN_MAX) which
makes poll(2) align with the Posix documentation (which allows EINVAL if
nfds > OPEN_MAX). From: Anthony Mallet
diffstat:
sys/kern/sys_select.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r cd0270b8b992 -r abecc1addf4a sys/kern/sys_select.c
--- a/sys/kern/sys_select.c Tue May 07 18:45:37 2019 +0000
+++ b/sys/kern/sys_select.c Tue May 07 20:10:21 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_select.c,v 1.43 2019/05/05 20:45:08 christos Exp $ */
+/* $NetBSD: sys_select.c,v 1.44 2019/05/07 20:10:21 christos Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.43 2019/05/05 20:45:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.44 2019/05/07 20:10:21 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -488,7 +488,7 @@
int error;
size_t ni;
- if (nfds > curlwp->l_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur) {
+ if (nfds > curlwp->l_proc->p_rlimit[RLIMIT_NOFILE].rlim_max) {
/*
* Prevent userland from causing over-allocation.
* Raising the default limit too high can still cause
@@ -502,6 +502,10 @@
*
* Historically the code silently truncated 'fds' to
* dt_nfiles entries - but that does cause issues.
+ *
+ * Using the max limit equivalent to sysctl
+ * kern.maxfiles is the moral equivalent of OPEN_MAX
+ * as specified by POSIX
*/
return EINVAL;
}
Home |
Main Index |
Thread Index |
Old Index