From 27a941c0a67edfddbf8f858f4913daf2756a7a30 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 23 May 2020 03:32:08 +0000 Subject: [PATCH] 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 --- lib/libc/tests/sys/mlock_helper.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/libc/tests/sys/mlock_helper.c b/lib/libc/tests/sys/mlock_helper.c index a483207aa5d..86bbf9ad4d5 100644 --- a/lib/libc/tests/sys/mlock_helper.c +++ b/lib/libc/tests/sys/mlock_helper.c @@ -39,16 +39,16 @@ __FBSDID("$FreeBSD$"); #include #include -#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_value) "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; -- 2.45.0