From nobody Mon Oct 20 17:48:26 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cr2wB3kzwz6CqTw; Mon, 20 Oct 2025 17:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cr2wB2BzNz3v1T; Mon, 20 Oct 2025 17:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760982506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FovMVdmgRvuojY9/dUqfHOe1GRZ2E852qx+Dq7HHaQM=; b=powMxfP6/9vHOf86L7lVzIsiAgUIFETX2NBwBnl4i4hGoIdyCC8ZsSEZQWfB6Pcy+1EvuW jw37hGVrZJpAlBldDmz2m0ZbSZ38hYfpX9DtlDm90aKXlunEAiu/f51e1bCuRzrtEsk8IO 91HGdr6WQ0bvNCyZ4Sh041A8Nc1GuOR5ZG3oxmJhlW81sZHVJ6VxrivN3d0TBrf3S6Txxn pw3ukGnS4fC/pLKyVleVWcgIq6B2rDmamYUCFXhF9ijB77+GiVWOiIjPRTjSm0wy+45/r4 MOr9tkcpCyu9giIjGc5CZz7M6KB7VMzfBSXkkYXSRoR5aL4292mysGd3cmWqBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760982506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FovMVdmgRvuojY9/dUqfHOe1GRZ2E852qx+Dq7HHaQM=; b=JEdBOY1VpGF6Z4FgT3qBaHI4TeyvGdheubmLv/G7b5gyTmO2js8VZUMyC3uDDIjXAddX1i 0AHZE1oxYWTLzDOfyXVSZBIpyCVPHgfb+m+ilfatWbT35ycgh37xqCjOB/CMHTormwioIt zKopuyzr45FoaqXYGFif+9+/2wN0WtR+JYbWibGS651u41cM1e6Po5OpDuaQjQaZMp9N9/ K8/0NQpAcaMzjtAXSHhzodZyBW/SOTNKB0XoBGVmJXkUUtgGZsuw/wGHRzKnG/ya+VI5Ye wAr/w1oYV+6apq0N18Yml3vIHvM6LS/7SXNBpi70LEgvxAeYHy2gbinV03stvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760982506; a=rsa-sha256; cv=none; b=uuNeIfjFxI6BAvxNM8HeyMnZAdIglU/7+ej5X+9Zx1F0BK7SI2HUtitq1s7ouh/ADvX35K WW/F2CSgzz2ygkgbWwwvnCVp1dA76GW4gKeUbTrTCI5KRjHdCmiU/4njBmu+qq5vEx2yau NLphHI6uA+ynhUEJmvvJnD1XbGNgsxIVueV58ONnIxCkez4Mg167iU1pylKLgktSTxLk9S DGzZ6j2xqQL3lyqT92cKUmc+6HjgWtPYUkCe/D4kGxWhrlxCuwMimMMAztm3EXDHoNu5PT C/3n2laJmzvS6Htw3mW35SYWR+b1WBwZcSAOGL7VfmhbSukMyso0FrcWX2C73A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cr2wB1TvRz7QL; Mon, 20 Oct 2025 17:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59KHmQwS013910; Mon, 20 Oct 2025 17:48:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KHmQre013907; Mon, 20 Oct 2025 17:48:26 GMT (envelope-from git) Date: Mon, 20 Oct 2025 17:48:26 GMT Message-Id: <202510201748.59KHmQre013907@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 30b015e2cf7d - releng/15.0 - linprocfs: Add nodes for inotify List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/releng/15.0 X-Git-Reftype: branch X-Git-Commit: 30b015e2cf7d60ecc73c1c73828ef39c8f939865 Auto-Submitted: auto-generated The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=30b015e2cf7d60ecc73c1c73828ef39c8f939865 commit 30b015e2cf7d60ecc73c1c73828ef39c8f939865 Author: Mark Johnston AuthorDate: 2025-10-17 12:55:56 +0000 Commit: Colin Percival CommitDate: 2025-10-20 17:48:16 +0000 linprocfs: Add nodes for inotify These map directly onto sysctls under vfs.inotify of the same name. Approved by: re (cperciva) Reviewed by: olce, des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53142 (cherry picked from commit 28c0ef76841bbb322b6e39668e1c8e997c1f8000) --- sys/compat/linprocfs/linprocfs.c | 77 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 95b212be1306..7ac48786c77b 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -2216,6 +2216,67 @@ linprocfs_dosysvipc_shm(PFS_FILL_ARGS) return (0); } +static int +linprocfs_doinotify(const char *sysctl, PFS_FILL_ARGS) +{ + size_t size; + int error, val; + + if (uio->uio_rw == UIO_READ) { + size = sizeof(val); + error = kernel_sysctlbyname(curthread, + __DECONST(void *, sysctl), &val, &size, NULL, 0, 0, 0); + if (error == 0) + sbuf_printf(sb, "%d\n", val); + } else { + char *endp, *newval; + long vall; + + sbuf_trim(sb); + sbuf_finish(sb); + newval = sbuf_data(sb); + vall = strtol(newval, &endp, 10); + if (vall < 0 || vall > INT_MAX || endp == newval || + *endp != '\0') + return (EINVAL); + val = (int)vall; + error = kernel_sysctlbyname(curthread, + __DECONST(void *, sysctl), NULL, NULL, + &val, sizeof(val), 0, 0); + } + return (error); +} + +/* + * Filler function for proc/sys/fs/inotify/max_queued_events + */ +static int +linprocfs_doinotify_max_queued_events(PFS_FILL_ARGS) +{ + return (linprocfs_doinotify("vfs.inotify.max_queued_events", + PFS_FILL_ARGNAMES)); +} + +/* + * Filler function for proc/sys/fs/inotify/max_user_instances + */ +static int +linprocfs_doinotify_max_user_instances(PFS_FILL_ARGS) +{ + return (linprocfs_doinotify("vfs.inotify.max_user_instances", + PFS_FILL_ARGNAMES)); +} + +/* + * Filler function for proc/sys/fs/inotify/max_user_watches + */ +static int +linprocfs_doinotify_max_user_watches(PFS_FILL_ARGS) +{ + return (linprocfs_doinotify("vfs.inotify.max_user_watches", + PFS_FILL_ARGNAMES)); +} + /* * Filler function for proc/sys/fs/mqueue/msg_default */ @@ -2313,9 +2374,7 @@ linprocfs_domqueue_queues_max(PFS_FILL_ARGS) static int linprocfs_init(PFS_INIT_ARGS) { - struct pfs_node *root; - struct pfs_node *dir; - struct pfs_node *sys; + struct pfs_node *dir, *fs, *root, *sys; root = pi->pi_root; @@ -2466,10 +2525,18 @@ linprocfs_init(PFS_INIT_ARGS) NULL, PFS_RD); /* /proc/sys/fs/... */ - pfs_create_dir(sys, &dir, "fs", NULL, NULL, NULL, 0); + pfs_create_dir(sys, &fs, "fs", NULL, NULL, NULL, 0); + + pfs_create_dir(fs, &dir, "inotify", NULL, NULL, NULL, 0); + pfs_create_file(dir, NULL, "max_queued_events", + &linprocfs_doinotify_max_queued_events, NULL, NULL, NULL, PFS_RDWR); + pfs_create_file(dir, NULL, "max_user_instances", + &linprocfs_doinotify_max_user_instances, NULL, NULL, NULL, PFS_RDWR); + pfs_create_file(dir, NULL, "max_user_watches", + &linprocfs_doinotify_max_user_watches, NULL, NULL, NULL, PFS_RDWR); /* /proc/sys/fs/mqueue/... */ - pfs_create_dir(dir, &dir, "mqueue", NULL, NULL, NULL, 0); + pfs_create_dir(fs, &dir, "mqueue", NULL, NULL, NULL, 0); pfs_create_file(dir, NULL, "msg_default", &linprocfs_domqueue_msg_default, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, NULL, "msgsize_default",