Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys Remove hardcoded VM_MIN_ADDRESS and inste...
details: https://anonhg.NetBSD.org/src/rev/840ae3a6daee
branches: trunk
changeset: 327073:840ae3a6daee
user: martin <martin%NetBSD.org@localhost>
date: Wed Feb 26 20:49:26 2014 +0000
description:
Remove hardcoded VM_MIN_ADDRESS and instead query current value via
sysctl vm.minaddress.
diffstat:
tests/lib/libc/sys/t_mlock.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diffs (45 lines):
diff -r 8685823df40a -r 840ae3a6daee tests/lib/libc/sys/t_mlock.c
--- a/tests/lib/libc/sys/t_mlock.c Wed Feb 26 20:33:53 2014 +0000
+++ b/tests/lib/libc/sys/t_mlock.c Wed Feb 26 20:49:26 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mlock.c,v 1.4 2012/09/08 12:25:05 martin Exp $ */
+/* $NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,13 +29,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mlock.c,v 1.4 2012/09/08 12:25:05 martin Exp $");
+__RCSID("$NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $");
#include <sys/mman.h>
#include <sys/resource.h>
+#include <sys/sysctl.h>
#include <sys/wait.h>
-#define _KMEMUSER
-#include <machine/vmparam.h>
#include <errno.h>
#include <atf-c.h>
@@ -80,13 +79,16 @@
ATF_TC_BODY(mlock_err, tc)
{
+ unsigned long vmin = 0;
+ size_t len = sizeof(vmin);
void *invalid_ptr;
int null_errno = ENOMEM; /* error expected for NULL */
-#ifdef VM_MIN_ADDRESS
- if ((uintptr_t)VM_MIN_ADDRESS > 0)
+ if (sysctlbyname("vm.minaddress", &vmin, &len, NULL, 0) != 0)
+ atf_tc_fail("failed to read vm.minaddress");
+
+ if (vmin > 0)
null_errno = EINVAL; /* NULL is not inside user VM */
-#endif
errno = 0;
ATF_REQUIRE_ERRNO(null_errno, mlock(NULL, page) == -1);
Home |
Main Index |
Thread Index |
Old Index