This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.18-629-g5764c27


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  5764c27f8b0e7e898999bb292689e56c2f027b57 (commit)
       via  0a096e4487541671336aa61b0fac10322a9bbbfe (commit)
      from  8d561986c0b44c1f9b489b30b661354cf456eac5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5764c27f8b0e7e898999bb292689e56c2f027b57

commit 5764c27f8b0e7e898999bb292689e56c2f027b57
Author: Will Newton <will.newton@linaro.org>
Date:   Wed Nov 6 16:07:25 2013 +0000

    manual/memory.texi: Document aligned_alloc.
    
    ChangeLog:
    
    2013-12-16  Will Newton  <will.newton@linaro.org>
    
    	* manual/memory.texi (Malloc Examples): Mention aligned_alloc.
    	(Aligned Memory Blocks): Add documentation for aligned_alloc
    	and suggest it as an alternative to posix_memalign.
    	(Hooks for Malloc): Document __memalign_hook is also called
    	for aligned_alloc.  (Summary of Malloc): Add summary for
    	aligned alloc.  Document __memalign_hook is also called
    	for aligned_alloc.

diff --git a/ChangeLog b/ChangeLog
index bfe860b..edc565a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-12-16  Will Newton  <will.newton@linaro.org>
 
+	* manual/memory.texi (Malloc Examples): Mention aligned_alloc.
+	(Aligned Memory Blocks): Add documentation for aligned_alloc
+	and suggest it as an alternative to posix_memalign.
+	(Hooks for Malloc): Document __memalign_hook is also called
+	for aligned_alloc.  (Summary of Malloc): Add summary for
+	aligned alloc.  Document __memalign_hook is also called
+	for aligned_alloc.
+
+2013-12-16  Will Newton  <will.newton@linaro.org>
+
 	* manual/memory.texi (Malloc Examples): Clarify default
 	alignment documentation.  Suggest posix_memalign rather
 	than memalign or valloc.
diff --git a/manual/memory.texi b/manual/memory.texi
index 3d96f35..55a6a50 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -382,8 +382,8 @@ The block that @code{malloc} gives you is guaranteed to be aligned so
 that it can hold any type of data.  On @gnusystems{}, the address is
 always a multiple of eight on 32-bit systems, and a multiple of 16 on
 64-bit systems.  Only rarely is any higher boundary (such as a page
-boundary) necessary; for those cases, use @code{posix_memalign}
-(@pxref{Aligned Memory Blocks}).
+boundary) necessary; for those cases, use @code{aligned_alloc} or
+@code{posix_memalign} (@pxref{Aligned Memory Blocks}).
 
 Note that the memory located after the end of the block is likely to be
 in use for something else; perhaps a block already allocated by another
@@ -616,8 +616,31 @@ after calling @code{free} wastes memory.  The size threshold for
 The address of a block returned by @code{malloc} or @code{realloc} in
 @gnusystems{} is always a multiple of eight (or sixteen on 64-bit
 systems).  If you need a block whose address is a multiple of a higher
-power of two than that, use @code{posix_memalign}.  @code{posix_memalign}
-is declared in @file{stdlib.h}.
+power of two than that, use @code{aligned_alloc} or @code{posix_memalign}.
+@code{aligned_alloc} and @code{posix_memalign} are declared in
+@file{stdlib.h}.
+
+@comment stdlib.h
+@deftypefun {void *} aligned_alloc (size_t @var{alignment}, size_t @var{size})
+The @code{aligned_alloc} function allocates a block of @var{size} bytes whose
+address is a multiple of @var{alignment}.  The @var{alignment} must be a
+power of two and @var{size} must be a multiple of @var{alignment}.
+
+The @code{aligned_alloc} function returns a null pointer on error and sets
+@code{errno} to one of the following values:
+
+@table @code
+@item ENOMEM
+There was insufficient memory available to satisfy the request.
+
+@item EINVAL
+@var{alignment} is not a power of two.
+
+This function was introduced in @w{ISO C11} and hence may have better
+portability to modern non-POSIX systems than @code{posix_memalign}.
+@end table
+
+@end deftypefun
 
 @comment malloc.h
 @comment BSD
