OSDN Git Service

7e790f66cbdd4244ffe5c34c03a8d40afec1bb82
[linuxjm/LDP_man-pages.git] / draft / man2 / set_tid_address.2
1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH SET_TID_ADDRESS 2 2012\-07\-19 Linux "Linux Programmer's Manual"
31 .SH 名前
32 set_tid_address \- スレッド ID へのポインタを設定する
33 .SH 書式
34 .nf
35 \fB#include <linux/unistd.h>\fP
36 .sp
37 \fBlong set_tid_address(int *\fP\fItidptr\fP\fB);\fP
38 .fi
39 .SH 説明
40 各プロセスについて、カーネルは \fIset_child_tid\fP と \fIclear_child_tid\fP という 2 つの属性を保持する。この 2
41 つの属性はデフォルトでは NULL である。
42 .TP 
43 \fIset_child_tid\fP
44 プロセスが \fBCLONE_CHILD_SETTID\fP フラグを指定した \fBclone\fP(2)  によって開始された場合、
45 \fIset_child_tid\fP は \fBclone\fP(2) のシステムコールの \fIctid\fP 引き数で渡された値に設定される。
46 .IP
47 \fIset_child_tid\fP が設定された場合、一番最初に新しいプロセスが行うことは、 このアドレスに自身の PID を書き込むことである。
48 .TP 
49 \fIclear_child_tid\fP
50 プロセスが \fBCLONE_CHILD_CLEARTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、
51 \fIclear_child_tid\fP は \fBclone\fP(2) のシステムコールの \fIctid\fP 引き数で渡された値に設定される。
52 .LP
53 システムコール \fBset_tid_address\fP()  は呼び出し元プロセスの \fIclear_child_tid\fP の値を \fItidptr\fP
54 に設定する。
55 .LP
56 \fIclear_child_tid\fP が NULL でないプロセスが終了すると、そのプロセスが他のプロセスまたはスレッドとメモリを共有していれば、
57 \fIclear_child_tid\fP で指定されたアドレスに 0 が書き込まれ、カーネルは以下の処理を実行する。
58
59     futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);
60
61 この処理の結果、このメモリアドレスに対する futex wait を実行しているプロセスを一つ起こす (wake)。 futex wake
62 操作でのエラーは無視される。
63 .SH 返り値
64 \fBset_tid_address\fP()  は常に現在のプロセスの PID を返す。
65 .SH エラー
66 \fBset_tid_address\fP()  は常に成功する。
67 .SH バージョン
68 この呼び出しは Linux 2.5.48 以降で存在する。 ここで書かれた詳細は Linux 2.5.49 以降で有効である。
69 .SH 準拠
70 このシステムコールは Linux 固有である。
71 .SH 関連項目
72 \fBclone\fP(2), \fBfutex\fP(2)
73 .SH この文書について
74 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
75 である。プロジェクトの説明とバグ報告に関する情報は
76 http://www.kernel.org/doc/man\-pages/ に書かれている。