OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / posix_memalign.3
index c6d3c5a..dede68b 100644 (file)
@@ -1,6 +1,7 @@
 .\" Copyright (c) 2001 by John Levon <moz@compsoc.man.ac.uk>
 .\" Based in part on GNU libc documentation.
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
-.\" License.
+.\" %%%LICENSE_END
 .\"
 .\" 2001-10-11, 2003-08-22, aeb, added some details
+.\" 2012-03-23, Michael Kerrisk <mtk.manpages@mail.com>
+.\"     Document pvalloc() and aligned_alloc()
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
 .\"
 .\" Japanese Version Copyright (c) 2001 Akihiro MOTOKI
 .\"       all rights reserved.
 .\" Updated 2003-09-05, Akihiro MOTOKI, catch up to v1.60
 .\" Updated 2005-11-19, Akihiro MOTOKI
 .\" Updated 2010-04-18, Akihiro MOTOKI, LDP v3.24
+.\" Updated 2012-05-01, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2012-05-08, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-07-22, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.\"WORD:       obsolete        Çѻߤµ¤ì¤¿
-.\"WORD:       a multiple of   ¡Á¤ÎÇÜ¿ô
-.\"WORD:       a power of two  2 ¤Î¤Ù¤­¾è
-.\"
-.TH POSIX_MEMALIGN 3  2010-09-20 "GNU" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O posix_memalign, memalign, valloc \- Allocate aligned memory
-posix_memalign, memalign, valloc \- ¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿¥á¥â¥ê¤Î³ä¤êÅö¤Æ¤ò¹Ô¤¦
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH POSIX_MEMALIGN 3 2012\-03\-23 GNU "Linux Programmer's Manual"
+.SH 名前
+posix_memalign, aligned_alloc, memalign, valloc, pvalloc \- アラインメント
+されたメモリの割り当てを行う
+.SH 書式
 .nf
-.B #include <stdlib.h>
+\fB#include <stdlib.h>\fP
 .sp
