From 7135ca98d23b23ea817dadcdfb4425e878a2bc03 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Fri, 23 Oct 2020 11:57:55 +0000 Subject: [PATCH] Add /proc/sys/kernel/ngroups_max to linprocfs(4). The id(1) command seems to use it - it works fine without it, but still. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26898 --- sys/compat/linprocfs/linprocfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index c95661d5294..b346fe84f7c 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1452,6 +1452,19 @@ linprocfs_domsgmnb(PFS_FILL_ARGS) return (0); } +/* + * Filler function for proc/sys/kernel/ngroups_max + * + * Note that in Linux it defaults to 65536, not 1023. + */ +static int +linprocfs_dongroups_max(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", ngroups_max); + return (0); +} + /* * Filler function for proc/sys/kernel/pid_max */ @@ -1922,6 +1935,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "msgmnb", &linprocfs_domsgmnb, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "ngroups_max", &linprocfs_dongroups_max, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "pid_max", &linprocfs_dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", &linprocfs_dosem,