Lines 38-43
Link Here
|
38 |
# include <pthread.h> |
38 |
# include <pthread.h> |
39 |
# include <semaphore.h> |
39 |
# include <semaphore.h> |
40 |
#endif |
40 |
#endif |
|
|
41 |
#include <errno.h> |
41 |
#ifdef malloc |
42 |
#ifdef malloc |
42 |
#undef malloc |
43 |
#undef malloc |
Lines 703-708
memalign(size_t alignment, size_t userSi
Link Here
|
703 |
return address; |
704 |
return address; |
704 |
} |
705 |
} |
|
|
706 |
extern C_LINKAGE int |
707 |
posix_memalign(void **memptr, size_t alignment, size_t userSize) |
708 |
{ |
709 |
/* |
710 |
* Per standard, posix_memalign returns EINVAL when alignment |
711 |
* is not a power of two or power of sizeof(void*). efence |
712 |
* doesn't check the value of alignment in memalign, but then |
713 |
* again, memalign was never specified very well, and on some |
714 |
* systems odd alignments could indeed have been allowed. |
715 |
*/ |
716 |
if ((alignment & (alignment - 1)) |
717 |
|| alignment % sizeof (void *)) |
718 |
return EINVAL; |
719 |
|
720 |
void *ptr = memalign (alignment, userSize); |
721 |
if (ptr == NULL) |
722 |
return ENOMEM; |