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 file is part of the GNU C Library.
-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.
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
-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. */
+The GNU C Library 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
+Library General Public License for more details.
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
-#include <fcntl.h>
#include <sys/types.h>
+#include <fcntl.h> /* After sys/types.h, at least for dpx/2. */
#include <sys/stat.h>
#include <string.h>
-#include "mmalloc.h"
+#include "mmprivate.h"
#ifndef SEEK_SET
#define SEEK_SET 0
then initialize the fields that we know values for. */
mdp = &mtemp;
- (void) memset ((char *) mdp, 0, sizeof (mtemp));
- (void) strncpy (mdp -> magic, MMALLOC_MAGIC, MMALLOC_MAGIC_SIZE);
+ memset ((char *) mdp, 0, sizeof (mtemp));
+ strncpy (mdp -> magic, MMALLOC_MAGIC, MMALLOC_MAGIC_SIZE);
mdp -> headersize = sizeof (mtemp);
mdp -> version = MMALLOC_VERSION;
mdp -> morecore = __mmalloc_mmap_morecore;
if ((mbase = mdp -> morecore (mdp, sizeof (mtemp))) != NULL)
{
- (void) memcpy (mbase, mdp, sizeof (mtemp));
+ memcpy (mbase, mdp, sizeof (mtemp));
mdp = (struct mdesc *) mbase;
}
else
certainly will be at a different address if the process reusing the
mapped region is from a different executable.
- Also note that if the heap being remapped previously used the mmcheck()
+ Also note that if the heap being remapped previously used the mmcheckf()
routines, we need to update the hooks since their target functions
will have certainly moved if the executable has changed in any way.
- We do this by calling mmcheck() internally.
+ We do this by calling mmcheckf() internally.
Returns a pointer to the malloc descriptor if successful, or NULL if
unsuccessful for some reason. */
mdp -> morecore = __mmalloc_mmap_morecore;
if (mdp -> mfree_hook != NULL)
{
- (void) mmcheck ((PTR) mdp, (void (*) PARAMS ((void))) NULL);
+ mmcheckf ((PTR) mdp, (void (*) PARAMS ((void))) NULL, 1);
}
}
}