@@ -640,8 +663,8 @@ There was insufficient memory available to satisfy the request.
 
 @end table
 
-The @code{memalign} function is obsolete and @code{posix_memalign} should
-be used instead.
+The @code{memalign} function is obsolete and @code{aligned_alloc} or
+@code{posix_memalign} should be used instead.
 @end deftypefun
 
 @comment stdlib.h
@@ -667,7 +690,9 @@ There was insufficient memory available to satisfy the request.
 
 @end table
 
-This function was introduced in POSIX 1003.1d.
+This function was introduced in POSIX 1003.1d. Although this function is
+superseded by @code{aligned_alloc}, it is more portable to older POSIX
+systems that do not support @w{ISO C11}.
 @end deftypefun
 
 @comment malloc.h stdlib.h
@@ -687,8 +712,8 @@ valloc (size_t size)
 @ref{Query Memory Parameters} for more information about the memory
 subsystem.
 
-The @code{valloc} function is obsolete and @code{posix_memalign} should
-be used instead.
+The @code{valloc} function is obsolete and @code{aligned_alloc} or
+@code{posix_memalign} should be used instead.
 @end deftypefun
 
 @node Malloc Tunable Parameters
@@ -924,17 +949,19 @@ memory consumption of the program.
 @comment malloc.h
 @comment GNU
 @defvar __memalign_hook
-The value of this variable is a pointer to function that @code{memalign},
-@code{posix_memalign} and @code{valloc} use whenever they are called.
-You should define this function to look like @code{memalign}; that is, like:
+The value of this variable is a pointer to function that @code{aligned_alloc},
+@code{memalign}, @code{posix_memalign} and @code{valloc} use whenever they
+are called. You should define this function to look like @code{aligned_alloc};
+that is, like:
 
 @smallexample
 void *@var{function} (size_t @var{alignment}, size_t @var{size}, const void *@var{caller})
 @end smallexample
 
 The value of @var{caller} is the return address found on the stack when
-the @code{memalign}, @code{posix_memalign} or @code{valloc} functions are
-called.  This value allows you to trace the memory consumption of the program.
+the @code{aligned_alloc}, @code{memalign}, @code{posix_memalign} or
+@code{valloc} functions are called.  This value allows you to trace the
+memory consumption of the program.
 @end defvar
 
 You must make sure that the function you install as a hook for one of
@@ -1140,6 +1167,10 @@ Space}.
 Allocate a block of @var{size} bytes, starting on a page boundary.
 @xref{Aligned Memory Blocks}.
 
+@item void *aligned_alloc (size_t @var{size}, size_t @var{alignment})
+Allocate a block of @var{size} bytes, starting on an address that is a
+multiple of @var{alignment}.  @xref{Aligned Memory Blocks}.
+
 @item int posix_memalign (void **@var{memptr}, size_t @var{alignment}, size_t @var{size})
 Allocate a block of @var{size} bytes, starting on an address that is a
 multiple of @var{alignment}.  @xref{Aligned Memory Blocks}.
@@ -1166,8 +1197,8 @@ A pointer to a function that @code{realloc} uses whenever it is called.
 A pointer to a function that @code{free} uses whenever it is called.
 
 @item void (*__memalign_hook) (size_t @var{size}, size_t @var{alignment}, const void *@var{caller})
-A pointer to a function that @code{memalign}, @code{posix_memalign} and
-@code{valloc} use whenever they are called.
+A pointer to a function that @code{aligned_alloc}, @code{memalign},
+@code{posix_memalign} and @code{valloc} use whenever they are called.
 
 @item struct mallinfo mallinfo (void)
 Return information about the current dynamic memory usage.

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0a096e4487541671336aa61b0fac10322a9bbbfe

