Re: [PATCH 2/2] cyclictest: simplify rstat_setup
Crystal Wood <[email protected]>
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
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