[PATCH net] selftests/net: tcp_mmap: remove unused -k option and keepflag
From: Greg Thelen
Date: Wed Oct 21 2026 - 11:34:49 EST
Commit aacb0c2e524c ("selftests: net: tcp_mmap must use
TCP_ZEROCOPY_RECEIVE") removed the only read of keepflag in child_thread(),
leaving the file-scope keepflag variable set by the -k option in main() but
never read. This triggers a Clang 23 warning:
tcp_mmap.c:91:12: error: variable 'keepflag' set but not used
[-Werror,-Wunused-but-set-global]
Remove the unused keepflag variable and the dead -k getopt option.
Fixes: aacb0c2e524c ("selftests: net: tcp_mmap must use TCP_ZEROCOPY_RECEIVE")
Signed-off-by: Greg Thelen <gthelen@xxxxxxxxxx>
---
tools/testing/selftests/net/tcp_mmap.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 487ae659a1f1..86241bed7f08 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -85,7 +85,6 @@ static int rcvbuf; /* Default: autotuning. Can be set with -r <integer> option
static int sndbuf; /* Default: autotuning. Can be set with -w <integer> option */
static int zflg; /* zero copy option. (MSG_ZEROCOPY for sender, mmap() for receiver */
static int xflg; /* hash received data (simple xor) (-h option) */
-static int keepflag; /* -k option: receiver shall keep all received file in memory (no munmap() calls) */
static int integrity; /* -i option: sender and receiver compute sha256 over the data.*/
static size_t chunk_size = 512*1024;
@@ -456,7 +455,7 @@ int main(int argc, char *argv[])
int sflg = 0;
int mss = 0;
- while ((c = getopt(argc, argv, "46p:svr:w:H:zxkP:M:C:a:i")) != -1) {
+ while ((c = getopt(argc, argv, "46p:svr:w:H:zxP:M:C:a:i")) != -1) {
switch (c) {
case '4':
cfg_family = PF_INET;
@@ -490,9 +489,6 @@ int main(int argc, char *argv[])
case 'x':
xflg = 1;
break;
- case 'k':
- keepflag = 1;
- break;
case 'P':
max_pacing_rate = atoi(optarg) ;
break;
--
2.56.0.212.g129ede20d9-goog