public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@gmail.com>
To: Crystal Wood <crwood@redhat.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 12:18:09 -0400 (EDT)	[thread overview]
Message-ID: <85147e31-053f-1b0f-e200-5d49c1b8b123@gmail.com> (raw)
In-Reply-To: <9ff2d632fbbc58fda5509a26f0dee26d6c3aefcd.camel@redhat.com>



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?

John Kacur

  reply	other threads:[~2026-03-10 16:18 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 [this message]
2026-03-10 16:57         ` Crystal Wood

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=85147e31-053f-1b0f-e200-5d49c1b8b123@gmail.com \
    --to=jkacur@gmail.com \
    --cc=crwood@redhat.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