Move mallinfo from stdlib.h to malloc.h

mallinfo is meant to be API compatible with Linux,
where it's provided by malloc.h.

Make stdlib.h include malloc.h for now. It can be removed
once all users are updated to include malloc.h instead of
stdlib.h.

I have some app code which uses mallinfo(). I want to share
it between platforms. This commit allows me to reduce
platform-ifdefs.

(I think the API actually originated with System V. I don't
remember how it was there though. Anyway, I guess the
compatibility with Linux is more important than System V
these days.)
This commit is contained in:
YAMAMOTO Takashi
2020-06-15 11:38:55 +09:00
committed by patacongo
parent 5fbf52788f
commit f1814dfca8
2 changed files with 64 additions and 14 deletions
+1 -14
View File
@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <errno.h>
#include <malloc.h>
#include <stdint.h>
#include <limits.h>
@@ -71,18 +72,6 @@
* Public Type Definitions
****************************************************************************/
struct mallinfo
{
int arena; /* This is the total size of memory allocated
* for use by malloc in bytes. */
int ordblks; /* This is the number of free (not in use) chunks */
int mxordblk; /* Size of the largest free (not in use) chunk */
int uordblks; /* This is the total size of memory occupied by
* chunks handed out by malloc. */
int fordblks; /* This is the total size of memory occupied
* by free (not in use) chunks. */
};
/* Structure type returned by the div() function. */
struct div_s
@@ -274,8 +263,6 @@ static inline int posix_memalign(FAR void **m, size_t a, size_t s)
#define posix_memalign(m, a, s) ((*(m) = memalign((a), (s))) ? OK : ENOMEM)
#endif
struct mallinfo mallinfo(void);
/* Pseudo-Terminals */
#ifdef CONFIG_PSEUDOTERM_SUSV1