506967 Implement and override mallinfo2
506970 mmap needs an EBADF fd_allowed check
507173 s390x: Crash when constant folding is disabled
+507721 Wire up illumos and Solaris mallinfo
507853 faccessat and faccessat2 should handle AT_FDCWD and absolute paths
507868 futimesat doesn't handle AT_FDCWD
507873 Make fchmodat and fchmodat2 syscall wrappers accept AT_FDCWD
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([rt], [timer_delete])
+if test "$VGCONF_OS" = "solaris" ; then
+# for mallinfo
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="$saved_LDFLAGS -lmalloc"
+fi
+
AC_CHECK_FUNCS([ \
aligned_alloc \
clock_gettime\
exterrctl
])
+if test "$VGCONF_OS" = "solaris" ; then
+LDFLAGS="$saved_LDFLAGS"
+fi
+
# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
# libraries with any shared object and/or executable. This is NOT what we
# want for e.g. vgpreload_core-x86-linux.so
mi->keepcost = 0; // may want some value in here
}
+#if defined(VGO_linux)
// The aforementioned older function, mallinfo(), is deprecated since the type
// used for the fields is too small.
void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi )
mi->fordblks = free_blocks_size + VG_(free_queue_volume);
mi->keepcost = 0; // may want some value in here
}
+#endif
SizeT VG_(arena_redzone_size) ( ArenaId aid )
{
MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
MALLINFO(SO_SYN_MALLOC, mallinfo);
-#elif defined(VGO_darwin)
- //MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
+#elif defined(VGO_solaris)
+ MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
+ MALLINFO(SO_SYN_MALLOC, mallinfo);
#endif
MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2);
MALLINFO2(SO_SYN_MALLOC, mallinfo2);
-#elif defined(VGO_darwin)
- //MALLINFO2(VG_Z_LIBC_SONAME, mallinfo2);
-
#endif
info->tl___builtin_vec_delete = VG_(tdict).tool___builtin_vec_delete;
info->tl___builtin_vec_delete_aligned = VG_(tdict).tool___builtin_vec_delete_aligned;
info->tl_malloc_usable_size = VG_(tdict).tool_malloc_usable_size;
-
+#if defined(VGO_linux) || defined(VGO_solaris)
info->mallinfo = VG_(mallinfo);
+#endif
+#if defined(VGO_linux)
info->mallinfo2 = VG_(mallinfo2);
+#endif
info->clo_trace_malloc = VG_(clo_trace_malloc);
info->clo_realloc_zero_bytes_frees = VG_(clo_realloc_zero_bytes_frees);
# error Unknown platform
#endif
+#if defined(VGO_linux)
/* This struct definition MUST match the system one. */
/* SVID2/XPG mallinfo structure */
struct vg_mallinfo {
SizeT fordblks; /* total non-inuse space */
SizeT keepcost; /* top-most, releasable (via malloc_trim) space */
};
+#elif defined(VGO_solaris)
+
+struct vg_mallinfo {
+ unsigned long arena; /* total space in arena */
+ unsigned long ordblks; /* number of ordinary blocks */
+ unsigned long smblks; /* number of small blocks */
+ unsigned long hblks; /* number of holding blocks */
+ unsigned long hblkhd; /* space in holding block headers */
+ unsigned long usmblks; /* space in small blocks in use */
+ unsigned long fsmblks; /* space in free small blocks */
+ unsigned long uordblks; /* space in ordinary blocks in use */
+ unsigned long fordblks; /* space in free ordinary blocks */
+ unsigned long keepcost; /* cost of enabling keep option */
+};
+
+#endif
extern void* VG_(arena_malloc) ( ArenaId arena, const HChar* cc, SizeT nbytes );
extern void VG_(arena_free) ( ArenaId arena, void* ptr );
extern SizeT VG_(arena_redzone_size) ( ArenaId aid );
+#if defined(VGO_linux) || defined(VGO_solaris)
extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi );
+#endif
+#if defined(VGO_linux)
extern void VG_(mallinfo2) ( ThreadId tid, struct vg_mallinfo2* mi );
+#endif
// VG_(arena_perm_malloc) is for permanent allocation of small blocks.
// See VG_(perm_malloc) in pub_tool_mallocfree.h for more details.
void (*tl___builtin_vec_delete_aligned)(ThreadId tid, void* p, SizeT n);
void* (*tl_realloc) (ThreadId tid, void* p, SizeT size);
SizeT (*tl_malloc_usable_size) (ThreadId tid, void* payload);
+#if defined(VGO_linux) || defined(VGO_solaris)
void (*mallinfo) (ThreadId tid, struct vg_mallinfo* mi);
+#endif
+#if defined(VGO_linux)
void (*mallinfo2) (ThreadId tid, struct vg_mallinfo2* mi);
+#endif
Bool clo_trace_malloc;
Bool clo_realloc_zero_bytes_frees;
};
calloc_overflow_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
malloc_usable_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_MAYBE_UNINITIALIZED@ @FLAG_W_NO_UNINITIALIZED@
mallinfo_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
+if VGCONF_OS_IS_SOLARIS
+mallinfo_LDADD = -lmalloc
+endif
mallinfo2_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
malloc3_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_ALLOC_SIZE_LARGER_THAN@
sbfragment_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
+if VGCONF_OS_IS_SOLARIS
+sbfragment_LDADD = -lmalloc
+endif
+
strchr_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
big_debuginfo_symbol_SOURCES = big_debuginfo_symbol.cpp