X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Flib.h;h=ebb6d32a86868fdbc157e0e54dcac935c06c6f5e;hb=51607e34b594c43ea5b20802bf111b33a4ceff9c;hp=7af2946887aaa0d1ef78864872ac927b0964a762;hpb=04aeb72dc19dcaaa3012c691407c8016c3842ed5;p=libucw.git diff --git a/ucw/lib.h b/ucw/lib.h index 7af29468..ebb6d32a 100644 --- a/ucw/lib.h +++ b/ucw/lib.h @@ -166,6 +166,17 @@ void xfree(void *); /** Free memory allocated by xmalloc() or xrealloc(). **/ void *xmalloc_zero(size_t) LIKE_MALLOC; /** Allocate memory and fill it by zeroes. **/ char *xstrdup(const char *) LIKE_MALLOC; /** Make a xmalloc()'ed copy of a string. Returns NULL for NULL string. **/ +/* bigalloc.c */ + +void *page_alloc(u64 len) LIKE_MALLOC; // Internal: allocates a multiple of CPU_PAGE_SIZE bytes with mmap +void *page_alloc_zero(u64 len) LIKE_MALLOC; +void page_free(void *start, u64 len); +void *page_realloc(void *start, u64 old_len, u64 new_len); + +void *big_alloc(u64 len) LIKE_MALLOC; /** Allocate a large memory block in the most efficient way available. **/ +void *big_alloc_zero(u64 len) LIKE_MALLOC; /** Allocate and clear a large memory block. **/ +void big_free(void *start, u64 len); /** Free block allocated by @big_alloc() or @big_alloc_zero(). **/ + /*** === Trivial timers (timer.c) ***/ timestamp_t get_timestamp(void); /** Get current time as a millisecond timestamp. **/ @@ -181,15 +192,4 @@ uns random_max(uns max); /** Return a pseudorandom 32-bit number in range [0,@ u64 random_u64(void); /** Return a pseudorandom 64-bit number. **/ u64 random_max_u64(u64 max); /** Return a pseudorandom 64-bit number in range [0,@max). **/ -/* bigalloc.c */ - -void *page_alloc(u64 len) LIKE_MALLOC; // allocates a multiple of CPU_PAGE_SIZE bytes with mmap -void *page_alloc_zero(u64 len) LIKE_MALLOC; -void page_free(void *start, u64 len); -void *page_realloc(void *start, u64 old_len, u64 new_len); - -void *big_alloc(u64 len) LIKE_MALLOC; // allocate a large memory block in the most efficient way available -void *big_alloc_zero(u64 len) LIKE_MALLOC; -void big_free(void *start, u64 len); - #endif