OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / pthread_attr_setstacksize.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" Japanese Version Copyright (c) 2012  Akihiro MOTOKI
33 .\"         all rights reserved.
34 .\" Translated 2012-05-03, Akihiro MOTOKI <amotoki@gmail.com>
35 .\"
36 .TH PTHREAD_ATTR_SETSTACKSIZE 3 2012\-03\-15 Linux "Linux Programmer's Manual"
37 .SH 名前
38 pthread_attr_setstacksize, pthread_attr_getstacksize \-
39 スレッド属性オブジェクトのスタックサイズ属性の設定/取得を行う
40 .SH 書式
41 .nf
42 \fB#include <pthread.h>\fP
43
44 \fBint pthread_attr_setstacksize(pthread_attr_t *\fP\fIattr\fP\fB, size_t \fP\fIstacksize\fP\fB);\fP
45 \fBint pthread_attr_getstacksize(pthread_attr_t *\fP\fIattr\fP\fB, size_t *\fP\fIstacksize\fP\fB);\fP
46 .sp
47 \fI\-pthread\fP でコンパイルしてリンクする。
48 .fi
49 .SH 説明
50 \fBpthread_attr_setstacksize\fP() 関数は、
51 \fIattr\fP が参照するスレッド属性オブジェクトのスタックアドレス
52 属性を \fIstacksize\fP で指定された値に設定する。
53
54 スタックサイズ属性により、
55 スレッド属性オブジェクト \fIattr\fP を使って作成されたスレッド
56 に割り当てられる最小サイズ (バイト単位) が決定される。
57
58 \fBpthread_attr_getstacksize\fP() は、
59 スレッド属性オブジェクト \fIattr\fP のスタックアドレス属性を
60 \fIstacksize\fP が指すバッファに入れて返す。
61 .SH 返り値
62 成功すると、これらの関数は 0 を返す。
63 エラーの場合、0 以外のエラー番号を返す。
64 .SH エラー
65 \fBpthread_attr_setstacksize\fP() は以下のエラーで失敗する場合がある。
66 .TP 
67 \fBEINVAL\fP
68 スタックサイズが \fBPTHREAD_STACK_MIN\fP (16384) バイト未満である。
69 .PP
70 .\" e.g., MacOS
71 いくつかのシステムでは、 \fBpthread_attr_setstacksize\fP() は
72 \fIstacksize\fP がシステムのページサイズの倍数でない場合にも
73 エラー \fBEINVAL\fP で失敗する。
74 .SH バージョン
75 これらの関数は glibc バージョン 2.1 以降で提供されている。
76 .SH 準拠
77 POSIX.1\-2001.
78 .SH 注意
79 新しいスレッドのデフォルトのスタックサイズの詳細については
80 \fBpthread_create\fP(3) を参照。
81
82 スレッドのスタックサイズは、スレッド作成時点では固定である。
83 メインスレッドだけがスタックを動的に伸ばすことができる。
84
85 \fBpthread_attr_setstack\fP(3) 関数を使うと、
86 アプリケーションは、スレッドが使用するスタックとして、
87 呼び出し側で割り当てたスタックのサイズと場所を指定できる。
88 .SH バグ
89 glibc 2.8 の時点では、指定された \fIstacksize\fP が \fBSTACK_ALIGN\fP
90 (ほとんどのアーキテクチャでは 16 バイト) の倍数でない場合、
91 \fIstacksize\fP は\fI小さくなる方向に\fPに丸められる。
92 これは POSIX.1\-2001 に違反している。
93 POSIX.1\-2001 では、割り当てらたスタックの大きさは
94 少なくとも \fIstacksize\fP バイトになると書かれている。
95 .SH 例
96 \fBpthread_create\fP(3) を参照。
97 .SH 関連項目
98 \fBgetrlimit\fP(2), \fBpthread_attr_init\fP(3), \fBpthread_attr_setguardsize\fP(3),
99 \fBpthread_attr_setstack\fP(3), \fBpthread_create\fP(3), \fBpthreads\fP(7)
100 .SH この文書について
101 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
102 である。プロジェクトの説明とバグ報告に関する情報は
103 http://www.kernel.org/doc/man\-pages/ に書かれている。