diff options
author | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:34:07 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:34:07 +0000 |
commit | 071ea11e85eb9d529cc5eb3d35f6247466a21b99 (patch) | |
tree | 5deda65b8d7b04d1f4cbc534c3206d328e1267ec /mmalloc/sbrk-sup.c | |
parent | 1730ec6b1848f0f32154277f788fb29f88d8475b (diff) | |
download | gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.zip gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.tar.gz gdb-071ea11e85eb9d529cc5eb3d35f6247466a21b99.tar.bz2 |
Initial creation of sourceware repository
Diffstat (limited to 'mmalloc/sbrk-sup.c')
-rw-r--r-- | mmalloc/sbrk-sup.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/mmalloc/sbrk-sup.c b/mmalloc/sbrk-sup.c deleted file mode 100644 index f6efa17..0000000 --- a/mmalloc/sbrk-sup.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Support for sbrk() regions. - Copyright 1992 Free Software Foundation, Inc. - Contributed by Fred Fish at Cygnus Support. fnf@cygnus.com - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -#include <string.h> /* Prototypes for memcpy, memmove, memset, etc */ - -#include "mmalloc.h" - -extern PTR sbrk (); - -/* The mmalloc() package can use a single implicit malloc descriptor - for mmalloc/mrealloc/mfree operations which do not supply an explicit - descriptor. For these operations, sbrk() is used to obtain more core - from the system, or return core. This allows mmalloc() to provide - backwards compatibility with the non-mmap'd version. */ - -struct mdesc *__mmalloc_default_mdp; - -/* Use sbrk() to get more core. */ - -static PTR -sbrk_morecore (mdp, size) - struct mdesc *mdp; - int size; -{ - PTR result; - - if ((result = sbrk (size)) != NULL) - { - mdp -> breakval += size; - mdp -> top += size; - } - return (result); -} - -/* Initialize the default malloc descriptor if this is the first time - a request has been made to use the default sbrk'd region. */ - -struct mdesc * -__mmalloc_sbrk_init () -{ - PTR base; - - base = sbrk (0); - __mmalloc_default_mdp = (struct mdesc *) sbrk (sizeof (struct mdesc)); - (void) memset ((char *) __mmalloc_default_mdp, 0, sizeof (struct mdesc)); - __mmalloc_default_mdp -> morecore = sbrk_morecore; - __mmalloc_default_mdp -> base = base; - __mmalloc_default_mdp -> breakval = __mmalloc_default_mdp -> top = sbrk (0); - __mmalloc_default_mdp -> fd = -1; - return (__mmalloc_default_mdp); -} - - |