*** empty log message ***
[deliverable/binutils-gdb.git] / mmalloc / attach.c
index fcfb77255e2847e64ce600c705ec6abb5eb47ae6..2bd70bfdf05f3723f9aed4d8fca13c71942f0dda 100644 (file)
@@ -1,28 +1,33 @@
 /* Initialization for access to a mmap'd malloc managed region.
-   Copyright 1992 Free Software Foundation, Inc.
+   Copyright 1992, 2000 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 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"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>    /* Prototypes for lseek */
+#endif
+#include "mmprivate.h"
 
 #ifndef SEEK_SET
 #define SEEK_SET 0
@@ -101,8 +106,8 @@ mmalloc_attach (fd, baseaddr)
      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;
@@ -131,7 +136,7 @@ mmalloc_attach (fd, baseaddr)
 
   if ((mbase = mdp -> morecore (mdp, sizeof (mtemp))) != NULL)
     {
-      (void) memcpy (mbase, mdp, sizeof (mtemp));
+      memcpy (mbase, mdp, sizeof (mtemp));
       mdp = (struct mdesc *) mbase;
     }
   else
@@ -161,10 +166,10 @@ mmalloc_attach (fd, baseaddr)
    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. */
@@ -190,7 +195,7 @@ reuse (fd)
          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);
            }
        }
     }
This page took 0.026005 seconds and 4 git commands to generate.