mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 01:58:20 +00:00
Use mallinfo2() instead of mallinfo() when available
glibc 2.33 deprecates mallinfo in favor of a struct that returns its members as size_ts instead of ints.
This commit is contained in:
parent
727fca26e3
commit
63259ef9fa
3 changed files with 10 additions and 4 deletions
|
@ -25,7 +25,7 @@
|
|||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#ifdef HAVE_MALLINFO
|
||||
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -2188,9 +2188,12 @@ void get_memory_usage(uint64_t* total, uint64_t* malloced)
|
|||
{
|
||||
uint64_t ret_total;
|
||||
|
||||
#ifdef HAVE_MALLINFO
|
||||
#if defined(HAVE_MALLINFO2) || defined(HAVE_MALLINFO)
|
||||
#ifdef HAVE_MALLINFO2
|
||||
struct mallinfo2 mi = mallinfo2();
|
||||
#else
|
||||
struct mallinfo mi = mallinfo();
|
||||
|
||||
#endif
|
||||
if ( malloced )
|
||||
*malloced = mi.uordblks;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue