From nobody Mon Oct 20 16:47:18 2025 X-Original-To: dev-commits-src-all@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 4cr1Yf5Hblz6CkTh; Mon, 20 Oct 2025 16:47:18 +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 4cr1Yf4pNCz3fS6; Mon, 20 Oct 2025 16:47:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760978838; 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=Nz804yH+db5wi/bd+tOHl3B2tAsj22NzMHgzfQGnHM8=; b=bbVEeHg0eS1UPYVbNQFeKQz8jdC0e8Fns/Difq1UM1mP01hsl4YF5tZN1D8WKoObhnQuaI vXiKGaqIGLQWdSW4twSM3J+fyaF0yvmrAZvfR8Lrh7ZkqytLiSQ6aXn2YmvpCxzhEvyS43 ZLepc/rzTSk2ODWx1Is5fhYGMuzwYlWnBEvpP5o6cgUVxSmYgjVJtOuTIqyalvzL0vdLzT joswvpAZxvV/2q+Pgy7mZghLwqBD7HTFcolR0XRZibBxKQC4pGstFWKp7ghZ6BzcND0inm /A1RAeS+QnCUQI3COSIZDlIEhm00vSqIPTAvtOt8z+uzx7a313cv73NR/5IRWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760978838; 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=Nz804yH+db5wi/bd+tOHl3B2tAsj22NzMHgzfQGnHM8=; b=ofrd0HaLEaF4fGSAX//1RbjKyMYCXxrR4L6ULYgj4xG2uKf6UIaTwTeIvLJk9ma2hDSzS/ /UJGc4/S15tQuzPUmPRQRtROLqOJiA/KEoZQAFFi/NQFf0eMUVl7PQmMHF4K/H9Y+mDFJw MvB7B7BrompiFuBA1CgmRcxgzMWm4WZR+zcgJqtTEzT9HcRRjK/aCgHMoIKW27Kttke+iH fJGm5zGJP3P0V3eaJ/RQbVtzRe6YfCzJvUEbqV8cxgSuRmHSaiAJrGXFouf3KjaYjjODoy cpUso7pdlN38znvyx8EWHuRcwpGqIY7H31pKRk0PyDORKBuNmhTbMWD0EHq8gg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760978838; a=rsa-sha256; cv=none; b=OOkKOMm08SKOOzVbBUHIhTTOw2bg7tHwJd/UIj5AxRa/+Z8zru/GHq0blUHGKc0vBGfbPC UDPYItzgSsCeUe02Oe0MdybX6gvbsUkEyJkZxH6pMNNXnlWvfzkBs4P1oLqQ8hQKLYP3fs HXcCZK30TNosvB4l+kF5ZtzKGHWF0kEQt5SjOthHYZ4YtgQOlKv8BH1XCWFArzxfrbCeJP wuqfMBtI7mWeaJpdiO7+JJd9fxGg7MUAa3PmXOey2Gn9uNQdaaKiZZIC9g9+PbqEzAqXsq jSqHFyQwvXtzPPw3jziLnYL3YIC5QbiIfAbsWlcqZi7GIuJA0Sl6NbLbyEo+1g== 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 4cr1Yf4KRpz65R; Mon, 20 Oct 2025 16:47:18 +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 59KGlI6a099669; Mon, 20 Oct 2025 16:47:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59KGlIZj099666; Mon, 20 Oct 2025 16:47:18 GMT (envelope-from git) Date: Mon, 20 Oct 2025 16:47:18 GMT Message-Id: <202510201647.59KGlIZj099666@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3e138efaf4ba - stable/15 - linprocfs: Add nodes for inotify List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 3e138efaf4baa7517ac00b85ee6c1711c290d7c3 Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e138efaf4baa7517ac00b85ee6c1711c290d7c3 commit 3e138efaf4baa7517ac00b85ee6c1711c290d7c3 Author: Mark Johnston AuthorDate: 2025-10-17 12:55:56 +0000 Commit: Mark Johnston CommitDate: 2025-10-20 16:45:37 +0000 linprocfs: Add nodes for inotify These map directly onto sysctls under vfs.inotify of the same name. 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",