public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Beckmann <lbckmnn@mailbox.org>
To: John Kacur <jkacur@redhat.com>
Cc: rt-users <linux-rt-users@vger.kernel.org>,
	Lukas Beckmann <lbckmnn@mailbox.org>
Subject: [PATCH 1/2] cyclictest: fix growing shm stat file
Date: Sun,  1 Mar 2026 22:24:06 +0100	[thread overview]
Message-ID: <20260301212407.3146506-2-lbckmnn@mailbox.org> (raw)
In-Reply-To: <20260301212407.3146506-1-lbckmnn@mailbox.org>

On a received USR2 signal, the current statistics are written to a file
in shared memory. Before that happens, it is truncated to zero to clear
it.

However, currently the shm file keeps growing with each received signal
because the seek pointer is not updated by ftruncate.

This is fixed by calling fseek after truncating.

Signed-off-by: Lukas Beckmann <lbckmnn@mailbox.org>
---
 src/cyclictest/cyclictest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 191945e..960c905 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1472,6 +1472,7 @@ static void sighand(int sig)
 			return;
 		}
 		rstat_ftruncate(rstat_fd, 0);
+		lseek(rstat_fd, 0, SEEK_SET);
 		quiet = 0;
 		dprintf(rstat_fd, "#---------------------------\n");
 		dprintf(rstat_fd, "# cyclictest current status:\n");
-- 
2.53.0


  reply	other threads:[~2026-03-01 21:24 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 ` Lukas Beckmann [this message]
2026-03-09 22:54   ` [PATCH 1/2] " 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

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=20260301212407.3146506-2-lbckmnn@mailbox.org \
    --to=lbckmnn@mailbox.org \
    --cc=jkacur@redhat.com \
    --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