* include/cygwin/version.h: Bump DLL minor number to 8.

* cygmalloc.h: Make more concessions to attempts to get debugging malloc
working.
* debug.h: Ditto.
* dlmalloc.cc: Ditto.
* dlmalloc.h: Ditto.
* malloc_wrapper.cc: Ditto.
* perthread.h (perthread::create): Use calloc to ensure zeroed memory.
This commit is contained in:
Christopher Faylor 2004-01-20 19:36:35 +00:00
parent 69c7680cf7
commit 67fcf127c1
8 changed files with 67 additions and 99 deletions

View File

@ -1,7 +1,24 @@
2004-01-20 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number to 8.
* cygmalloc.h: Make more concessions to attempts to get debugging
malloc working.
* debug.h: Ditto.
* dlmalloc.cc: Ditto.
* dlmalloc.h: Ditto.
* malloc_wrapper.cc: Ditto.
* perthread.h (perthread::create): Use calloc to ensure zeroed memory.
2004-01-20 Christopher Faylor <cgf@redhat.com>
* sec_acl.cc (setacl): Make sure sd_ret is large enough.
2004-01-19 Christopher Faylor <cgf@redhat.com>
* sec_acl.cc (setacl): Make sure return sd is large enough.
2004-01-19 Christopher Faylor <cgf@redhat.com>
* sigproc.cc (sigproc_terminate): Don't close sendsig handle when

View File

@ -8,16 +8,19 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
extern "C" void dlfree (void *p) __attribute__ ((regparm (1)));
extern "C" void *dlmalloc (unsigned size) __attribute__ ((regparm (1)));
extern "C" void *dlrealloc (void *p, unsigned size) __attribute__ ((regparm (2)));
extern "C" void *dlcalloc (size_t nmemb, size_t size) __attribute__ ((regparm (2)));
extern "C" void *dlmemalign (size_t alignment, size_t bytes) __attribute__ ((regparm (2)));
extern "C" void *dlvalloc (size_t bytes) __attribute__ ((regparm (1)));
extern "C" size_t dlmalloc_usable_size (void *p) __attribute__ ((regparm (1)));
extern "C" int dlmalloc_trim (size_t) __attribute__ ((regparm (1)));
extern "C" int dlmallopt (int p, int v) __attribute__ ((regparm (2)));
extern "C" void dlmalloc_stats ();
#ifdef __cplusplus
extern "C" {
#endif
void dlfree (void *p) __attribute__ ((regparm (1)));
void *dlmalloc (unsigned size) __attribute__ ((regparm (1)));
void *dlrealloc (void *p, unsigned size) __attribute__ ((regparm (2)));
void *dlcalloc (size_t nmemb, size_t size) __attribute__ ((regparm (2)));
void *dlmemalign (size_t alignment, size_t bytes) __attribute__ ((regparm (2)));
void *dlvalloc (size_t bytes) __attribute__ ((regparm (1)));
size_t dlmalloc_usable_size (void *p) __attribute__ ((regparm (1)));
int dlmalloc_trim (size_t) __attribute__ ((regparm (1)));
int dlmallopt (int p, int v) __attribute__ ((regparm (2)));
void dlmalloc_stats ();
#ifndef __INSIDE_CYGWIN__
# define USE_DL_PREFIX 1
@ -26,3 +29,6 @@ extern "C" void dlmalloc_stats ();
# define __malloc_unlock() mallock->release ()
extern muto *mallock;
#endif
#ifdef __cplusplus
}
#endif

View File

@ -7,6 +7,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include <malloc.h>
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"

View File

@ -28,6 +28,16 @@
* malloc_usable_size(P) is equivalent to realloc(P, malloc_usable_size(P))
*
* $Log$
* Revision 1.8 2004/01/20 19:36:34 cgf
* * include/cygwin/version.h: Bump DLL minor number to 8.
* * cygmalloc.h: Make more concessions to attempts to get debugging malloc
* working.
* * debug.h: Ditto.
* * dlmalloc.cc: Ditto.
* * dlmalloc.h: Ditto.
* * malloc_wrapper.cc: Ditto.
* * perthread.h (perthread::create): Use calloc to ensure zeroed memory.
*
* Revision 1.7 2003/09/25 00:37:16 cgf
* * devices.cc: New file.
* * devices.gperf: New file.
@ -533,7 +543,6 @@
/* Preliminaries */
#include "winsup.h"
#ifndef __STD_C
#ifdef __STDC__
@ -567,8 +576,11 @@
extern "C" {
#endif
#include <sys/types.h>
#include "cygmalloc.h"
#define __INSIDE_CYGWIN__
#include <stdio.h> /* needed for malloc_stats */
#include <string.h>
/*
Compile-time options
@ -2098,9 +2110,7 @@ static void malloc_err(const char *err, mchunkptr p)
/* avoid invalid pointers */
debug_file_min &&
p->file >= debug_file_min &&
p->file <= debug_file_max &&
/* try to avoid garbage file names */
isprint(*p->file))
p->file <= debug_file_max)
errprint(p->file, p->line, "in block allocated here");
# endif
}

