OSDN Git Service

db1b40cae788b0a6bc4725f6088d09bc7f25a7b3
[linuxjm/LDP_man-pages.git] / draft / man2 / set_tid_address.2
1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Japanese Version Copyright (c) 2005 Yuichi SATO
24 .\"         all rights reserved.
25 .\" Translated Wed Jan 26 07:21:01 JST 2005
26 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
27 .\"
28 .TH SET_TID_ADDRESS 2 2004-09-10 "Linux" "Linux Programmer's Manual"
29 .\"O .SH NAME
30 .SH 名前
31 .\"O set_tid_address \- set pointer to thread ID
32 set_tid_address \- スレッド ID へのポインタを設定する
33 .\"O .SH SYNOPSIS
34 .SH 書式
35 .nf
36 .B #include <linux/unistd.h>
37 .sp
38 .BI "long set_tid_address(int *" tidptr );
39 .fi
40 .\"O .SH DESCRIPTION
41 .SH 説明
42 .\"O The kernel keeps for each process two values called
43 .\"O .I set_child_tid
44 .\"O and
45 .\"O .I clear_child_tid
46 .\"O that are NULL by default.
47 カーネルは各プロセスについて
48 .I set_child_tid
49
50 .I clear_child_tid
51 という 2 つの値を保持する。
52 これらはデフォルトでは NULL である。
53 .SS set_child_tid
54 .\"O If a process is started using
55 .\"O .BR clone (2)
56 .\"O with the
57 .\"O .B CLONE_CHILD_SETTID
58 .\"O flag,
59 .\"O .I set_child_tid
60 .\"O is set to
61 .\"O .IR child_tidptr ,
62 .\"O the fifth argument of that system call.
63 プロセスが
64 .B CLONE_CHILD_SETTID
65 フラグを指定した
66 .BR clone (2)
67 によって開始された場合、
68 .I set_child_tid
69
70 .I child_tidptr
71 に設定される。
72 これは
73 .BR clone (2)
74 のシステムコールの 5 番目の引き数である。
75 .\"Osato:
76 .\"Osato: __syscall5 で __NR_clone を呼び出すときの
77 .\"Osato: 5 番目の引き数ということだろうか。
78 .\"Osato:
79 .LP
80 .\"O When
81 .\"O .I set_child_tid
82 .\"O is set, the very first thing the new process does
83 .\"O is writing its PID at this address.
84 .I set_child_tid
85 が設定された場合、一番最初に新しいプロセスが行うことは、
86 このアドレスに自身の PID を書き込むことである。
87 .SS clear_child_tid
88 .\"O If a process is started using
89 .\"O .BR clone (2)
90 .\"O with the
91 .\"O .B CLONE_CHILD_CLEARTID
92 .\"O flag,
93 .\"O .I clear_child_tid
94 .\"O is set to
95 .\"O .IR child_tidptr ,
96 .\"O the fifth argument of that system call.
97 プロセスが
98 .B CLONE_CHILD_CLEARTID
99 フラグを指定した
100 .BR clone (2)
101 によって開始された場合、
102 .I clear_child_tid
103
104 .I child_tidptr
105 に設定される。
106 これは
107 .BR clone (2)
108 のシステムコールの 5 番目の引き数である。
109 .LP
110 .\"O The system call
111 .\"O .BR set_tid_address ()
112 .\"O sets the
113 .\"O .I clear_child_tid
114 .\"O value for the calling process to
115 .\"O .IR tidptr .
116 システムコール
117 .BR set_tid_address ()
118 は呼び出し元プロセスの
119 .I clear_child_tid
120 の値を
121 .I tidptr
122 に設定する。
123 .LP
124 .\"O When
125 .\"O .I clear_child_tid
126 .\"O is set, and the process exits, and the process was sharing memory
127 .\"O with other processes or threads, then 0 is written at this address,
128 .\"O and a
129 .\"O .I futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
130 .\"O call is done.
131 .\"O (That is, wake a single process waiting on this futex.)
132 .\"O Errors are ignored.
133 .I clear_child_tid
134 が設定されているときにプロセスが終了すると、
135 そのプロセスは他のプロセスまたはスレッドとメモリを共有しているので、
136 このアドレスに 0 が書き込まれ、
137 .I futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
138 の呼び出しが実行される
139 (つまり、この futex で待っている 1 つのプロセスを起こす (wake))。
140 エラーは無視される。
141 .\"O .SH "RETURN VALUE"
142 .SH 返り値
143 .\"O .BR set_tid_address ()
144 .\"O always returns the PID of the calling process.
145 .BR set_tid_address ()
146 は常に現在のプロセスの PID を返す。
147 .\"O .SH ERRORS
148 .SH エラー
149 .\"O .BR set_tid_address ()
150 .\"O always succeeds.
151 .BR set_tid_address ()
152 は常に成功する。
153 .\"O .SH VERSIONS
154 .SH バージョン
155 .\"O This call is present since Linux 2.5.48.
156 .\"O Details as given here are valid since Linux 2.5.49.
157 この呼び出しは Linux 2.5.48 以降で存在する。
158 ここで書かれた詳細は Linux 2.5.49 以降で有効である。
159 .\"O .SH "CONFORMING TO"
160 .SH 準拠
161 .\"O This system call is Linux-specific.
162 このシステムコールは Linux 独自である。
163 .\"O .SH "SEE ALSO"
164 .SH 関連項目
165 .BR clone (2),
166 .BR futex (2)