Enable posix_memalign().
This commit is contained in:
parent
a656f3f7be
commit
95182011ed
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1087 2007/11/18 22:45:02 yamt Exp $
|
||||
# $NetBSD: mi,v 1.1088 2007/11/19 14:48:43 ad Exp $
|
||||
./etc/mtree/set.comp comp-sys-root
|
||||
./usr/bin/addr2line comp-debug-bin bfd
|
||||
./usr/bin/ar comp-util-bin bfd
|
||||
|
@ -5747,6 +5747,7 @@
|
|||
./usr/share/man/cat3/pnoutrefresh.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/popen.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/pos_form_cursor.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/posix_memalign.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/posix_openpt.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/post_form.0 comp-c-catman .cat
|
||||
./usr/share/man/cat3/pow.0 comp-c-catman .cat
|
||||
|
@ -10333,6 +10334,7 @@
|
|||
./usr/share/man/man3/pnoutrefresh.3 comp-c-man .man
|
||||
./usr/share/man/man3/popen.3 comp-c-man .man
|
||||
./usr/share/man/man3/pos_form_cursor.3 comp-c-man .man
|
||||
./usr/share/man/man3/posix_memalign.3 comp-c-man .man
|
||||
./usr/share/man/man3/posix_openpt.3 comp-c-man .man
|
||||
./usr/share/man/man3/post_form.3 comp-c-man .man
|
||||
./usr/share/man/man3/pow.3 comp-c-man .man
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stdlib.h,v 1.77 2007/04/22 08:21:50 ragge Exp $ */
|
||||
/* $NetBSD: stdlib.h,v 1.78 2007/11/19 14:48:41 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -229,6 +229,7 @@ int unsetenv(const char *) __RENAME(__unsetenv13);
|
|||
#endif
|
||||
|
||||
int posix_openpt(int);
|
||||
int posix_memalign(void **, size_t, size_t);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.66 2007/10/06 01:09:07 ad Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.67 2007/11/19 14:48:42 ad Exp $
|
||||
# from: @(#)Makefile.inc 8.3 (Berkeley) 2/4/95
|
||||
|
||||
# stdlib sources
|
||||
|
@ -33,7 +33,7 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 atoll.3 \
|
|||
bsearch.3 div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \
|
||||
grantpt.3 hcreate.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 lsearch.3 \
|
||||
malloc.3 memory.3 \
|
||||
posix_openpt.3 ptsname.3 qabs.3 \
|
||||
posix_memalign.3 posix_openpt.3 ptsname.3 qabs.3 \
|
||||
qdiv.3 qsort.3 radixsort.3 rand48.3 rand.3 random.3 \
|
||||
strsuftoll.3 strtod.3 strtol.3 strtoul.3 system.3 tsearch.3 unlockpt.3 \
|
||||
strfmon.3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: jemalloc.c,v 1.10 2007/10/22 04:16:48 simonb Exp $ */
|
||||
/* $NetBSD: jemalloc.c,v 1.11 2007/11/19 14:48:42 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2006,2007 Jason Evans <jasone@FreeBSD.org>.
|
||||
|
@ -118,7 +118,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
/* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */
|
||||
__RCSID("$NetBSD: jemalloc.c,v 1.10 2007/10/22 04:16:48 simonb Exp $");
|
||||
__RCSID("$NetBSD: jemalloc.c,v 1.11 2007/11/19 14:48:42 ad Exp $");
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "libc_private.h"
|
||||
|
@ -3694,9 +3694,6 @@ RETURN:
|
|||
return (ret);
|
||||
}
|
||||
|
||||
/* XXXAD */
|
||||
int posix_memalign(void **memptr, size_t alignment, size_t size);
|
||||
|
||||
int
|
||||
posix_memalign(void **memptr, size_t alignment, size_t size)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
.\" $NetBSD: posix_memalign.3,v 1.1 2007/11/19 14:48:43 ad Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 2006 Jason Evans <jasone@FreeBSD.org>.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice(s), this list of conditions and the following disclaimer as
|
||||
.\" the first lines of this file unmodified other than the possible
|
||||
.\" addition of one or more copyright notices.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice(s), this list of conditions and the following disclaimer in
|
||||
.\" the documentation and/or other materials provided with the
|
||||
.\" distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
|
||||
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
|
||||
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" FreeBSD: src/lib/libc/stdlib/posix_memalign.3,v 1.3 2007/03/28 04:32:51 jasone Exp
|
||||
.\"
|
||||
.Dd November 19, 2007
|
||||
.Dt POSIX_MEMALIGN 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm posix_memalign
|
||||
.Nd aligned memory allocation
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.In stdlib.h
|
||||
.Ft int
|
||||
.Fn posix_memalign "void **ptr" "size_t alignment" "size_t size"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn posix_memalign
|
||||
function allocates
|
||||
.Fa size
|
||||
bytes of memory such that the allocation's base address is an even multiple of
|
||||
.Fa alignment ,
|
||||
and returns the allocation in the value pointed to by
|
||||
.Fa ptr .
|
||||
.Pp
|
||||
The requested
|
||||
.Fa alignment
|
||||
must be a power of 2 at least as large as
|
||||
.Fn sizeof "void *" .
|
||||
.Pp
|
||||
Memory that is allocated via
|
||||
.Fn posix_memalign
|
||||
can be used as an argument in subsequent calls to
|
||||
.Xr realloc 3
|
||||
and
|
||||
.Xr free 3 .
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn posix_memalign
|
||||
function returns the value 0 if successful; otherwise it returns an error value.
|
||||
.Sh ERRORS
|
||||
The
|
||||
.Fn posix_memalign
|
||||
function will fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
The
|
||||
.Fa alignment
|
||||
parameter is not a power of 2 at least as large as
|
||||
.Fn sizeof "void *" .
|
||||
.It Bq Er ENOMEM
|
||||
Memory allocation error.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr free 3 ,
|
||||
.Xr malloc 3 ,
|
||||
.Xr realloc 3 ,
|
||||
.Xr valloc 3
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn posix_memalign
|
||||
function conforms to
|
||||
.St -p1003.1-2001 .
|
Loading…
Reference in New Issue