Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2020 03:32:09 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r361408 - stable/12/lib/libc/tests/sys
Message-ID:  <202005230332.04N3W9x0010847@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sat May 23 03:32:08 2020
New Revision: 361408
URL: https://svnweb.freebsd.org/changeset/base/361408

Log:
  Revert mlock_helper.c test code changes from r361350.
  
  They were not intended to be merged, since the MFC did not change the
  max_wired sysctl name.  This is a direct commit to stable/12.
  
  Reported by:	lwhsu

Modified:
  stable/12/lib/libc/tests/sys/mlock_helper.c

Modified: stable/12/lib/libc/tests/sys/mlock_helper.c
==============================================================================
--- stable/12/lib/libc/tests/sys/mlock_helper.c	Fri May 22 22:17:44 2020	(r361407)
+++ stable/12/lib/libc/tests/sys/mlock_helper.c	Sat May 23 03:32:08 2020	(r361408)
@@ -39,16 +39,16 @@ __FBSDID("$FreeBSD$");
 #include <limits.h>
 #include <stdio.h>
 
-#define	VM_MAX_WIRED "vm.max_user_wired"
+#define	VM_MAX_WIRED "vm.max_wired"
 
 static void
-vm_max_wired_sysctl(u_long *old_value, u_long *new_value)
+vm_max_wired_sysctl(int *old_value, int *new_value)
 {
 	size_t old_len;
-	size_t new_len = (new_value == NULL ? 0 : sizeof(*new_value));
+	size_t new_len = (new_value == NULL ? 0 : sizeof(int));
 
 	if (old_value == NULL)
-		printf("Setting the new value to %lu\n", *new_value);
+		printf("Setting the new value to %d\n", *new_value);
 	else {
 		ATF_REQUIRE_MSG(sysctlbyname(VM_MAX_WIRED, NULL, &old_len,
 		    new_value, new_len) == 0,
@@ -60,14 +60,14 @@ vm_max_wired_sysctl(u_long *old_value, u_long *new_val
 	    "sysctlbyname(%s) failed: %s", VM_MAX_WIRED, strerror(errno));
 
 	if (old_value != NULL)
-		printf("Saved the old value (%lu)\n", *old_value);
+		printf("Saved the old value (%d)\n", *old_value);
 }
 
 void
-set_vm_max_wired(u_long new_value)
+set_vm_max_wired(int new_value)
 {
 	FILE *fp;
-	u_long old_value;
+	int old_value;
 
 	fp = fopen(VM_MAX_WIRED, "w");
 	if (fp == NULL) {
@@ -78,7 +78,7 @@ set_vm_max_wired(u_long new_value)
 
 	vm_max_wired_sysctl(&old_value, NULL);
 
-	ATF_REQUIRE_MSG(fprintf(fp, "%lu", old_value) > 0,
+	ATF_REQUIRE_MSG(fprintf(fp, "%d", old_value) > 0,
 	    "saving %s failed", VM_MAX_WIRED);
 
 	fclose(fp);
@@ -90,7 +90,7 @@ void
 restore_vm_max_wired(void)
 {
 	FILE *fp;
-	u_long saved_max_wired;
+	int saved_max_wired;
 
 	fp = fopen(VM_MAX_WIRED, "r");
 	if (fp == NULL) {
@@ -98,14 +98,14 @@ restore_vm_max_wired(void)
 		return;
 	}
 
-	if (fscanf(fp, "%lu", &saved_max_wired) != 1) {
+	if (fscanf(fp, "%d", &saved_max_wired) != 1) {
 		perror("fscanf failed\n");
 		fclose(fp);
 		return;
 	}
 
 	fclose(fp);
-	printf("old value in %s: %lu\n", VM_MAX_WIRED, saved_max_wired);
+	printf("old value in %s: %d\n", VM_MAX_WIRED, saved_max_wired);
 
 	if (saved_max_wired == 0) /* This will cripple the test host */
 		return;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005230332.04N3W9x0010847>