-.BI "int posix_memalign(void **" memptr ", size_t " alignment ", size_t " size );
+\fBint posix_memalign(void **\fP\fImemptr\fP\fB, size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP
+\fBvoid *aligned_alloc(size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP
+\fBvoid *valloc(size_t \fP\fIsize\fP\fB);\fP
 .sp
-.B #include <malloc.h>
+\fB#include <malloc.h>\fP
 .sp
-.BI "void *valloc(size_t " size );
-.BI "void *memalign(size_t " boundary ", size_t " size );
+\fBvoid *memalign(size_t \fP\fIalignment\fP\fB, size_t \fP\fIsize\fP\fB);\fP
+\fBvoid *pvalloc(size_t \fP\fIsize\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
 .ad l
-.BR posix_memalign ():
-.RS 4
-_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
-.RE
+\fBposix_memalign\fP(): _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
 .sp
-.BR valloc ():
+\fBaligned_alloc\fP(): _ISOC11_SOURCE
+.sp
+\fBvalloc\fP():
 .br
 .PD 0
 .RS 4
-.TP 4
-.\"O Since glibc 2.12:
-glibc 2.12 °Ê¹ß:
+.TP  4
+glibc 2.12 以降:
 .nf
 _BSD_SOURCE ||
     (_XOPEN_SOURCE\ >=\ 500 ||
@@ -81,332 +83,112 @@ _BSD_SOURCE ||
     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
 .br
 .fi
-.TP
-.\"O Before glibc 2.12:
-glibc 2.12 ¤è¤êÁ°:
-_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
-_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.TP 
+glibc 2.12 より前:
+_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.ad b
+.br
+((非標準の) ヘッダファイル \fI<malloc.h>\fP も
+\fBvalloc\fP() の宣言も公開する。機能検査マクロは不要である。
 .RE
 .PD
-.ad b
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O The function
-.\"O .BR posix_memalign ()
-.\"O allocates
-.\"O .I size
-.\"O bytes and places the address of the allocated memory in
-.\"O .IR "*memptr" .
-.\"O The address of the allocated memory will be a multiple of
-.\"O .IR "alignment" ,
-.\"O which must be a power of two and a multiple of
-.\"O .IR "sizeof(void *)".
-´Ø¿ô
-.BR posix_memalign ()
-¤Ï¡¢
-.I size
-¥Ð¥¤¥È¤Î¥á¥â¥ê¤ò³ä¤êÅö¤Æ¡¢³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Î¥¢¥É¥ì¥¹¤ò
-.I "*memptr"
-¤ËÀßÄꤹ¤ë¡£
-³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Î¥¢¥É¥ì¥¹¤Ï
-.I "alignment"
-¤ÎÇÜ¿ô¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¢¤ë¡£
-.I "alignment"
-¤Ï 2 ¤Î¤Ù¤­¾è¤Ç¡¢¤«¤Ä
-.IR "sizeof(void *)"
-¤ÎÇÜ¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
-.\"O If
-.\"O .I size
-.\"O is 0, then
-.\"O .BR posix_memalign ()
-.\"O returns either NULL,
-.\"O .\" glibc does this:
-.\"O or a unique pointer value that can later be successfully passed to
-.\"O .BR free (3).
-.I size
-¤¬ 0 ¤Î¾ì¹ç¡¢
-.BR posix_memalign ()
-¤Ï NULL ¤«°ì°Õ¤Ê¥Ý¥¤¥ó¥¿ÃͤòÊÖ¤¹¡£
-¤³¤Î¥Ý¥¤¥ó¥¿Ãͤϡ¢¸å¤Ç
-.BR free (3)
-¤ËÌäÂê¤Ê¤¯ÅϤ¹¤³¤È¤¬¤Ç¤­¤ë¡£
+.SH 説明
+.\" glibc does this:
+関数 \fBposix_memalign\fP()  は、 \fIsize\fP バイトのメモリを割り当て、割り当てられたメモリのアドレスを \fI*memptr\fP
+に設定する。 割り当てられたメモリのアドレスは \fIalignment\fP の倍数になっているはずである。 \fIalignment\fP は 2
+のべき乗で、かつ \fIsizeof(void\ *)\fP の倍数でなければならない。 \fIsize\fP が 0 の場合、
+\fBposix_memalign\fP()  は NULL か一意なポインタ値を返す。 このポインタ値は、後で \fBfree\fP(3)
+に問題なく渡すことができる。
 
-.\"O The obsolete function
-.\"O .BR memalign ()
-.\"O allocates
-.\"O .I size
-.\"O bytes and returns a pointer to the allocated memory.
-.\"O The memory address will be a multiple of
-.\"O .IR "boundary" ,
-.\"O which must be a power of two.
-Çѻߤµ¤ì¤¿´Ø¿ô¤Ç¤¢¤ë
-.BR memalign ()
-¤Ï¡¢
-.I size
-¥Ð¥¤¥È¤Î¥á¥â¥ê¤ò³ä¤êÅö¤Æ¡¢³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
-¥á¥â¥ê¤Î¥¢¥É¥ì¥¹¤Ï
-.I "boundary"
-¤ÎÇÜ¿ô¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¢¤ë¡£
-.I "boundary"
-¤Ï 2 ¤Î¤Ù¤­¾è¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
 .\" The behavior of memalign() for size==0 is as for posix_memalign()
 .\" but no standards govern this.
+廃止された関数である \fBmemalign\fP() は、 \fIsize\fP バイトのメモリを割り当て、
+割り当てられたメモリへのポインタを返す。 メモリのアドレスは \fIalignment\fP
+の倍数になっているはずである。 \fIalignment\fP は 2 のべき乗でなければならない。
 
-.\"O The obsolete function
-.\"O .BR valloc ()
-.\"O allocates
-.\"O .I size
-.\"O bytes and returns a pointer to the allocated memory.
-.\"O The memory address will be a multiple of the page size.
-.\"O It is equivalent to
-.\"O .IR "memalign(sysconf(_SC_PAGESIZE),size)" .
-Çѻߤµ¤ì¤¿´Ø¿ô¤Ç¤¢¤ë
-.BR valloc ()
-¤Ï
-.I size
-¥Ð¥¤¥È¤Î¥á¥â¥ê¤ò³ä¤êÅö¤Æ¡¢³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
-¥á¥â¥ê¤Î¥¢¥É¥ì¥¹¤Ï¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¢¤ë¡£
-¤³¤ì¤Ï
-.I "memalign(sysconf(_SC_PAGESIZE),size)"
-¤ÈÅù²Á¤Ç¤¢¤ë¡£
+関数 \fBaligned_alloc\fP() は \fBmemalign\fP() と同じだが、\fIsize\fP が \fIalignment\fP
+の倍数でなければならないという追加の制限がある点が異なる。
 
-.\"O For all three routines, the memory is not zeroed.
-.\" motoki: be not zeroed ¤Ã¤Æ¤É¤¦¤¤¤¦°ÕÌ£¡©
-3 ¤Ä¤Î´Ø¿ô¤Ï¤¤¤º¤ì¤â¥á¥â¥ê¤Î¥¼¥í¥¯¥ê¥¢¤ò¹Ô¤ï¤Ê¤¤¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O .BR memalign ()
-.\"O and
-.\"O .BR valloc ()
-.\"O return the pointer to the allocated memory, or NULL if the request fails.
-.BR memalign ()
-¤È
-.BR valloc ()
-¤Ï³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
-³ä¤êÅö¤Æ¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¤Ï NULL ¤òÊÖ¤¹¡£
+廃止された関数である \fBvalloc\fP()  は \fIsize\fP バイトのメモリを割り当て、割り当てられたメモリへのポインタを返す。
+メモリのアドレスはページサイズの倍数になっているはずである。 これは \fImemalign(sysconf(_SC_PAGESIZE),size)\fP
+と等価である。
 
-.\"O .BR posix_memalign ()
-.\"O returns zero on success, or one of the error values listed in the
-.\"O next section on failure.
-.\"O Note that
-.\"O .I errno
-.\"O is not set.
-.BR posix_memalign ()
-¤ÏÀ®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤òÊÖ¤·¡¢
-¼ºÇÔ¤·¤¿¾ì¹ç¤Ï¼¡¤Î¥»¥¯¥·¥ç¥ó¤Ëµ­ºÜ¤µ¤ì¤¿¥¨¥é¡¼ÃͤΤ¤¤º¤ì¤«¤òÊÖ¤¹¡£
-.I errno
-¤Ï¥»¥Ã¥È¤µ¤ì¤Ê¤¤¤³¤È¤ËÃí°Õ¤¹¤ë¤³¤È¡£
-.\"O .SH "ERRORS"
-.SH ¥¨¥é¡¼
-.TP
-.B EINVAL
-.\"O The
-.\"O .I alignment
-.\"O argument was not a power of two, or was not a multiple of
-.\"O .IR "sizeof(void *)" .
-.I alignment
-°ú¤­¿ô¤¬ 2 ¤Î¤Ù¤­¾è¤Ç¤Ê¤«¤Ã¤¿¤«¡¢
-.IR "sizeof(void *)"
-¤ÎÇÜ¿ô¤Ç¤Ê¤«¤Ã¤¿¡£
-.TP
-.B ENOMEM
-.\"O There was insufficient memory to fulfill the allocation request.
-³ä¤êÅö¤ÆÍ×µá¤òËþ¤¿¤¹¤Î¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤«¤Ã¤¿¡£
-.\"O .SH VERSIONS
-.SH ¥Ð¡¼¥¸¥ç¥ó
-.\"O The functions
-.\"O .BR memalign ()
-.\"O and
-.\"O .BR valloc ()
-.\"O have been available in all Linux libc libraries.
-.BR memalign ()
-¤È
-.BR valloc ()
-¤Ï¤¹¤Ù¤Æ¤Î Linux libc ¥é¥¤¥Ö¥é¥ê¤Ç»ÈÍѲÄǽ¤Ç¤¢¤ë¡£
-.\"O The function
-.\"O .BR posix_memalign ()
-.\"O is available since glibc 2.1.91.
-.BR posix_memalign ()
-¤Ï glibc 2.1.91 °Ê¹ß¤Ç»ÈÍѲÄǽ¤Ç¤¢¤ë¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-.\"O The function
-.\"O .BR valloc ()
-.\"O appeared in 3.0BSD.
-.\"O It is documented as being obsolete in 4.3BSD,
-.\"O and as legacy in SUSv2.
-.\"O It does not appear in POSIX.1-2001.
-´Ø¿ô
-.BR valloc ()
-¤Ï 3.0BSD ¤ÇÅо줷¤¿¡£4.3BSD ¤Ç¤ÏÇѻߤµ¤ì¤¿¤Èµ­ºÜ¤µ¤ì¤Æ¤ª¤ê¡¢
-SUSv2 ¤Ç¤Ï²áµî¤Î̾»Ä¤À¤Èµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
-POSIX.1-2001 ¤Ë¤Ï¤â¤Ï¤ä¸ºß¤·¤Ê¤¤¡£
-.\"O The function
-.\"O .BR memalign ()
-.\"O appears in SunOS 4.1.3 but not in 4.4BSD.
-´Ø¿ô
-.BR memalign ()
-¤Ï SunOS 4.1.3 ¤ÇÅо줷¤¿¤¬¡¢4.4BSD ¤Ë¤Ï¤Ê¤¤¡£
-.\"O The function
-.\"O .BR posix_memalign ()
-.\"O comes from POSIX.1d.
-´Ø¿ô
-.BR posix_memalign ()
-¤Ï POSIX.1d ¤ËͳÍ褹¤ë¡£
-.\"O .SS Headers
-.SS ¥Ø¥Ã¥À
-.\"O Everybody agrees that
-.\"O .BR posix_memalign ()
-.\"O is declared in \fI<stdlib.h>\fP.
-.BR posix_memalign ()
-¤ÎÀë¸À¤ò \fI<stdlib.h>\fP ¤Ç¹Ô¤¦¤³¤È¤Ë´Ø¤·¤Æ¤Ï¡¢
-³§¤Î°Õ¸«¤¬°ìÃפ·¤Æ¤¤¤ë¡£
+廃止された関数 \fBpvalloc\fP() は \fBvalloc\fP() と同様だが、
+割り当てられるサイズがシステムのページサイズの倍数に切り上げられる。
+
+これらの関数はいずれもメモリのゼロクリアを行わない。
+.SH 返り値
+\fBaligned_alloc\fP(), \fBmemalign\fP(), \fBvalloc\fP(), \fBpvalloc\fP() は割り当てられた
+メモリへのポインタを返す。 割り当てに失敗した場合は NULL を返す。
+
+\fBposix_memalign\fP()  は成功した場合は 0 を返し、 失敗した場合は次のセクションに記載されたエラー値のいずれかを返す。
+\fIerrno\fP はセットされないことに注意すること。
+.SH エラー
+.TP 
+\fBEINVAL\fP
+\fIalignment\fP 引き数が 2 のべき乗でなかったか、 \fIsizeof(void\ *)\fP の倍数でなかった。
+.TP 
+\fBENOMEM\fP
+割り当て要求を満たすのに十分なメモリがなかった。
+.SH バージョン
+関数 \fBmemalign\fP(), \fBvalloc\fP(), \fBpvalloc\fP() は
+すべての Linux libc ライブラリで使用可能である。
+
+関数 \fBaligned_alloc\fP() は glibc バージョン 2.16 で追加された。
+
+関数 \fBposix_fallocate\fP() は glibc 2.1.91 以降で利用可能である。
+.SH 準拠
+関数 \fBvalloc\fP() は 3.0BSD で登場した。4.3BSD では廃止されたと記載されており、
+SUSv2 では過去の名残だと記載されている。 POSIX.1\-2001 には存在しない。
+
+関数 \fBpvalloc\fP() は GNU による拡張である。
+
+関数 \fBmemalign\fP() は SunOS 4.1.3 で登場したが、4.4BSD にはない。
+
+関数 \fBposix_memalign\fP() は POSIX.1d に由来する。
+
+.\"
+関数 \fIaligned_alloc\fP() は C11 標準で規定されている。
+.SS ヘッダ
+\fBposix_memalign\fP()  の宣言を \fI<stdlib.h>\fP で行うことに関しては、 皆の意見が一致している。
 
-.\"O On some systems
-.\"O .BR memalign ()
-.\"O is declared in \fI<stdlib.h>\fP instead of \fI<malloc.h>\fP.
-¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
-.BR memalign ()
-¤Ï \fI<malloc.h>\fP ¤Ç¤Ï¤Ê¤¯ \fI<stdlib.h>\fP ¤ÇÀë¸À¤µ¤ì¤Æ¤¤¤ë¡£
+いくつかのシステムでは、 \fBmemalign\fP()  は \fI<malloc.h>\fP ではなく
+\fI<stdlib.h>\fP で宣言されている。
 
-.\"O According to SUSv2,
-.\"O .BR valloc ()
-.\"O is declared in \fI<stdlib.h>\fP.
-.\"O Libc4,5 and glibc declare it in \fI<malloc.h>\fP and perhaps also in
-.\"O \fI<stdlib.h>\fP
-.\"O (namely, if
-.\"O .B _GNU_SOURCE
-.\"O is defined, or
-.\"O .B _BSD_SOURCE
-.\"O is defined, or,
-.\"O for glibc, if
-.\"O .B _XOPEN_SOURCE_EXTENDED
-.\"O is defined, or, equivalently,
-.\"O .B _XOPEN_SOURCE
-.\"O is defined to a value not less than 500).
-SUSv2 ¤Ë¤è¤ë¤È¡¢
-.BR valloc ()
-¤Ï
-.I <stdlib.h>
-¤ÇÀë¸À¤µ¤ì¤ë¡£
-libc4,5 ¤ä glibc ¤Ç¤Ï
-.I <malloc.h>
-¤ÇÀë¸À¤µ¤ì¤Æ¤ª¤ê¡¢
-¤µ¤é¤Ë
-.I <stdlib.h>
-¤Ç¤âÀë¸À¤µ¤ì¤ë¤³¤È¤â¤¢¤ë
-(¶ñÂÎŪ¤Ë¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Î¾ì¹ç:
-.B _GNU_SOURCE
-¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡¢
-.B _BSD_SOURCE
-¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡¢
-glibc ¤Ç
-.B _XOPEN_SOURCE_EXTENDED
-¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡¢
-glibc ¤Ç
-.B _XOPEN_SOURCE
-¤¬ 500 ¤è¤ê¾®¤µ¤¯¤Ê¤¤ÃͤËÄêµÁ¤µ¤ì¤Æ¤¤¤ë)¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O On many systems there are alignment restrictions, for example, on buffers
-.\"O used for direct block device I/O.
-.\"O POSIX specifies the
-.\"O .I "pathconf(path,_PC_REC_XFER_ALIGN)"
-.\"O call that tells what alignment is needed.
-.\"O Now one can use
-.\"O .BR posix_memalign ()
-.\"O to satisfy this requirement.
-¿¤¯¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¥¢¥é¥¤¥ó¥á¥ó¥È¤Ë´Ø¤·¤ÆÀ©¸Â¤¬¤¢¤ë¡£Î㤨¤Ð¡¢
-¥Ö¥í¥Ã¥¯¥Ç¥Ð¥¤¥¹¤ËÂФ¹¤ë¥À¥¤¥ì¥¯¥È I/O ¤Ë»ÈÍѤ¹¤ë¥Ð¥Ã¥Õ¥¡¤Ë¤Ï
-¥¢¥é¥¤¥ó¥á¥ó¥È¤Ë´Ø¤¹¤ëÀ©¸Â¤¬¤¢¤ë¡£
-POSIX ¤Ç¤Ï¡¢¤É¤ó¤Ê¥¢¥é¥¤¥ó¥á¥ó¥È¤¬É¬Íפ«¤òÃΤ뤿¤á¤Ë
-.I "pathconf(path,_PC_REC_XFER_ALIGN)"
-¥³¡¼¥ë¤òµ¬Äꤷ¤Æ¤¤¤ë¡£¤³¤³¤Ç
-.BR posix_memalign ()
-¤ò»È¤¦¤È¡¢¤³¤ÎɬÍ×¾ò·ï¤òËþ¤¿¤¹¤³¤È¤¬¤Ç¤­¤ë¡£
+SUSv2 によると、 \fBvalloc\fP() は \fI<stdlib.h>\fP で宣言される。 libc4,5
+や glibc では \fI<malloc.h>\fP で宣言されており、 さらに適切な機能検査
+マクロが定義された場合には \fI<stdlib.h>\fP でも宣言される(上記を参照)。
+.SH 注意
+多くのシステムでは、アラインメントに関して制限がある。例えば、 ブロックデバイスに対するダイレクト I/O に使用するバッファには
+アラインメントに関する制限がある。 POSIX では、どんなアラインメントが必要かを知るために
+\fIpathconf(path,_PC_REC_XFER_ALIGN)\fP コールを規定している。ここで \fBposix_memalign\fP()
+を使うと、この必要条件を満たすことができる。
 
-.\"O .BR posix_memalign ()
-.\"O verifies that
-.\"O .I alignment
-.\"O matches the requirements detailed above.
-.BR posix_memalign ()
-¤Ï
-.I alignment
-¤¬¾å¤Ç¾ÜºÙ¤Ë½Ò¤Ù¤¿É¬Í×¾ò·ï¤òËþ¤¿¤¹¤«¤É¤¦¤«¤ò³Î¤«¤á¤ë¡£
-.\"O .BR memalign ()
-.\"O may not check that the
-.\"O .I boundary
-.\"O argument is correct.
-.BR memalign ()
-¤Ï
-.I boundary
-°ú¤­¿ô¤¬Àµ¤·¤¤¤«¤É¤¦¤«¤Î³Îǧ¤ò¹Ô¤ï¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
+\fBposix_memalign\fP() は \fIalignment\fP が上で詳細に述べた必要条件を満たすか
+どうかを確かめる。 \fBmemalign\fP() は \fIalignment\fP 引き数が正しいかどうかの
+確認を行わないかもしれない。
 
-.\"O POSIX requires that memory obtained from
-.\"O .BR posix_memalign ()
-.\"O can be freed using
-.\"O .BR free (3).
-POSIX ¤Ç¤Ï
-.BR posix_memalign ()
-¤Ë¤è¤Ã¤Æ³ÍÆÀ¤·¤¿¥á¥â¥ê¤Ï
-.BR free (3)
-¤ò»È¤Ã¤Æ²òÊü¤¹¤ë¤³¤È¤¬¤Ç¤­¤ëɬÍפ¬¤¢¤ë¡£
-.\"O Some systems provide no way to reclaim memory allocated with
-.\"O .BR memalign ()
-.\"O or
-.\"O .BR valloc ()
-¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ç¤Ï
-.BR memalign ()
-¤ä
-.BR valloc ()
-¤Ç³ä¤êÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤òºÆÍøÍѤ¹¤ë¼êÃʤ¬Ä󶡤µ¤ì¤Æ¤¤¤Ê¤¤¡£
-.\"O (because one can only pass to
-.\"O .BR free (3)
-.\"O a pointer gotten from
-.\"O .BR malloc (3),
-.\"O while, for example,
-.\"O .BR memalign ()
-.\"O would call
-.\"O .BR malloc (3)
-.\"O and then align the obtained value).
-.\" motoki: while ¤ÎÁ°¸å¤Î¤Ä¤Ê¤¬¤ê¤Ï¤³¤ì¤Ç¤¤¤¤¡©
-(¤Ê¤¼¤Ê¤é
-.BR free (3)
-¤ËÅϤ¹¤³¤È¤¬¤Ç¤­¤ë¤Î¤Ï
-.BR malloc (3)
-¤«¤é¼õ¤±¼è¤Ã¤¿¥Ý¥¤¥ó¥¿¤À¤±¤À¤¬¡¢
-Î㤨¤Ð
-.BR memalign ()
-¤Ï
-.BR malloc (3)
-¤ò¸Æ¤Ó½Ð¤·¡¢ÆÀ¤¿Ãͤò¥¢¥é¥¤¥ó¥á¥ó¥È¤·¤Æ¤·¤Þ¤¦¤«¤é¤Ç¤¢¤ë)
 .\" Other systems allow passing the result of
-.\" .BR valloc ()
+.\" .IR valloc ()
 .\" to
-.\" .BR free (3),
+.\" .IR free (3),
 .\" but not to
-.\" .BR realloc (3).
-.\"O The glibc implementation
-.\"O allows memory obtained from any of these three routines to be
-.\"O reclaimed with
-.\"O .BR free (3).
-glibc ¤Î¼ÂÁõ¤Ç¤Ï¡¢
-¤³¤³¤Ë½Ò¤Ù¤¿ 3 ¤Ä¤Î´Ø¿ô¤Î¤¤¤º¤ì¤Ç³ÍÆÀ¤·¤¿¥á¥â¥ê¤â
-.BR free (3)
-¤ÇºÆÍøÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
+.\" .IR realloc (3).
+POSIX では \fBposix_memalign\fP() によって獲得したメモリは \fBfree\fP(3) を
+使って解放することができる必要がある。 いくつかのシステムでは
+\fBmemalign\fP() や\fBvalloc\fP() で割り当てられたメモリを再利用する手段が
+提供されていない(なぜなら \fBfree\fP(3) に渡すことができるのは
+\fBmalloc\fP(3) から受け取ったポインタだけだが、例えば \fBmemalign\fP() は
+\fBmalloc\fP(3) を呼び出し、得た値をアラインメントしてしまうからである)。
+glibc の実装では、 ここに述べた関数のいずれで獲得したメモリも
+\fBfree\fP(3) で再利用することができる。
 
-.\"O glibc
-.\"O .BR malloc (3)
-.\"O always returns 8-byte aligned memory addresses, so these routines are only
-.\"O needed if you require larger alignment values.
-glibc ¤Î
-.BR malloc (3)
-¤Ï¾ï¤Ë 8 ¥Ð¥¤¥È¤Ë¥¢¥é¥¤¥ó¥á¥ó¥È¤µ¤ì¤¿¥á¥â¥ê¥¢¥É¥ì¥¹¤òÊÖ¤¹¤Î¤Ç¡¢
-¤³¤³¤Ç½Ò¤Ù¤¿´Ø¿ô¤¬É¬Íפˤʤë¤Î¤Ï
-8 ¥Ð¥¤¥È¤è¤ê¤âÂ礭¤Ê¥¢¥é¥¤¥ó¥á¥ó¥È¤¬É¬Íפʾì¹ç¤À¤±¤Ç¤¢¤ë¡£
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR brk (2),
-.BR getpagesize (2),
-.BR free (3),
-.BR malloc (3)
+glibc の \fBmalloc\fP(3) は常に 8 バイトにアラインメントされたメモリアドレスを
+返すので、ここで述べた関数が必要になるのは 8 バイトよりも大きなアラインメント
+が必要な場合だけである。
+.SH 関連項目
+\fBbrk\fP(2), \fBgetpagesize\fP(2), \fBfree\fP(3), \fBmalloc\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。