From nobody Fri Oct 17 13:00:10 2025 X-Original-To: dev-commits-src-main@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 4cp4fz03lbz6DFnJ; Fri, 17 Oct 2025 13:00:11 +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 4cp4fy4BYwz3bJK; Fri, 17 Oct 2025 13:00:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760706010; 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=ndzcNbamNBXHUny7wOJW1cztoU2KNnGSf5CEcLKBDcU=; b=yEx0joBerrrY0NchhnQ3xNhEiGysvzIQ56J5vljD9vZ5pbrrgZnZ4cCcrefq+QsDjmOEsG PL6szSfhq+T2Nwpfx/Ox0Z97MWMtBaFEJqPzTJfa/kZMatohk39TrJoiZ4l0zIhw0AfUC0 6AVgsU8j4UXsxpbtD2Ug9lnpAz3ik2z6eOchwpK1GPp4GWViFZ3VOLgUbGjaOzmRPkGkQB txoL9ZfyGrzi8kdKg7gdDfS+IzkIGIg7DId4JUHi+niyJEsdHISCnu9Oku+RdE/Ux52wAP b/Sk1aUzu3P4cOZpYk67feyxwg1IamWIcSDZndFGzKct4p3mwmBNw6X7S8+MQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760706010; 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=ndzcNbamNBXHUny7wOJW1cztoU2KNnGSf5CEcLKBDcU=; b=a0WfMqhsGIotnbHLWSyG02CjczxZK2vDv3WrA9qPTFpo4s5zH+NCctPCCUbMrLBuC3frOW qIE1WE8RN4oTXdtrqgrYSgwbT+6/weop8o6pA5akpqWz0Pdt6jswY2DtveXBdwW0A9ft/d xTi9CKwoe9mRwyRR6jjd/W/CJOJcfTSEAkYoBbeob5LrMd3Se7R+GDXsjtQUOG95yjsnnx ocSF6CGge/mm4UAPnWyMA/8SqW6m+S78iJLAtIBZOgL9+iAZpnPvjifVUlP/sSdzzlf5Je vO4S+TF4aGuWP+Y1WkdpH0EoeaMinwEcB0CMF4O7OkEox2gZP1CrD4JXvJVt5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760706010; a=rsa-sha256; cv=none; b=jZj9WmblK855WBWjhkYWHNBledDsGlaNzJwxBJekPDIzsbuoYbeCywYKb9ww4xsYGS4cXK jK01jVsVRkDjlsbrPk3MznG9AEMhXHwvc05FfH1Ry+Je6egMC6gjEKdoj8YPZmC9b8WNU+ GNLBOb7LFDXomPn5YIlWOVdaj1E0d1xm+DUCiNV1/w7DAKwTgeitO0f50uqr+5QHYJlcQ/ 81C1S0Z5O2oWusjsBjiAQecYq3dow3/vBMDtiA6MIIu3SA7qlevjhubgj4W3DaeHVGnkiV 02EWj8KEhohwQ48q3+6pUng6+xthc9vK34t/7zOTNj4uOwMr3RI5Ew3dN/hVrA== 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 4cp4fy3kytzwDq; Fri, 17 Oct 2025 13:00:10 +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 59HD0AMA024845; Fri, 17 Oct 2025 13:00:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59HD0ABP024837; Fri, 17 Oct 2025 13:00:10 GMT (envelope-from git) Date: Fri, 17 Oct 2025 13:00:10 GMT Message-Id: <202510171300.59HD0ABP024837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 28c0ef76841b - main - linprocfs: Add nodes for inotify List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 28c0ef76841bbb322b6e39668e1c8e997c1f8000 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=28c0ef76841bbb322b6e39668e1c8e997c1f8000 commit 28c0ef76841bbb322b6e39668e1c8e997c1f8000 Author: Mark Johnston AuthorDate: 2025-10-17 12:55:56 +0000 Commit: Mark Johnston CommitDate: 2025-10-17 12:55:56 +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 --- 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",