1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-02 11:21:42 +00:00

(posix_memalign): New function.

This commit is contained in:
YAMAMOTO Mitsuharu 2007-08-09 03:08:25 +00:00
parent 6e4a68d2b8
commit e575132a04
2 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2007-08-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* gmalloc.c (posix_memalign): New function.
2007-08-08 Glenn Morris <rgm@gnu.org>
* Replace `iff' in doc-strings and comments.
@ -31,8 +35,8 @@
Call malloc_enable_thread on interactive startup.
* gmalloc.c (_malloc_thread_enabled_p) [USE_PTHREAD]: New variable.
[USE_PTHREAD] (LOCK, UNLOCK, LOCK_ALIGNED_BLOCKS)
(UNLOCK_ALIGNED_BLOCKS): Conditionalize with it.
(LOCK, UNLOCK, LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS)
[USE_PTHREAD]: Conditionalize with it.
(malloc_atfork_handler_prepare, malloc_atfork_handler_parent)
(malloc_atfork_handler_child, malloc_enable_thread) [USE_PTHREAD]:
New functions.

View File

@ -129,6 +129,8 @@ extern FREE_RETURN_TYPE free PP ((__ptr_t __ptr));
#if ! (defined (_MALLOC_INTERNAL) && __DJGPP__ - 0 == 1) /* Avoid conflict. */
extern __ptr_t memalign PP ((__malloc_size_t __alignment,
__malloc_size_t __size));
extern int posix_memalign PP ((__ptr_t *, __malloc_size_t,
__malloc_size_t size));
#endif
/* Allocate SIZE bytes on a page boundary. */
@ -1857,6 +1859,36 @@ memalign (alignment, size)
return result;
}
#ifndef ENOMEM
#define ENOMEM 12
#endif
#ifndef EINVAL
#define EINVAL 22
#endif
int
posix_memalign (memptr, alignment, size)
__ptr_t *memptr;
__malloc_size_t alignment;
__malloc_size_t size;
{
__ptr_t mem;
if (alignment == 0
|| alignment % sizeof (__ptr_t) != 0
|| (alignment & (alignment - 1)) != 0)
return EINVAL;
mem = memalign (alignment, size);
if (mem == NULL)
return ENOMEM;
*memptr = mem;
return 0;
}
#endif /* Not DJGPP v1 */
/* Allocate memory on a page boundary.
Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.