diff options
| author | manu <manu@NetBSD.org> | 2001-03-15 19:18:20 +0000 |
|---|---|---|
| committer | manu <manu@NetBSD.org> | 2001-03-15 19:18:20 +0000 |
| commit | 1208df7bdf22a8729c588252ec82820fe3387d5a (patch) | |
| tree | 2309135fda60c5d0be7791e7434eb8a352fbff3f /sys/compat/linux/common/linux_misc.c | |
| parent | 8c5e25e4869110a80263c49b3b7a8e7fdaf2fd8e (diff) | |
Fixed brk() emulation. We now keep track of the processes' idea of the
break value. See http://mail-index.netbsd.org/tech-kern/2001/03/15/0000.html
for more details.
Diffstat (limited to 'sys/compat/linux/common/linux_misc.c')
| -rw-r--r-- | sys/compat/linux/common/linux_misc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/compat/linux/common/linux_misc.c b/sys/compat/linux/common/linux_misc.c index 9aa94cfe73b..37789e5ec81 100644 --- a/sys/compat/linux/common/linux_misc.c +++ b/sys/compat/linux/common/linux_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.83 2001/01/05 15:31:15 fvdl Exp $ */ +/* $NetBSD: linux_misc.c,v 1.84 2001/03/15 19:18:20 manu Exp $ */ /*- * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. @@ -110,6 +110,7 @@ #include <compat/linux/common/linux_misc.h> #include <compat/linux/common/linux_ptrace.h> #include <compat/linux/common/linux_reboot.h> +#include <compat/linux/common/linux_emuldata.h> const int linux_ptrace_request_map[] = { LINUX_PTRACE_TRACEME, PT_TRACE_ME, @@ -231,18 +232,17 @@ linux_sys_brk(p, v, retval) caddr_t oldbrk; 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) + if ((caddr_t) nbrk > vm->vm_daddr && sys_obreak(p, &oba, retval) == 0) { + ((struct linux_emuldata*)(p->p_emuldata))->p_break = (char*)nbrk; retval[0] = (register_t)nbrk; - else - retval[0] = (register_t)oldbrk; + } + else { + retval[0] = + (register_t)((struct linux_emuldata*)(p->p_emuldata))->p_break; + } return 0; } |
