about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/brk.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-07-11 17:16:47 +0000
committerRoland McGrath <roland@gnu.org>1999-07-11 17:16:47 +0000
commitc6496762e45d8cefb701a22e6d5b311ba35770e0 (patch)
tree14343187ca81c0d87d1c5e1476224295964f7e41 /sysdeps/mach/hurd/brk.c
parent78d37b350020d4bef2763d4f048fbd266796563a (diff)
downloadglibc-c6496762e45d8cefb701a22e6d5b311ba35770e0.tar.gz
glibc-c6496762e45d8cefb701a22e6d5b311ba35770e0.tar.xz
glibc-c6496762e45d8cefb701a22e6d5b311ba35770e0.zip
* sysdeps/mach/hurd/brk.c (static_data_start): New variable.
	(_hurd_set_brk, init_brk): Use that instead of &__data_start.
	Initialize it from &__data_start if defined, or else &_end.

1999-07-11  Roland McGrath  <roland@baalperazim.frob.com>
Diffstat (limited to 'sysdeps/mach/hurd/brk.c')
-rw-r--r--sysdeps/mach/hurd/brk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index c6eabb21d8..3a5ed54247 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 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,99 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
@@ -41,6 +41,8 @@ weak_alias (_hurd_brk, ___brk_addr)
 struct mutex _hurd_brk_lock;
 
 extern int __data_start, _end;
+weak_extern (__data_start)
+static vm_address_t static_data_start;
 
 
 /* Set the end of the process's data space to INADDR.
@@ -81,7 +83,7 @@ _hurd_set_brk (vm_address_t addr)
   rlimit = _hurd_rlimits[RLIMIT_DATA].rlim_cur;
   __mutex_unlock (&_hurd_rlimit_lock);
 
-  if (addr - (vm_address_t) &__data_start > rlimit)
+  if (addr - static_data_start > rlimit)
     {
       /* Need to increase the resource limit.  */
       errno = ENOMEM;
@@ -114,6 +116,8 @@ init_brk (void)
 
   __mutex_init (&_hurd_brk_lock);
 
+  static_data_start = (vm_address_t) (&__data_start ?: &_end);
+
   /* If _hurd_brk is already set, don't change it.  The assumption is that
      it was set in a previous run before something like Emacs's unexec was
      called and dumped all the data up to the break at that point.  */
@@ -122,7 +126,7 @@ init_brk (void)
 
   pagend = round_page (_hurd_brk);
 
-  _hurd_data_end = round_page ((vm_address_t) &__data_start + DATA_SIZE);
+  _hurd_data_end = round_page (static_data_start + DATA_SIZE);
 
   if (pagend < _hurd_data_end)
     {