From 287cdf88dcb70af2f42f2e0abe5b80eb0e1a7d36 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 23 Mar 2012 05:20:12 +1300 Subject: [PATCH] posix_memalign.3: Improve discussion of feature test macros and header files for valloc(3) Signed-off-by: Michael Kerrisk --- man3/posix_memalign.3 | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/man3/posix_memalign.3 b/man3/posix_memalign.3 index 1884af8d2..d01244c7f 100644 --- a/man3/posix_memalign.3 +++ b/man3/posix_memalign.3 @@ -23,7 +23,7 @@ .\" License. .\" .\" 2001-10-11, 2003-08-22, aeb, added some details -.TH POSIX_MEMALIGN 3 2010-09-20 "GNU" "Linux Programmer's Manual" +.TH POSIX_MEMALIGN 3 2012-03-23 "GNU" "Linux Programmer's Manual" .SH NAME posix_memalign, memalign, valloc \- Allocate aligned memory .SH SYNOPSIS @@ -31,10 +31,10 @@ posix_memalign, memalign, valloc \- Allocate aligned memory .B #include .sp .BI "int posix_memalign(void **" memptr ", size_t " alignment ", size_t " size ); +.BI "void *valloc(size_t " size ); .sp .B #include .sp -.BI "void *valloc(size_t " size ); .BI "void *memalign(size_t " boundary ", size_t " size ); .fi .sp @@ -64,9 +64,15 @@ _BSD_SOURCE || Before glibc 2.12: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED +.ad b +.br +(The (nonstandard) header file +.I +also exposes the declaration of +.BR valloc (); +no feature test macros are required.) .RE .PD -.ad b .SH DESCRIPTION The function .BR posix_memalign () @@ -164,18 +170,9 @@ is declared in \fI\fP instead of \fI\fP. According to SUSv2, .BR valloc () is declared in \fI\fP. -Libc4,5 and glibc declare it in \fI\fP and perhaps also in +Libc4,5 and glibc declare it in \fI\fP, and also in \fI\fP -(namely, if -.B _GNU_SOURCE -is defined, or -.B _BSD_SOURCE -is defined, or, -for glibc, if -.B _XOPEN_SOURCE_EXTENDED -is defined, or, equivalently, -.B _XOPEN_SOURCE -is defined to a value not less than 500). +if suitable feature test macros are defined (see above). .SH NOTES On many systems there are alignment restrictions, for example, on buffers used for direct block device I/O.