.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%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. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2012 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2012-05-03, Akihiro MOTOKI .\" .TH PTHREAD_ATTR_SETSTACKSIZE 3 2014\-05\-28 Linux "Linux Programmer's Manual" .SH 名前 pthread_attr_setstacksize, pthread_attr_getstacksize \- スレッド属性オブジェクトのスタックサイズ属性の設定/取得を行う .SH 書式 .nf \fB#include \fP \fBint pthread_attr_setstacksize(pthread_attr_t *\fP\fIattr\fP\fB, size_t \fP\fIstacksize\fP\fB);\fP \fBint pthread_attr_getstacksize(const pthread_attr_t *\fP\fIattr\fP\fB, size_t *\fP\fIstacksize\fP\fB);\fP .sp \fI\-pthread\fP でコンパイルしてリンクする。 .fi .SH 説明 \fBpthread_attr_setstacksize\fP() 関数は、 \fIattr\fP が参照するスレッド属性オブジェクトのスタックアドレス 属性を \fIstacksize\fP で指定された値に設定する。 スタックサイズ属性により、 スレッド属性オブジェクト \fIattr\fP を使って作成されたスレッド に割り当てられる最小サイズ (バイト単位) が決定される。 \fBpthread_attr_getstacksize\fP() は、 スレッド属性オブジェクト \fIattr\fP のスタックアドレス属性を \fIstacksize\fP が指すバッファーに入れて返す。 .SH 返り値 成功すると、これらの関数は 0 を返す。 エラーの場合、0 以外のエラー番号を返す。 .SH エラー \fBpthread_attr_setstacksize\fP() は以下のエラーで失敗する場合がある。 .TP \fBEINVAL\fP スタックサイズが \fBPTHREAD_STACK_MIN\fP (16384) バイト未満である。 .PP .\" e.g., MacOS いくつかのシステムでは、 \fBpthread_attr_setstacksize\fP() は \fIstacksize\fP がシステムのページサイズの倍数でない場合にも エラー \fBEINVAL\fP で失敗する。 .SH バージョン これらの関数は glibc バージョン 2.1 以降で提供されている。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBpthread_attr_setstacksize\fP() と \fBpthread_attr_getstacksize\fP() はスレッドセーフである。 .SH 準拠 POSIX.1\-2001. .SH 注意 新しいスレッドのデフォルトのスタックサイズの詳細については \fBpthread_create\fP(3) を参照。 スレッドのスタックサイズは、スレッド作成時点では固定である。 メインスレッドだけがスタックを動的に伸ばすことができる。 \fBpthread_attr_setstack\fP(3) 関数を使うと、 アプリケーションは、スレッドが使用するスタックとして、 呼び出し側で割り当てたスタックのサイズと場所を指定できる。 .SH バグ glibc 2.8 の時点では、指定された \fIstacksize\fP が \fBSTACK_ALIGN\fP (ほとんどのアーキテクチャーでは 16 バイト) の倍数でない場合、 \fIstacksize\fP は\fI小さくなる方向に\fPに丸められる。 これは POSIX.1\-2001 に違反している。 POSIX.1\-2001 では、割り当てらたスタックの大きさは 少なくとも \fIstacksize\fP バイトになると書かれている。 .SH 例 \fBpthread_create\fP(3) を参照。 .SH 関連項目 \fBgetrlimit\fP(2), \fBpthread_attr_init\fP(3), \fBpthread_attr_setguardsize\fP(3), \fBpthread_attr_setstack\fP(3), \fBpthread_create\fP(3), \fBpthreads\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。