From nobody Thu May 23 19:42:07 2024 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 4Vldq409tnz5L9Qr; Thu, 23 May 2024 19:42:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vldq36G76z552F; Thu, 23 May 2024 19:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716493327; 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=wuCsOTIwVTzuUjnpjcnYctPWW72CpV68+9vn1s0RKZo=; b=EEU2Q4w6ohlDYLooYYxb5Up+Juxooxp/Rh8GM1H2jEqaij4OSiOidGgDSgDLC5GkQukve8 2dZUTVJLfM2/BFpxrfONPlHBPONsnsdSSeHxb4pmBzKTrvt/KnD5YXV0qlRlgs73nUyM7q 90hnKr8IEMiiTRlSJ/y2ggdvLRpt4tZdu1VQfWnxKVpDdZJiCNv9SNdxGz7h3u8L8vpioX KfPv9RwPh/3hFogjhifX6+rjx0e9HlfwElx6D2LOkbV+QQI0eeYHHMJum998/6hljL8fRP ZDhCQnG983cbd9GtG9QYFjsvuLvbbiLu9NJjyD95l2ole1NjTe95pufMr25G3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716493327; a=rsa-sha256; cv=none; b=x+jFw/H8gEYc7JYJw2/WsJpUEjRvzOrOxMrBcUB7ZGrg6BzwDuvS89JB8eDazrUJ95gieZ asplXP/OKyAapQ7Z1E5noQ/Kuiz5o7d9Wr565fpY616mAGMABBLCrPO3wMzlB0i57pdBai wIDxItcXAPPbQ5LGgsd+X9G3JN9J/UsDI7Pe08ZrZDsRsxMxBuMOCK0OaxXuGAjNZ+ldGS uyDzQdMLxA3G1Kzcm5KJZkBVXg0s4b5d88Yn1//PrqlUAV8Q2qm2mTpuVen/IaOd5IjXa0 JIxwE0+4cPeitI+VjMkfoQZh6yiQl1E+rt1QJowhIh76d27c2GEz1nozhWhnYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716493327; 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=wuCsOTIwVTzuUjnpjcnYctPWW72CpV68+9vn1s0RKZo=; b=csxXi6WWuQRoIdji3w34FL4FNatabR+e5Z5Z4PTyWpTO+L10Cb5P8mmQqssNgHHdKIiz9O FPoi6CLJU380kaQaVtSdJuFScNZHWo0+eV181yYvZoufBXMvrltmcZsyH+cr871qzkHEjA jepCfiFlq+e+A+pOs+srcUicRTKgyQbN9g+lu7WgB0gnUSsQVbsOB7LZK580G+kNm6txVT xHbX40QLfNwiX9TKkPOTP1Cobqv7XbtTth2Wb6+hIDrPg0iu8gfh08SO/CkBaFivqCG2X1 PvzJ3AArON9oRthQducECalSjVvIm8drYTgavzHoY02WPZldegS1NJWiIoIFyg== 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 4Vldq35syRz1317; Thu, 23 May 2024 19:42:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44NJg7Kk082496; Thu, 23 May 2024 19:42:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44NJg7re082493; Thu, 23 May 2024 19:42:07 GMT (envelope-from git) Date: Thu, 23 May 2024 19:42:07 GMT Message-Id: <202405231942.44NJg7re082493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 04d3f8e5396e - main - linprocfs: Add support for proc/sys/fs/mqueue/* 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04d3f8e5396edbef0e1d97e9866813163b0c6381 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=04d3f8e5396edbef0e1d97e9866813163b0c6381 commit 04d3f8e5396edbef0e1d97e9866813163b0c6381 Author: Ricardo Branco AuthorDate: 2024-05-12 09:49:36 +0000 Commit: Warner Losh CommitDate: 2024-05-23 19:40:45 +0000 linprocfs: Add support for proc/sys/fs/mqueue/* Reviewed by: imp, kib Pull Request: https://github.com/freebsd/freebsd-src/pull/1248 --- sys/compat/linprocfs/linprocfs.c | 107 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 617eb122291c..c5b6ec9b32c1 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -2220,6 +2220,97 @@ linprocfs_dosysvipc_shm(PFS_FILL_ARGS) return (0); } +/* + * Filler function for proc/sys/fs/mqueue/msg_default + */ +static int +linprocfs_domqueue_msg_default(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.default_maxmsg", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/msgsize_default + */ +static int +linprocfs_domqueue_msgsize_default(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.default_msgsize", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); + +} + +/* + * Filler function for proc/sys/fs/mqueue/msg_max + */ +static int +linprocfs_domqueue_msg_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmsg", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/msgsize_max + */ +static int +linprocfs_domqueue_msgsize_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmsgsize", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/queues_max + */ +static int +linprocfs_domqueue_queues_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmq", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + /* * Constructor */ @@ -2378,6 +2469,22 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "shm", &linprocfs_dosysvipc_shm, NULL, NULL, NULL, PFS_RD); + /* /proc/sys/fs/... */ + dir = pfs_create_dir(sys, "fs", NULL, NULL, NULL, 0); + + /* /proc/sys/fs/mqueue/... */ + dir = pfs_create_dir(dir, "mqueue", NULL, NULL, NULL, 0); + pfs_create_file(dir, "msg_default", &linprocfs_domqueue_msg_default, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgsize_default", &linprocfs_domqueue_msgsize_default, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msg_max", &linprocfs_domqueue_msg_max, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgsize_max", &linprocfs_domqueue_msgsize_max, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "queues_max", &linprocfs_domqueue_queues_max, + NULL, NULL, NULL, PFS_RD); + return (0); }