OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / 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)