.\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl) .\" .\" 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. .\" .\" Japanese Version Copyright (c) 2005 Yuichi SATO .\" all rights reserved. .\" Translated Wed Jan 26 07:21:01 JST 2005 .\" by Yuichi SATO .\" .TH SET_TID_ADDRESS 2 2004-09-10 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O set_tid_address \- set pointer to thread ID set_tid_address \- スレッド ID へのポインタを設定する .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "long set_tid_address(int *" tidptr ); .fi .\"O .SH DESCRIPTION .SH 説明 .\"O The kernel keeps for each process two values called .\"O .I set_child_tid .\"O and .\"O .I clear_child_tid .\"O that are NULL by default. カーネルは各プロセスについて .I set_child_tid と .I clear_child_tid という 2 つの値を保持する。 これらはデフォルトでは NULL である。 .SS set_child_tid .\"O If a process is started using .\"O .BR clone (2) .\"O with the .\"O .B CLONE_CHILD_SETTID .\"O flag, .\"O .I set_child_tid .\"O is set to .\"O .IR child_tidptr , .\"O the fifth argument of that system call. プロセスが .B CLONE_CHILD_SETTID フラグを指定した .BR clone (2) によって開始された場合、 .I set_child_tid は .I child_tidptr に設定される。 これは .BR clone (2) のシステムコールの 5 番目の引き数である。 .\"Osato: .\"Osato: __syscall5 で __NR_clone を呼び出すときの .\"Osato: 5 番目の引き数ということだろうか。 .\"Osato: .LP .\"O When .\"O .I set_child_tid .\"O is set, the very first thing the new process does .\"O is writing its PID at this address. .I set_child_tid が設定された場合、一番最初に新しいプロセスが行うことは、 このアドレスに自身の PID を書き込むことである。 .SS clear_child_tid .\"O If a process is started using .\"O .BR clone (2) .\"O with the .\"O .B CLONE_CHILD_CLEARTID .\"O flag, .\"O .I clear_child_tid .\"O is set to .\"O .IR child_tidptr , .\"O the fifth argument of that system call. プロセスが .B CLONE_CHILD_CLEARTID フラグを指定した .BR clone (2) によって開始された場合、 .I clear_child_tid は .I child_tidptr に設定される。 これは .BR clone (2) のシステムコールの 5 番目の引き数である。 .LP .\"O The system call .\"O .BR set_tid_address () .\"O sets the .\"O .I clear_child_tid .\"O value for the calling process to .\"O .IR tidptr . システムコール .BR set_tid_address () は呼び出し元プロセスの .I clear_child_tid の値を .I tidptr に設定する。 .LP .\"O When .\"O .I clear_child_tid .\"O is set, and the process exits, and the process was sharing memory .\"O with other processes or threads, then 0 is written at this address, .\"O and a .\"O .I futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); .\"O call is done. .\"O (That is, wake a single process waiting on this futex.) .\"O Errors are ignored. .I clear_child_tid が設定されているときにプロセスが終了すると、 そのプロセスは他のプロセスまたはスレッドとメモリを共有しているので、 このアドレスに 0 が書き込まれ、 .I futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); の呼び出しが実行される (つまり、この futex で待っている 1 つのプロセスを起こす (wake))。 エラーは無視される。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O .BR set_tid_address () .\"O always returns the PID of the calling process. .BR set_tid_address () は常に現在のプロセスの PID を返す。 .\"O .SH ERRORS .SH エラー .\"O .BR set_tid_address () .\"O always succeeds. .BR set_tid_address () は常に成功する。 .\"O .SH VERSIONS .SH バージョン .\"O This call is present since Linux 2.5.48. .\"O Details as given here are valid since Linux 2.5.49. この呼び出しは Linux 2.5.48 以降で存在する。 ここで書かれた詳細は Linux 2.5.49 以降で有効である。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O This system call is Linux-specific. このシステムコールは Linux 独自である。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR clone (2), .BR futex (2)