lmbench: lat_fifo: Fix cleanup sequence

Files should be unlinked after all users exit. Otherwise we might experience
(w) read/write on pipe: No such file or directory

Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
He Zhe
2021-01-22 18:16:52 +08:00
committed by Khem Raj
parent 51614ac651
commit 36b25ecd94
2 changed files with 43 additions and 0 deletions
@@ -0,0 +1,42 @@
From 78912c0ac5e090095a2f2bd6226e02cce949e72e Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Fri, 22 Jan 2021 10:03:38 +0000
Subject: [PATCH] lat_fifo: Fix cleanup sequence
Files should be unlinked after all users exit.
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
src/lat_fifo.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lat_fifo.c b/src/lat_fifo.c
index c625161..85bb9d1 100644
--- a/src/lat_fifo.c
+++ b/src/lat_fifo.c
@@ -120,16 +120,16 @@ cleanup(iter_t iterations, void * cookie)
if (iterations) return;
- unlink(state->filename1);
- unlink(state->filename2);
- close(state->wr);
- close(state->rd);
-
if (state->pid > 0) {
- kill(state->pid, 15);
+ kill(state->pid, SIGKILL);
waitpid(state->pid, NULL, 0);
state->pid = 0;
}
+
+ unlink(state->filename1);
+ unlink(state->filename2);
+ close(state->wr);
+ close(state->rd);
}
void
--
2.29.2
@@ -28,6 +28,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
file://0001-src-Makefile-use-libdir-instead-of-hardcoded-lib.patch \
file://0001-lmbench-Point-webpage-lm-to-target-directory.patch \
file://0001-doc-Fix-typos-in-manual-pages.patch \
file://0001-lat_fifo-Fix-cleanup-sequence.patch \
"
SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"