X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-mmap.h;h=2e2c7cdf0367db5051c5aa8b5e800e63fc1f3256;hb=e54ce145eaea1b0b5d31eb4c8d3c6569fd722ca6;hp=7eb67d6a88d83c73e6913b7b269e257ef84b0735;hpb=2602f1367e4d1d9ae2207ed13040e3594dc40121;p=mono.git diff --git a/mono/utils/mono-mmap.h b/mono/utils/mono-mmap.h index 7eb67d6a88d..2e2c7cdf036 100644 --- a/mono/utils/mono-mmap.h +++ b/mono/utils/mono-mmap.h @@ -1,7 +1,12 @@ +/** + * \file + */ + #ifndef __MONO_UTILS_MMAP_H__ #define __MONO_UTILS_MMAP_H__ #include +#include enum { /* protection */ @@ -19,29 +24,55 @@ enum { MONO_MMAP_32BIT = 1 << 8 }; +typedef enum { + MONO_MEM_ACCOUNT_CODE, + MONO_MEM_ACCOUNT_HAZARD_POINTERS, + MONO_MEM_ACCOUNT_DOMAIN, + MONO_MEM_ACCOUNT_SGEN_INTERNAL, + MONO_MEM_ACCOUNT_SGEN_NURSERY, + MONO_MEM_ACCOUNT_SGEN_LOS, + MONO_MEM_ACCOUNT_SGEN_MARKSWEEP, + MONO_MEM_ACCOUNT_SGEN_CARD_TABLE, + MONO_MEM_ACCOUNT_SGEN_SHADOW_CARD_TABLE, + MONO_MEM_ACCOUNT_SGEN_DEBUGGING, + MONO_MEM_ACCOUNT_SGEN_BINARY_PROTOCOL, + MONO_MEM_ACCOUNT_EXCEPTIONS, + MONO_MEM_ACCOUNT_PROFILER, + MONO_MEM_ACCOUNT_OTHER, + MONO_MEM_ACCOUNT_MAX +} MonoMemAccountType; + /* * A simple interface to fopen/fstat/fileno */ typedef struct _MonoFileMap MonoFileMap; -MonoFileMap *mono_file_map_open (const char* name); -guint64 mono_file_map_size (MonoFileMap *fmap); -int mono_file_map_fd (MonoFileMap *fmap); -int mono_file_map_close (MonoFileMap *fmap); - -int mono_pagesize (void); -void* mono_valloc (void *addr, size_t length, int flags); -void* mono_valloc_aligned (size_t length, size_t alignment, int flags); -int mono_vfree (void *addr, size_t length); -void* mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle); -int mono_file_unmap (void *addr, void *handle); -int mono_mprotect (void *addr, size_t length, int flags); - -void* mono_shared_area (void); -void mono_shared_area_remove (void); -void* mono_shared_area_for_pid (void *pid); -void mono_shared_area_unload (void *area); -int mono_shared_area_instances (void **array, int count); +MONO_API MonoFileMap *mono_file_map_open (const char* name); +MONO_API guint64 mono_file_map_size (MonoFileMap *fmap); +MONO_API int mono_file_map_fd (MonoFileMap *fmap); +MONO_API int mono_file_map_close (MonoFileMap *fmap); + +MONO_API int mono_pagesize (void); +MONO_API int mono_valloc_granule (void); +MONO_API void* mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type); +MONO_API void* mono_valloc_aligned (size_t length, size_t alignment, int flags, MonoMemAccountType type); +MONO_API int mono_vfree (void *addr, size_t length, MonoMemAccountType type); +MONO_API void* mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle); +MONO_API int mono_file_unmap (void *addr, void *handle); +#ifndef HOST_WIN32 +MONO_API void* mono_file_map_fileio (size_t length, int flags, int fd, guint64 offset, void **ret_handle); +MONO_API int mono_file_unmap_fileio (void *addr, void *handle); +#endif +MONO_API int mono_mprotect (void *addr, size_t length, int flags); + +MONO_API const char* mono_mem_account_type_name (MonoMemAccountType type); +MONO_API void mono_mem_account_register_counters (void); + +MONO_API void* mono_shared_area (void); +MONO_API void mono_shared_area_remove (void); +MONO_API void* mono_shared_area_for_pid (void *pid); +MONO_API void mono_shared_area_unload (void *area); +MONO_API int mono_shared_area_instances (void **array, int count); /* * On systems where we have to load code into memory instead of mmaping @@ -51,7 +82,7 @@ int mono_shared_area_instances (void **array, int count); typedef void *(*mono_file_map_alloc_fn) (size_t length); typedef void (*mono_file_map_release_fn) (void *addr); -void mono_file_map_set_allocator (mono_file_map_alloc_fn alloc, mono_file_map_release_fn release); - +MONO_API void mono_file_map_set_allocator (mono_file_map_alloc_fn alloc, mono_file_map_release_fn release); + #endif /* __MONO_UTILS_MMAP_H__ */