Merge "Document the mallinfo struct, add missing attributes."

This commit is contained in:
Elliott Hughes 2013-02-04 21:53:17 +00:00 committed by Gerrit Code Review
commit a4f88fdcf0
2 changed files with 24 additions and 18 deletions

View file

@ -27,30 +27,30 @@
__BEGIN_DECLS
extern __mallocfunc void* malloc(size_t);
extern __mallocfunc void* calloc(size_t, size_t);
extern void* realloc(void *, size_t);
extern void free(void *);
extern void* malloc(size_t byte_count) __mallocfunc __wur;
extern void* calloc(size_t item_count, size_t item_size) __mallocfunc __wur;
extern void* realloc(void* p, size_t byte_count) __wur;
extern void free(void* p);
extern void* memalign(size_t alignment, size_t bytesize);
extern size_t malloc_usable_size(void*);
extern void* memalign(size_t alignment, size_t byte_count) __mallocfunc __wur;
extern size_t malloc_usable_size(void* p);
extern void* valloc(size_t bytesize);
extern void* pvalloc(size_t bytesize);
extern void* valloc(size_t byte_count) __mallocfunc __wur;
extern void* pvalloc(size_t byte_count) __mallocfunc __wur;
#ifndef STRUCT_MALLINFO_DECLARED
#define STRUCT_MALLINFO_DECLARED 1
struct mallinfo {
size_t arena;
size_t ordblks;
size_t smblks;
size_t hblks;
size_t hblkhd;
size_t usmblks;
size_t fsmblks;
size_t uordblks;
size_t fordblks;
size_t keepcost;
size_t arena; /* Total number of non-mmapped bytes currently allocated from OS. */
size_t ordblks; /* Number of free chunks. */
size_t smblks; /* (Unused.) */
size_t hblks; /* (Unused.) */
size_t hblkhd; /* Total number of bytes in mmapped regions. */
size_t usmblks; /* Maximum total allocated space; greater than total if trimming has occurred. */
size_t fsmblks; /* (Unused.) */
size_t uordblks; /* Total allocated space (normal or mmapped.) */
size_t fordblks; /* Total free space. */
size_t keepcost; /* Upper bound on number of bytes releasable by malloc_trim. */
};
#endif /* STRUCT_MALLINFO_DECLARED */

View file

@ -321,6 +321,12 @@
#define __always_inline
#endif
#if __GNUC_PREREQ__(3, 4)
#define __wur __attribute__((__warn_unused_result__))
#else
#define __wur
#endif
/*
* Macros for manipulating "link sets". Link sets are arrays of pointers
* to objects, which are gathered up by the linker.