View File

@ -41,18 +41,18 @@ struct mallinfo {
#ifdef MALLOC_DEBUG
#define dmalloc(size) malloc_dbg(size, __FILE__, __LINE__)
#define dfree(p) free_dbg(p, __FILE__, __LINE__)
#define drealloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__)
#define dcalloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__)
#define dmemalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__)
#define dvalloc(size) valloc_dbg(size, __FILE__, __LINE__)
#define dpvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__)
#define dmalloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__)
#define dmalloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__)
#define dmalloc_stats() malloc_stats_dbg(__FILE__, __LINE__)
#define dmallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__)
#define dmallinfo() mallinfo_dbg(__FILE__, __LINE__)
#define dlmalloc(size) malloc_dbg(size, __FILE__, __LINE__)
#define dlfree(p) free_dbg(p, __FILE__, __LINE__)
#define dlrealloc(p, size) realloc_dbg(p, size, __FILE__, __LINE__)
#define dlcalloc(n, size) calloc_dbg(n, size, __FILE__, __LINE__)
#define dlmemalign(align, size) memalign_dbg(align, size, __FILE__, __LINE__)
#define dlvalloc(size) valloc_dbg(size, __FILE__, __LINE__)
#define dlpvalloc(size) pvalloc_dbg(size, __FILE__, __LINE__)
#define dlmalloc_trim(pad) malloc_trim_dbg(pad, __FILE__, __LINE__)
#define dlmalloc_usable_size(p) malloc_usable_size_dbg(p, __FILE__, __LINE__)
#define dlmalloc_stats() malloc_stats_dbg(__FILE__, __LINE__)
#define dlmallopt(flag, val) mallopt_dbg(flag, val, __FILE__, __LINE__)
#define dlmallinfo() mallinfo_dbg(__FILE__, __LINE__)
#ifdef __cplusplus

View File

@ -42,7 +42,7 @@ details. */
changes to the DLL and is mainly informative in nature. */
#define CYGWIN_VERSION_DLL_MAJOR 1005
#define CYGWIN_VERSION_DLL_MINOR 7
#define CYGWIN_VERSION_DLL_MINOR 8
/* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
incompatible. */

View File

@ -24,7 +24,9 @@ details. */
#include "sync.h"
#include "perprocess.h"
#include "cygmalloc.h"
#ifndef MALLOC_DEBUG
#include <malloc.h>
#endif
extern "C" struct mallinfo dlmallinfo ();
/* we provide these stubs to call into a user's
@ -36,71 +38,6 @@ extern "C" struct mallinfo dlmallinfo ();
static int export_malloc_called;
static int use_internal_malloc = 1;
#ifdef MALLOC_DEBUG
extern "C" void * _sbrk (size_t incr_arg);
#if 0
extern "C" void *
_sbrk_r (struct _reent *, size_t incr_arg)
{
return _sbrk (incr_arg);
}
#endif
extern "C" void *
_malloc_r (struct _reent *, size_t size)
{
export_malloc_called = 1;
return malloc (size);
}
#undef malloc
extern "C" void *
_calloc_r (struct _reent *, size_t nmemb, size_t size)
{
export_malloc_called = 1;
return calloc (nmemb, size);
}
#undef calloc
extern "C" void
_free_r (struct _reent *, void *p)
{
export_malloc_called = 1;
assert (!incygheap (p));
assert (inheap (p));
free (p);
}
#undef free
extern "C" void *
_realloc_r (struct _reent *, void *p, size_t size)
{
export_malloc_called = 1;
assert (!incygheap (p));
assert (inheap (p));
return realloc (p, size);
}
#undef realloc
extern "C" char *
strdup_dbg (const char *s, const char *file, int line)
{
char *p;
export_malloc_called = 1;
if ((p = (char *) malloc_dbg (strlen (s) + 1, file, line)) != NULL)
strcpy (p, s);
return p;
}
#undef strdup
extern "C" char *
strdup (const char *s)
{
return strdup_dbg (s, __FILE__, __LINE__);
}
#else
#endif
/* These routines are used by the application if it
doesn't provide its own malloc. */
@ -317,18 +254,16 @@ malloc_init ()
{
new_muto (mallock);
#ifndef MALLOC_DEBUG
/* Check if mallock is provided by application. If so, redirect all
calls to malloc/free/realloc to application provided. This may
happen if some other dll calls cygwin's malloc, but main code provides
its own malloc */
if (!user_data->forkee)
{
#ifdef MALLOC_DEBUG
_free_r (NULL, _malloc_r (NULL, 16));
#else
user_data->free (user_data->malloc (16));
#endif
if (!export_malloc_called)
use_internal_malloc = 0;
}
#endif
}

View File

@ -28,8 +28,7 @@ public:
virtual void set (int n) {TlsSetValue (get_tls (), (void *)n);}
virtual void *create ()
{
void *s = new char [size ()];
memset (s, 0, size ());
void *s = calloc (1, size ());
set (s);
return s;
}