mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +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
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit cce53d15008a26dcb1b7eb534a78f52f9355c676
|
Subproject commit dcc0c42f9d0777cbe53642a4683709b6da58b896
|
|
@ -25,7 +25,7 @@
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
#ifdef HAVE_MALLINFO
|
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2188,9 +2188,12 @@ void get_memory_usage(uint64_t* total, uint64_t* malloced)
|
||||||
{
|
{
|
||||||
uint64_t ret_total;
|
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();
|
struct mallinfo mi = mallinfo();
|
||||||
|
#endif
|
||||||
if ( malloced )
|
if ( malloced )
|
||||||
*malloced = mi.uordblks;
|
*malloced = mi.uordblks;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
/* Define if you have the `mallinfo' function. */
|
/* Define if you have the `mallinfo' function. */
|
||||||
#cmakedefine HAVE_MALLINFO
|
#cmakedefine HAVE_MALLINFO
|
||||||
|
|
||||||
|
/* Define if you have the `mallinfo2' function. */
|
||||||
|
#cmakedefine HAVE_MALLINFO2
|
||||||
|
|
||||||
/* Define if you have the <memory.h> header file. */
|
/* Define if you have the <memory.h> header file. */
|
||||||
#cmakedefine HAVE_MEMORY_H
|
#cmakedefine HAVE_MEMORY_H
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue