From nobody Sun May 12 11:35:48 2024 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 4VcgYJ0tTZz5JMvK; Sun, 12 May 2024 11:36:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4VcgYH3F7nz40rT; Sun, 12 May 2024 11:36:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 44CBZmcD067471; Sun, 12 May 2024 14:35:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 44CBZmcD067471 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 44CBZmN8067470; Sun, 12 May 2024 14:35:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 12 May 2024 14:35:48 +0300 From: Konstantin Belousov To: Warner Losh Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 099a81a4173b - main - linprocfs: Add support for proc/sysvipc/{msg,sem,shm} Message-ID: References: <202405111939.44BJdIE5045793@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <202405111939.44BJdIE5045793@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4VcgYH3F7nz40rT On Sat, May 11, 2024 at 07:39:18PM +0000, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=099a81a4173bc5b121e50d4e27ea5fafdda8475b > > commit 099a81a4173bc5b121e50d4e27ea5fafdda8475b > Author: Ricardo Branco > AuthorDate: 2024-05-04 13:38:20 +0000 > Commit: Warner Losh > CommitDate: 2024-05-11 19:37:47 +0000 > > linprocfs: Add support for proc/sysvipc/{msg,sem,shm} > > Signed-off-by: Ricardo Branco > Reviewed by: imp > Pull Request: https://github.com/freebsd/freebsd-src/pull/1218 > --- > sys/compat/linprocfs/linprocfs.c | 182 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 182 insertions(+) > > diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c > index 391d5f679ee5..a877d4065c18 100644 > --- a/sys/compat/linprocfs/linprocfs.c > +++ b/sys/compat/linprocfs/linprocfs.c > @@ -126,6 +126,9 @@ > #define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */ > #define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 10000) > > +/* Value defined in sys/kern/sysv_shm.c */ > +#define SHMSEG_ALLOCATED 0x0800 > + > /** > * @brief Mapping of ki_stat in struct kinfo_proc to the linux state > * > @@ -2092,6 +2095,176 @@ linprocfs_domax_map_cnt(PFS_FILL_ARGS) > return (0); > } > > +/* > + * Filler function for proc/sysvipc/msg > + */ > +static int > +linprocfs_dosysvipc_msg(PFS_FILL_ARGS) > +{ > + struct msqid_kernel *msqids; > + u_long id, msgmni; > + size_t sz; > + int error; > + > + sbuf_printf(sb, > + "%10s %10s %4s %10s %10s %5s %5s %5s %5s %5s %5s %10s %10s %10s\n", > + "key", "msqid", "perms", "cbytes", "qnum", "lspid", "lrpid", > + "uid", "gid", "cuid", "cgid", "stime", "rtime", "ctime"); > + > +again: > + msgmni = msginfo.msgmni; > + sz = sizeof(struct msqid_kernel) * msgmni; > + msqids = malloc(sz, M_TEMP, M_NOWAIT); Why M_NOWAIT? What does prevent us from waiting there? > + if (msqids == NULL) > + return (ENOMEM); > + if (msgmni != msginfo.msgmni) { What prevents msginfo.msgmni from changing again? Otherwise, why this check is needed? (Same questions for other two similar places trimmed below).