From: Crystal Wood <crwood@redhat.com>
To: John Kacur <jkacur@gmail.com>
Cc: Lukas Beckmann <lbckmnn@mailbox.org>,
John Kacur <jkacur@redhat.com>,
rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 2/2] cyclictest: simplify rstat_setup
Date: Tue, 10 Mar 2026 11:57:39 -0500 [thread overview]
Message-ID: <c60136fdf3afa53f6dbf3dee78e57d3d2952ea9d.camel@redhat.com> (raw)
In-Reply-To: <85147e31-053f-1b0f-e200-5d49c1b8b123@gmail.com>
On Tue, 2026-03-10 at 12:18 -0400, John Kacur wrote:
>
> On Tue, 10 Mar 2026, Crystal Wood wrote:
>
> > On Mon, 2026-03-09 at 18:55 -0400, John Kacur wrote:
> > >
> > > On Sun, 1 Mar 2026, Lukas Beckmann wrote:
> > > > +static void rstat_setup(void)
> > > > +{
> > > > + int fd;
> > > > + pid_t pid;
> > > >
> > > > - if (mptr == (void*)-1)
> > > > - fprintf(stderr, "ERROR: mmap, %s\n", strerror(errno));
> > > > + pid = getpid();
> > > >
> > > > - return mptr;
> > > > -}
> > > > + snprintf(shm_name, SHM_BUF_SIZE, "%s%d", "/cyclictest", pid);
> > > >
> > > > -static int rstat_mlock(void *mptr)
> > > > -{
> > > > - int err;
> > >
> > > errno = 0 before the call to shm_unlink for good defensive programming
> > > other than that the patch looks good, I will do a little more testing
> >
> > Defensive against the library returning -1 without setting errno? Seems
> > a bit paranoid and cluttery... all for the payoff of an "ERROR:
> > shm_unlink Success" message if it ever does happen *and* the old errno
> > happened to be ENOENT.
> >
> > And the current code uses it even in places that print the message
> > regardless.
> >
> > -Crystal
> >
> >
>
> Isn't that what defensive programming is? Guarding against something that
> is unlikely? It's one line of code that I requested in a patch that gets
> rid of many lines of code, is that really worth arguing over?
Eh, it wasn't so much an argument over this patch, as a "we're supposed
to do *what* before each library call?" reflex.
-Crystal
prev parent reply other threads:[~2026-03-10 16:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 21:24 [PATCH 0/2] cyclictest: fix growing shm stat file Lukas Beckmann
2026-03-01 21:24 ` [PATCH 1/2] " Lukas Beckmann
2026-03-09 22:54 ` John Kacur
2026-03-01 21:24 ` [PATCH 2/2] cyclictest: simplify rstat_setup Lukas Beckmann
2026-03-09 22:55 ` John Kacur
2026-03-10 13:30 ` Crystal Wood
2026-03-10 16:18 ` John Kacur
2026-03-10 16:57 ` Crystal Wood [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c60136fdf3afa53f6dbf3dee78e57d3d2952ea9d.camel@redhat.com \
--to=crwood@redhat.com \
--cc=jkacur@gmail.com \
--cc=jkacur@redhat.com \
--cc=lbckmnn@mailbox.org \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox