summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/svr4/svr4_misc.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 1a509b1da03..b83b6957d75 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_misc.c,v 1.21 1999/02/10 00:16:12 niklas Exp $ */
+/* $OpenBSD: svr4_misc.c,v 1.22 1999/02/26 04:12:00 art Exp $ */
/* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */
/*
@@ -87,6 +87,10 @@
#include <vm/vm.h>
+#if defined(UVM)
+#include <uvm/uvm_extern.h>
+#endif
+
static __inline clock_t timeval_to_clock_t __P((struct timeval *));
static int svr4_setinfo __P((struct proc *, int, svr4_siginfo_t *));
@@ -535,10 +539,18 @@ svr4_sys_sysconfig(p, v, retval)
*retval = 3; /* XXX: real, virtual, profiling */
break;
case SVR4_CONFIG_PHYS_PAGES:
+#if defined(UVM)
+ *retval = uvmexp.npages;
+#else
*retval = cnt.v_free_count; /* XXX: free instead of total */
+#endif
break;
case SVR4_CONFIG_AVPHYS_PAGES:
+#if defined(UVM)
+ *retval = uvmexp.active; /* XXX: active instead of avg */
+#else
*retval = cnt.v_active_count; /* XXX: active instead of avg */
+#endif
break;
default:
return EINVAL;
@@ -627,7 +639,15 @@ svr4_sys_break(p, v, retval)
DPRINTF(("break(3): old %lx new %lx diff %x\n", old, new, diff));
if (diff > 0) {
+#if defined(UVM)
+ rv = uvm_map(&vm->vm_map, &old, diff, NULL, UVM_UNKNOWN_OFFSET,
+ UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
+ UVM_ADV_NORMAL,
+ UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED|
+ UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW));
+#else
rv = vm_allocate(&vm->vm_map, &old, diff, FALSE);
+#endif
if (rv != KERN_SUCCESS) {
uprintf("sbrk: grow failed, return = %d\n", rv);
return ENOMEM;
@@ -635,7 +655,11 @@ svr4_sys_break(p, v, retval)
vm->vm_dsize += btoc(diff);
} else if (diff < 0) {
diff = -diff;
+#if defined(UVM)
+ rv = uvm_deallocate(&vm->vm_map, new, diff);
+#else
rv = vm_deallocate(&vm->vm_map, new, diff);
+#endif
if (rv != KERN_SUCCESS) {
uprintf("sbrk: shrink failed, return = %d\n", rv);
return ENOMEM;