commit 0a096e4487541671336aa61b0fac10322a9bbbfe
Author: Will Newton <will.newton@linaro.org>
Date:   Wed Nov 6 09:48:10 2013 +0000

    manual/memory.texi: Bring aligned allocation docs up to date.
    
    The current documentation suggests using memalign and valloc which
    are now considered obsolete, so suggest using posix_memalign instead.
    Also document the possible error return and errno values for memalign
    and posix_memalign and improve documentation of __memalign_hook.
    
    ChangeLog:
    
    2013-12-16  Will Newton  <will.newton@linaro.org>
    
    	* manual/memory.texi (Malloc Examples): Clarify default
    	alignment documentation.  Suggest posix_memalign rather
    	than memalign or valloc.
    	(Aligned Memory Blocks): Remove suggestion to use memalign
    	or valloc.  Remove obsolete comment about BSD.
    	Document memalign errno values and mark the function obsolete.
    	Document posix_memalign returned error codes.  Mark valloc
    	as obsolete.  (Hooks for Malloc): __memalign_hook is also
    	called for posix_memalign and valloc.
    	(Summary of Malloc): Add posix_memalign to function summary.
    	__memalign_hook is also called for posix_memalign and valloc.

diff --git a/ChangeLog b/ChangeLog
index 78ee4fb..bfe860b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2013-12-16  Will Newton  <will.newton@linaro.org>
+
+	* manual/memory.texi (Malloc Examples): Clarify default
+	alignment documentation.  Suggest posix_memalign rather
+	than memalign or valloc.
+	(Aligned Memory Blocks): Remove suggestion to use memalign
+	or valloc.  Remove obsolete comment about BSD.
+	Document memalign errno values and mark the function obsolete.
+	Document posix_memalign returned error codes.  Mark valloc
+	as obsolete.  (Hooks for Malloc): __memalign_hook is also
+	called for posix_memalign and valloc.
+	(Summary of Malloc): Add posix_memalign to function summary.
+	__memalign_hook is also called for posix_memalign and valloc.
+
 2013-12-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	* sysdeps/ieee754/dbl-64/s_sin.c (TAYLOR_SINCOS): Rename to
diff --git a/manual/memory.texi b/manual/memory.texi
index a80f87c..3d96f35 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -380,10 +380,10 @@ savestring (const char *ptr, size_t len)
 
 The block that @code{malloc} gives you is guaranteed to be aligned so
 that it can hold any type of data.  On @gnusystems{}, the address is
-always a multiple of eight on most systems, and a multiple of 16 on
+always a multiple of eight on 32-bit systems, and a multiple of 16 on
 64-bit systems.  Only rarely is any higher boundary (such as a page
-boundary) necessary; for those cases, use @code{memalign},
-@code{posix_memalign} or @code{valloc} (@pxref{Aligned Memory Blocks}).
+boundary) necessary; for those cases, use @code{posix_memalign}
+(@pxref{Aligned Memory Blocks}).
 
 Note that the memory located after the end of the block is likely to be
 in use for something else; perhaps a block already allocated by another
@@ -616,14 +616,8 @@ after calling @code{free} wastes memory.  The size threshold for
 The address of a block returned by @code{malloc} or @code{realloc} in
 @gnusystems{} is always a multiple of eight (or sixteen on 64-bit
 systems).  If you need a block whose address is a multiple of a higher
-power of two than that, use @code{memalign}, @code{posix_memalign}, or
-@code{valloc}.  @code{memalign} is declared in @file{malloc.h} and
-@code{posix_memalign} is declared in @file{stdlib.h}.
-
-With @theglibc{}, you can use @code{free} to free the blocks that
-@code{memalign}, @code{posix_memalign}, and @code{valloc} return.  That
-does not work in BSD, however---BSD does not provide any way to free
-such blocks.
+power of two than that, use @code{posix_memalign}.  @code{posix_memalign}
+is declared in @file{stdlib.h}.
 
 @comment malloc.h
 @comment BSD
