NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/59996: swapctl: SWAP_STATS different to SWAP_NSWAP (1 != 3)



The following reply was made to PR bin/59996; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost, wiz%netbsd.org@localhost
Cc: 
Subject: Re: bin/59996: swapctl: SWAP_STATS different to SWAP_NSWAP (1 != 3)
Date: Thu, 12 Feb 2026 12:57:06 +0700

 As an alternative, if you just want to (hopefully) avoid seeing any of
 the error messages, you could try this patch to src/sbin/swapctl/swaplist.c
 
 But this is not what I would suggest as any kind of real solution.
 
 kre
 
 
 Index: swaplist.c
 ===================================================================
 RCS file: /cvsroot/src/sbin/swapctl/swaplist.c,v
 retrieving revision 1.19
 diff -u -r1.19 swaplist.c
 --- swaplist.c	11 Dec 2023 12:47:24 -0000	1.19
 +++ swaplist.c	12 Feb 2026 05:55:51 -0000
 @@ -73,9 +73,12 @@
  	fsep = sep = (struct swapent *)malloc(nswap * sizeof(*sep));
  	if (sep == NULL)
  		err(1, "malloc");
 -	rnswap = swapctl(SWAP_STATS, (void *)sep, nswap);
 -	if (rnswap < 0)
 -		err(1, "SWAP_STATS");
 +	i = 0;		/*XXX*/
 +	do {		/*XXX*/
 +		rnswap = swapctl(SWAP_STATS, (void *)sep, nswap);
 +		if (rnswap < 0)
 +			err(1, "SWAP_STATS");
 +	} while (nswap != rnswap && ++i < 5);	/*XXX*/
  	if (nswap != rnswap)
  		warnx("SWAP_STATS different to SWAP_NSWAP (%d != %d)",
  		    rnswap, nswap);
 


Home | Main Index | Thread Index | Old Index