summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_misc.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-06-21 00:42:58 +0000
committertedu <tedu@openbsd.org>2003-06-21 00:42:58 +0000
commitabc163f4e9df06580f71a3ec0c9e7280b4738947 (patch)
treeeb1b9c0d72753d687b523cf0721b637edfacd421 /sys/compat/linux/linux_misc.c
parentminor grammar (diff)
downloadwireguard-openbsd-abc163f4e9df06580f71a3ec0c9e7280b4738947.tar.xz
wireguard-openbsd-abc163f4e9df06580f71a3ec0c9e7280b4738947.zip
add exec/fork/exit hooks per process for compat emulations.
use them to correctly emulate linux brk. update to TNF copyright in linux_exec.c. from netbsd, mostly from a diff by Kurt Miller in pr3318. this should fix java. no regressions in testing by kurt and sturm@. be prepared for "proc size mismatch" -- recompile ps and friends. ok deraadt@
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r--sys/compat/linux/linux_misc.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 988f9a5eca5..2f8a63b63b6 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_misc.c,v 1.48 2003/01/30 03:29:49 millert Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.49 2003/06/21 00:42:58 tedu Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*
@@ -77,6 +77,7 @@
#include <compat/linux/linux_syscallargs.h>
#include <compat/linux/linux_util.h>
#include <compat/linux/linux_dirent.h>
+#include <compat/linux/linux_emuldata.h>
#include <compat/common/compat_dir.h>
@@ -333,21 +334,16 @@ linux_sys_brk(p, v, retval)
char *nbrk = SCARG(uap, nsize);
struct sys_obreak_args oba;
struct vmspace *vm = p->p_vmspace;
- caddr_t oldbrk;
+ struct linux_emuldata *ed = (struct linux_emuldata*)p->p_emuldata;
- oldbrk = vm->vm_daddr + ctob(vm->vm_dsize);
- /*
- * XXX inconsistent.. Linux always returns at least the old
- * brk value, but it will be page-aligned if this fails,
- * and possibly not page aligned if it succeeds (the user
- * supplied pointer is returned).
- */
SCARG(&oba, nsize) = nbrk;
if ((caddr_t) nbrk > vm->vm_daddr && sys_obreak(p, &oba, retval) == 0)
- retval[0] = (register_t)nbrk;
+ ed->p_break = (char*)nbrk;
else
- retval[0] = (register_t)oldbrk;
+ nbrk = ed->p_break;
+
+ retval[0] = (register_t)nbrk;
return 0;
}