diff options
author | Gerald Carter <jerry@samba.org> | 2007-02-24 12:40:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:18:10 -0500 |
commit | 56c1d7e5078ca6b79bb286f458956b5f49c83e81 (patch) | |
tree | f59e13e33a7dbd9ff81ced5dbf1fd23ff469d6ac /source3/lib/util.c | |
parent | d43dbee7133e069f0f34d6adea8d8b4ac0268797 (diff) | |
download | samba-56c1d7e5078ca6b79bb286f458956b5f49c83e81.tar.gz |
r21525: Go ahead and checkin the mlock() & memalign() fixes so
others don't get stuck with the winbindd hang.
Still waiting on additional confirmation from Guenther
that this fixes thes issues he was observing as well.
But it's been running in my local tree for a day without
problems.
(This used to be commit 0d2b80c6c4a744b05a0efdec352cddccc430e0c4)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r-- | source3/lib/util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 7d41a14292c..5f9eb4fc450 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -913,6 +913,17 @@ void *malloc_(size_t size) } /**************************************************************************** + Internal malloc wrapper. Externally visible. +****************************************************************************/ + +void *memalign_(size_t align, size_t size) +{ +#undef memalign + return memalign(align, size); +#define memalign(align, s) __ERROR_DONT_USE_MEMALIGN_DIRECTLY +} + +/**************************************************************************** Internal calloc wrapper. Not externally visible. ****************************************************************************/ @@ -954,6 +965,23 @@ void *malloc_array(size_t el_size, unsigned int count) } /**************************************************************************** + Type-safe memalign +****************************************************************************/ + +void *memalign_array(size_t el_size, size_t align, unsigned int count) +{ + if (count >= MAX_ALLOC_SIZE/el_size) { + return NULL; + } + +#if defined(PARANOID_MALLOC_CHECKER) + return memalign_(align, el_size*count); +#else + return sys_memalign(align, el_size*count); +#endif +} + +/**************************************************************************** Type-safe calloc. ****************************************************************************/ |