@@ -633,6 +627,21 @@ address is a multiple of @var{boundary}.  The @var{boundary} must be a
 power of two!  The function @code{memalign} works by allocating a
 somewhat larger block, and then returning an address within the block
 that is on the specified boundary.
+
+The @code{memalign} function returns a null pointer on error and sets
+@code{errno} to one of the following values:
+
+@table @code
+@item ENOMEM
+There was insufficient memory available to satisfy the request.
+
+@item EINVAL
+@var{alignment} is not a power of two.
+
+@end table
+
+The @code{memalign} function is obsolete and @code{posix_memalign} should
+be used instead.
 @end deftypefun
 
 @comment stdlib.h
@@ -647,6 +656,16 @@ parameter @var{alignment}: the value must be a power of two multiple of
 If the function succeeds in allocation memory a pointer to the allocated
 memory is returned in @code{*@var{memptr}} and the return value is zero.
 Otherwise the function returns an error value indicating the problem.
+The possible error values returned are:
+
+@table @code
+@item ENOMEM
+There was insufficient memory available to satisfy the request.
+
+@item EINVAL
+@var{alignment} is not a power of two multiple of @code{sizeof (void *)}.
+
+@end table
 
 This function was introduced in POSIX 1003.1d.
 @end deftypefun
@@ -667,6 +686,9 @@ valloc (size_t size)
 
 @ref{Query Memory Parameters} for more information about the memory
 subsystem.
+
+The @code{valloc} function is obsolete and @code{posix_memalign} should
+be used instead.
 @end deftypefun
 
 @node Malloc Tunable Parameters
@@ -902,17 +924,17 @@ memory consumption of the program.
 @comment malloc.h
 @comment GNU
 @defvar __memalign_hook
-The value of this variable is a pointer to function that @code{memalign}
-uses whenever it is called.  You should define this function to look
-like @code{memalign}; that is, like:
+The value of this variable is a pointer to function that @code{memalign},
+@code{posix_memalign} and @code{valloc} use whenever they are called.
+You should define this function to look like @code{memalign}; that is, like:
 
 @smallexample
 void *@var{function} (size_t @var{alignment}, size_t @var{size}, const void *@var{caller})
 @end smallexample
 
 The value of @var{caller} is the return address found on the stack when
-the @code{memalign} function was called.  This value allows you to trace the
-memory consumption of the program.
+the @code{memalign}, @code{posix_memalign} or @code{valloc} functions are
+called.  This value allows you to trace the memory consumption of the program.
 @end defvar
 
 You must make sure that the function you install as a hook for one of
@@ -1118,6 +1140,10 @@ Space}.
 Allocate a block of @var{size} bytes, starting on a page boundary.
 @xref{Aligned Memory Blocks}.
 
+@item int posix_memalign (void **@var{memptr}, size_t @var{alignment}, size_t @var{size})
+Allocate a block of @var{size} bytes, starting on an address that is a
+multiple of @var{alignment}.  @xref{Aligned Memory Blocks}.
+
 @item void *memalign (size_t @var{size}, size_t @var{boundary})
 Allocate a block of @var{size} bytes, starting on an address that is a
 multiple of @var{boundary}.  @xref{Aligned Memory Blocks}.
@@ -1140,7 +1166,8 @@ A pointer to a function that @code{realloc} uses whenever it is called.
 A pointer to a function that @code{free} uses whenever it is called.
 
 @item void (*__memalign_hook) (size_t @var{size}, size_t @var{alignment}, const void *@var{caller})
-A pointer to a function that @code{memalign} uses whenever it is called.
+A pointer to a function that @code{memalign}, @code{posix_memalign} and
+@code{valloc} use whenever they are called.
 
 @item struct mallinfo mallinfo (void)
 Return information about the current dynamic memory usage.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   24 ++++++++++++++
 manual/memory.texi |   90 ++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 98 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]