mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-09 19:00:08 +00:00
revert commit fdfd175d46
This commit is contained in:
parent
1670e207c5
commit
20c138997a
@ -4986,20 +4986,27 @@ __posix_memalign (void **memptr, size_t alignment, size_t size)
|
||||
}
|
||||
weak_alias (__posix_memalign, posix_memalign)
|
||||
|
||||
static inline void
|
||||
mi_arena (mstate ar_ptr,
|
||||
FILE *fp,
|
||||
size_t *total_nblocks,
|
||||
size_t *total_nfastblocks,
|
||||
size_t *total_avail,
|
||||
size_t *total_fastavail,
|
||||
size_t *total_system,
|
||||
size_t *total_max_system,
|
||||
size_t *total_aspace,
|
||||
size_t *total_aspace_mprotect)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
int
|
||||
malloc_info (int options, FILE *fp)
|
||||
{
|
||||
/* For now, at least. */
|
||||
if (options != 0)
|
||||
return EINVAL;
|
||||
|
||||
int n = 0;
|
||||
size_t total_nblocks = 0;
|
||||
size_t total_nfastblocks = 0;
|
||||
size_t total_avail = 0;
|
||||
size_t total_fastavail = 0;
|
||||
size_t total_system = 0;
|
||||
size_t total_max_system = 0;
|
||||
size_t total_aspace = 0;
|
||||
size_t total_aspace_mprotect = 0;
|
||||
|
||||
void
|
||||
mi_arena (mstate ar_ptr)
|
||||
{
|
||||
fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
|
||||
|
||||
size_t nblocks = 0;
|
||||
@ -5016,6 +5023,7 @@ mi_arena (mstate ar_ptr,
|
||||
#define nsizes (sizeof (sizes) / sizeof (sizes[0]))
|
||||
|
||||
mutex_lock (&ar_ptr->mutex);
|
||||
|
||||
for (size_t i = 0; i < NFASTBINS; ++i)
|
||||
{
|
||||
mchunkptr p = fastbin (ar_ptr, i);
|
||||
@ -5075,11 +5083,11 @@ mi_arena (mstate ar_ptr,
|
||||
|
||||
mutex_unlock (&ar_ptr->mutex);
|
||||
|
||||
*total_nfastblocks += nfastblocks;
|
||||
*total_fastavail += fastavail;
|
||||
total_nfastblocks += nfastblocks;
|
||||
total_fastavail += fastavail;
|
||||
|
||||
*total_nblocks += nblocks;
|
||||
*total_avail += avail;
|
||||
total_nblocks += nblocks;
|
||||
total_avail += avail;
|
||||
|
||||
for (size_t i = 0; i < nsizes; ++i)
|
||||
if (sizes[i].count != 0 && i != NFASTBINS)
|
||||
@ -5093,8 +5101,8 @@ mi_arena (mstate ar_ptr,
|
||||
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
|
||||
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
|
||||
|
||||
*total_system += ar_ptr->system_mem;
|
||||
*total_max_system += ar_ptr->max_system_mem;
|
||||
total_system += ar_ptr->system_mem;
|
||||
total_max_system += ar_ptr->max_system_mem;
|
||||
|
||||
fprintf (fp,
|
||||
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
|
||||
@ -5111,8 +5119,8 @@ mi_arena (mstate ar_ptr,
|
||||
"<aspace type=\"total\" size=\"%zu\"/>\n"
|
||||
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
|
||||
heap->size, heap->mprotect_size);
|
||||
*total_aspace += heap->size;
|
||||
*total_aspace_mprotect += heap->mprotect_size;
|
||||
total_aspace += heap->size;
|
||||
total_aspace_mprotect += heap->mprotect_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5120,28 +5128,12 @@ mi_arena (mstate ar_ptr,
|
||||
"<aspace type=\"total\" size=\"%zu\"/>\n"
|
||||
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
|
||||
ar_ptr->system_mem, ar_ptr->system_mem);
|
||||
*total_aspace += ar_ptr->system_mem;
|
||||
*total_aspace_mprotect += ar_ptr->system_mem;
|
||||
total_aspace += ar_ptr->system_mem;
|
||||
total_aspace_mprotect += ar_ptr->system_mem;
|
||||
}
|
||||
|
||||
fputs ("</heap>\n", fp);
|
||||
}
|
||||
|
||||
int
|
||||
malloc_info (int options, FILE *fp)
|
||||
{
|
||||
/* For now, at least. */
|
||||
if (options != 0)
|
||||
return EINVAL;
|
||||
|
||||
size_t total_nblocks = 0;
|
||||
size_t total_nfastblocks = 0;
|
||||
size_t total_avail = 0;
|
||||
size_t total_fastavail = 0;
|
||||
size_t total_system = 0;
|
||||
size_t total_max_system = 0;
|
||||
size_t total_aspace = 0;
|
||||
size_t total_aspace_mprotect = 0;
|
||||
}
|
||||
|
||||
if (__malloc_initialized < 0)
|
||||
ptmalloc_init ();
|
||||
@ -5152,9 +5144,7 @@ malloc_info (int options, FILE *fp)
|
||||
mstate ar_ptr = &main_arena;
|
||||
do
|
||||
{
|
||||
mi_arena (ar_ptr, fp, &total_nblocks, &total_nfastblocks, &total_avail,
|
||||
&total_fastavail, &total_system, &total_max_system,
|
||||
&total_aspace, &total_aspace_mprotect);
|
||||
mi_arena (ar_ptr);
|
||||
ar_ptr = ar_ptr->next;
|
||||
}
|
||||
while (ar_ptr != &main_arena);
|
||||
|
Loading…
Reference in New Issue
Block a user