diff options
author | Martin Liska <mliska@suse.cz> | 2020-07-07 13:58:24 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-08-31 08:58:20 +0200 |
commit | e3960d1c57e57f33e0e846d615788f4ede73b945 (patch) | |
tree | 460d4f54f4d15484cf6bf639e38d6d2ab01fa438 /malloc/malloc.h | |
parent | 85f184893729e2fb8cf8b873d5371628c3ad9e92 (diff) | |
download | glibc-e3960d1c57e57f33e0e846d615788f4ede73b945.zip glibc-e3960d1c57e57f33e0e846d615788f4ede73b945.tar.gz glibc-e3960d1c57e57f33e0e846d615788f4ede73b945.tar.bz2 |
Add mallinfo2 function that support sizes >= 4GB.
The current int type can easily overflow for allocation of more
than 4GB.
Diffstat (limited to 'malloc/malloc.h')
-rw-r--r-- | malloc/malloc.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/malloc/malloc.h b/malloc/malloc.h index e0e91a9..e25b334 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -97,9 +97,30 @@ struct mallinfo int keepcost; /* top-most, releasable (via malloc_trim) space */ }; +/* SVID2/XPG mallinfo2 structure which can handle allocations + bigger than 4GB. */ + +struct mallinfo2 +{ + size_t arena; /* non-mmapped space allocated from system */ + size_t ordblks; /* number of free chunks */ + size_t smblks; /* number of fastbin blocks */ + size_t hblks; /* number of mmapped regions */ + size_t hblkhd; /* space in mmapped regions */ + size_t usmblks; /* always 0, preserved for backwards compatibility */ + size_t fsmblks; /* space available in freed fastbin blocks */ + size_t uordblks; /* total allocated space */ + size_t fordblks; /* total free space */ + size_t keepcost; /* top-most, releasable (via malloc_trim) space */ +}; + /* Returns a copy of the updated current mallinfo. */ +__MALLOC_DEPRECATED; extern struct mallinfo mallinfo (void) __THROW; +/* Returns a copy of the updated current mallinfo. */ +extern struct mallinfo2 mallinfo2 (void) __THROW; + /* SVID2/XPG mallopt options */ #ifndef M_MXFAST # define M_MXFAST 1 /* maximum request size for "fastbins" */ |