diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-05-10 15:31:37 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-05-10 15:57:27 -0700 |
commit | 1043890b10996ec4b14cd01040b82610760d5d4a (patch) | |
tree | fd48346a9d254ea89a8cd182cd044806bd07eabd /sysdeps/mach/hurd/brk.c | |
parent | 37ed8b9bdc820a23d5884132d0278d9e42942fd3 (diff) | |
download | glibc-1043890b10996ec4b14cd01040b82610760d5d4a.tar.gz glibc-1043890b10996ec4b14cd01040b82610760d5d4a.tar.xz glibc-1043890b10996ec4b14cd01040b82610760d5d4a.zip |
Hurd: Fix sbrk beyond 128MB
Diffstat (limited to 'sysdeps/mach/hurd/brk.c')
-rw-r--r-- | sysdeps/mach/hurd/brk.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c index 275d7bea3a..1900277d1b 100644 --- a/sysdeps/mach/hurd/brk.c +++ b/sysdeps/mach/hurd/brk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -63,7 +63,7 @@ weak_alias (__brk, brk) int _hurd_set_brk (vm_address_t addr) { - error_t err; + error_t err = 0; vm_address_t pagend = round_page (addr); vm_address_t pagebrk = round_page (_hurd_brk); long int rlimit; @@ -100,8 +100,22 @@ _hurd_set_brk (vm_address_t addr) if (pagend > _hurd_data_end) { + vm_address_t alloc_start = _hurd_data_end; + /* We didn't allocate enough space! Hopefully we can get some more! */ - err = __vm_allocate (__mach_task_self (), &pagebrk, pagend - pagebrk, 0); + + if (_hurd_data_end > pagebrk) + /* First finish allocation. */ + err = __vm_protect (__mach_task_self (), pagebrk, + alloc_start - pagebrk, 0, + VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + if (! err) + _hurd_brk = alloc_start; + + if (! err) + err = __vm_allocate (__mach_task_self (), &alloc_start, + pagend - alloc_start, 0); + if (! err) _hurd_data_end = pagend; } |