1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "POT-Creation-Date: 2012-04-23 07:54+0900\n"
10 "PO-Revision-Date: 2012-04-25 05:03+0900\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
19 #: build/C/man2/getcontext.2:23
25 #: build/C/man2/getcontext.2:23
31 #: build/C/man2/getcontext.2:23 build/C/man3/pthread_attr_init.3:24
32 #: build/C/man3/pthread_attr_setaffinity_np.3:24
33 #: build/C/man3/pthread_attr_setdetachstate.3:24
34 #: build/C/man3/pthread_attr_setguardsize.3:24
35 #: build/C/man3/pthread_attr_setinheritsched.3:24
36 #: build/C/man3/pthread_attr_setschedparam.3:24
37 #: build/C/man3/pthread_attr_setschedpolicy.3:24
38 #: build/C/man3/pthread_attr_setscope.3:24
39 #: build/C/man3/pthread_attr_setstack.3:24
40 #: build/C/man3/pthread_attr_setstackaddr.3:24
41 #: build/C/man3/pthread_attr_setstacksize.3:24
42 #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_cleanup_push.3:24
43 #: build/C/man3/pthread_cleanup_push_defer_np.3:24
44 #: build/C/man3/pthread_create.3:24 build/C/man3/pthread_detach.3:24
45 #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24
46 #: build/C/man3/pthread_getattr_np.3:24
47 #: build/C/man3/pthread_getcpuclockid.3:24 build/C/man3/pthread_join.3:24
48 #: build/C/man3/pthread_kill.3:24
49 #: build/C/man3/pthread_kill_other_threads_np.3:24
50 #: build/C/man3/pthread_self.3:24 build/C/man3/pthread_setaffinity_np.3:24
51 #: build/C/man3/pthread_setcancelstate.3:24
52 #: build/C/man3/pthread_setconcurrency.3:23
53 #: build/C/man3/pthread_setschedparam.3:24
54 #: build/C/man3/pthread_setschedprio.3:24 build/C/man3/pthread_sigmask.3:24
55 #: build/C/man3/pthread_sigqueue.3:23 build/C/man3/pthread_testcancel.3:24
56 #: build/C/man3/pthread_tryjoin_np.3:24 build/C/man3/pthread_yield.3:23
57 #: build/C/man7/pthreads.7:24
63 #: build/C/man2/getcontext.2:23 build/C/man3/makecontext.3:25
64 #: build/C/man3/pthread_attr_init.3:24
65 #: build/C/man3/pthread_attr_setaffinity_np.3:24
66 #: build/C/man3/pthread_attr_setdetachstate.3:24
67 #: build/C/man3/pthread_attr_setguardsize.3:24
68 #: build/C/man3/pthread_attr_setinheritsched.3:24
69 #: build/C/man3/pthread_attr_setschedparam.3:24
70 #: build/C/man3/pthread_attr_setschedpolicy.3:24
71 #: build/C/man3/pthread_attr_setscope.3:24
72 #: build/C/man3/pthread_attr_setstack.3:24
73 #: build/C/man3/pthread_attr_setstackaddr.3:24
74 #: build/C/man3/pthread_attr_setstacksize.3:24
75 #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_cleanup_push.3:24
76 #: build/C/man3/pthread_cleanup_push_defer_np.3:24
77 #: build/C/man3/pthread_create.3:24 build/C/man3/pthread_detach.3:24
78 #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24
79 #: build/C/man3/pthread_getattr_np.3:24
80 #: build/C/man3/pthread_getcpuclockid.3:24 build/C/man3/pthread_join.3:24
81 #: build/C/man3/pthread_kill.3:24
82 #: build/C/man3/pthread_kill_other_threads_np.3:24
83 #: build/C/man3/pthread_self.3:24 build/C/man3/pthread_setaffinity_np.3:24
84 #: build/C/man3/pthread_setcancelstate.3:24
85 #: build/C/man3/pthread_setconcurrency.3:23
86 #: build/C/man3/pthread_setschedparam.3:24
87 #: build/C/man3/pthread_setschedprio.3:24 build/C/man3/pthread_sigmask.3:24
88 #: build/C/man3/pthread_sigqueue.3:23 build/C/man3/pthread_testcancel.3:24
89 #: build/C/man3/pthread_tryjoin_np.3:24 build/C/man3/pthread_yield.3:23
90 #: build/C/man7/pthreads.7:24
92 msgid "Linux Programmer's Manual"
93 msgstr "Linux Programmer's Manual"
96 #: build/C/man2/getcontext.2:24 build/C/man3/makecontext.3:26
97 #: build/C/man3/pthread_attr_init.3:25
98 #: build/C/man3/pthread_attr_setaffinity_np.3:25
99 #: build/C/man3/pthread_attr_setdetachstate.3:25
100 #: build/C/man3/pthread_attr_setguardsize.3:25
101 #: build/C/man3/pthread_attr_setinheritsched.3:25
102 #: build/C/man3/pthread_attr_setschedparam.3:25
103 #: build/C/man3/pthread_attr_setschedpolicy.3:25
104 #: build/C/man3/pthread_attr_setscope.3:25
105 #: build/C/man3/pthread_attr_setstack.3:25
106 #: build/C/man3/pthread_attr_setstackaddr.3:25
107 #: build/C/man3/pthread_attr_setstacksize.3:25
108 #: build/C/man3/pthread_cancel.3:25 build/C/man3/pthread_cleanup_push.3:25
109 #: build/C/man3/pthread_cleanup_push_defer_np.3:25
110 #: build/C/man3/pthread_create.3:25 build/C/man3/pthread_detach.3:25
111 #: build/C/man3/pthread_equal.3:25 build/C/man3/pthread_exit.3:25
112 #: build/C/man3/pthread_getattr_np.3:25
113 #: build/C/man3/pthread_getcpuclockid.3:25 build/C/man3/pthread_join.3:25
114 #: build/C/man3/pthread_kill.3:25
115 #: build/C/man3/pthread_kill_other_threads_np.3:25
116 #: build/C/man3/pthread_self.3:25 build/C/man3/pthread_setaffinity_np.3:25
117 #: build/C/man3/pthread_setcancelstate.3:25
118 #: build/C/man3/pthread_setconcurrency.3:24
119 #: build/C/man3/pthread_setschedparam.3:25
120 #: build/C/man3/pthread_setschedprio.3:25 build/C/man3/pthread_sigmask.3:25
121 #: build/C/man3/pthread_sigqueue.3:24 build/C/man3/pthread_testcancel.3:25
122 #: build/C/man3/pthread_tryjoin_np.3:25 build/C/man3/pthread_yield.3:24
123 #: build/C/man7/pthreads.7:25
129 #: build/C/man2/getcontext.2:26
130 msgid "getcontext, setcontext - get or set the user context"
131 msgstr "getcontext, setcontext - ユーザコンテキストを取得/設定する"
134 #: build/C/man2/getcontext.2:26 build/C/man3/makecontext.3:28
135 #: build/C/man3/pthread_attr_init.3:28
136 #: build/C/man3/pthread_attr_setaffinity_np.3:28
137 #: build/C/man3/pthread_attr_setdetachstate.3:28
138 #: build/C/man3/pthread_attr_setguardsize.3:28
139 #: build/C/man3/pthread_attr_setinheritsched.3:28
140 #: build/C/man3/pthread_attr_setschedparam.3:28
141 #: build/C/man3/pthread_attr_setschedpolicy.3:28
142 #: build/C/man3/pthread_attr_setscope.3:28
143 #: build/C/man3/pthread_attr_setstack.3:28
144 #: build/C/man3/pthread_attr_setstackaddr.3:28
145 #: build/C/man3/pthread_attr_setstacksize.3:28
146 #: build/C/man3/pthread_cancel.3:27 build/C/man3/pthread_cleanup_push.3:28
147 #: build/C/man3/pthread_cleanup_push_defer_np.3:28
148 #: build/C/man3/pthread_create.3:27 build/C/man3/pthread_detach.3:27
149 #: build/C/man3/pthread_equal.3:27 build/C/man3/pthread_exit.3:27
150 #: build/C/man3/pthread_getattr_np.3:27
151 #: build/C/man3/pthread_getcpuclockid.3:27 build/C/man3/pthread_join.3:27
152 #: build/C/man3/pthread_kill.3:27
153 #: build/C/man3/pthread_kill_other_threads_np.3:27
154 #: build/C/man3/pthread_self.3:27 build/C/man3/pthread_setaffinity_np.3:28
155 #: build/C/man3/pthread_setcancelstate.3:28
156 #: build/C/man3/pthread_setconcurrency.3:27
157 #: build/C/man3/pthread_setschedparam.3:28
158 #: build/C/man3/pthread_setschedprio.3:27 build/C/man3/pthread_sigmask.3:27
159 #: build/C/man3/pthread_sigqueue.3:26 build/C/man3/pthread_testcancel.3:27
160 #: build/C/man3/pthread_tryjoin_np.3:28 build/C/man3/pthread_yield.3:26
166 #: build/C/man2/getcontext.2:28 build/C/man3/makecontext.3:30
167 msgid "B<#include E<lt>ucontext.hE<gt>>"
168 msgstr "B<#include E<lt>ucontext.hE<gt>>"
171 #: build/C/man2/getcontext.2:30
172 msgid "B<int getcontext(ucontext_t *>I<ucp>B<);>"
173 msgstr "B<int getcontext(ucontext_t *>I<ucp>B<);>"
176 #: build/C/man2/getcontext.2:32
177 msgid "B<int setcontext(const ucontext_t *>I<ucp>B<);>"
178 msgstr "B<int setcontext(const ucontext_t *>I<ucp>B<);>"
181 #: build/C/man2/getcontext.2:32 build/C/man3/makecontext.3:35
182 #: build/C/man3/pthread_attr_init.3:37
183 #: build/C/man3/pthread_attr_setaffinity_np.3:40
184 #: build/C/man3/pthread_attr_setdetachstate.3:39
185 #: build/C/man3/pthread_attr_setguardsize.3:39
186 #: build/C/man3/pthread_attr_setinheritsched.3:39
187 #: build/C/man3/pthread_attr_setschedparam.3:39
188 #: build/C/man3/pthread_attr_setschedpolicy.3:39
189 #: build/C/man3/pthread_attr_setscope.3:39
190 #: build/C/man3/pthread_attr_setstack.3:52
191 #: build/C/man3/pthread_attr_setstackaddr.3:39
192 #: build/C/man3/pthread_attr_setstacksize.3:39
193 #: build/C/man3/pthread_cancel.3:35 build/C/man3/pthread_cleanup_push.3:38
194 #: build/C/man3/pthread_cleanup_push_defer_np.3:38
195 #: build/C/man3/pthread_create.3:36 build/C/man3/pthread_detach.3:35
196 #: build/C/man3/pthread_equal.3:35 build/C/man3/pthread_exit.3:35
197 #: build/C/man3/pthread_getattr_np.3:36
198 #: build/C/man3/pthread_getcpuclockid.3:36 build/C/man3/pthread_join.3:35
199 #: build/C/man3/pthread_kill.3:35
200 #: build/C/man3/pthread_kill_other_threads_np.3:33
201 #: build/C/man3/pthread_self.3:35 build/C/man3/pthread_setaffinity_np.3:40
202 #: build/C/man3/pthread_setcancelstate.3:37
203 #: build/C/man3/pthread_setconcurrency.3:36
204 #: build/C/man3/pthread_setschedparam.3:39
205 #: build/C/man3/pthread_setschedprio.3:35 build/C/man3/pthread_sigmask.3:36
206 #: build/C/man3/pthread_sigqueue.3:43 build/C/man3/pthread_testcancel.3:35
207 #: build/C/man3/pthread_tryjoin_np.3:40 build/C/man3/pthread_yield.3:34
208 #: build/C/man7/pthreads.7:27
214 #: build/C/man2/getcontext.2:44
216 "In a System V-like environment, one has the two types I<mcontext_t> and "
217 "I<ucontext_t> defined in I<E<lt>ucontext.hE<gt>> and the four functions "
218 "B<getcontext>(), B<setcontext>(), B<makecontext>(3) and B<swapcontext>(3) "
219 "that allow user-level context switching between multiple threads of control "
222 "System V 的な環境では、 I<mcontext_t> および I<ucontext_t> という 2 つの型"
223 "と、 B<getcontext>(), B<setcontext>(), B<makecontext>(3), B<swapcontext>(3) "
224 "という 4 つの関数が I<E<lt>ucontext.hE<gt>> で定義されており、あるプロセス内"
225 "部で制御下にある複数のスレッド間で、 ユーザレベルのコンテキスト切替えができる"
229 #: build/C/man2/getcontext.2:48
231 "The I<mcontext_t> type is machine-dependent and opaque. The I<ucontext_t> "
232 "type is a structure that has at least the following fields:"
234 "I<mcontext_t> 型はマシン依存で、外部からは隠蔽されている。 I<ucontext_t> 型は"
235 "構造体で、少なくとも以下の 4 つのフィールドを持つ。"
238 #: build/C/man2/getcontext.2:58
241 "typedef struct ucontext {\n"
242 " struct ucontext *uc_link;\n"
243 " sigset_t uc_sigmask;\n"
244 " stack_t uc_stack;\n"
245 " mcontext_t uc_mcontext;\n"
249 "typedef struct ucontext {\n"
250 " struct ucontext *uc_link;\n"
251 " sigset_t uc_sigmask;\n"
252 " stack_t uc_stack;\n"
253 " mcontext_t uc_mcontext;\n"
258 #: build/C/man2/getcontext.2:75
260 "with I<sigset_t> and I<stack_t> defined in I<E<lt>signal.hE<gt>>. Here "
261 "I<uc_link> points to the context that will be resumed when the current "
262 "context terminates (in case the current context was created using "
263 "B<makecontext>(3)), I<uc_sigmask> is the set of signals blocked in this "
264 "context (see B<sigprocmask>(2)), I<uc_stack> is the stack used by this "
265 "context (see B<sigaltstack>(2)), and I<uc_mcontext> is the machine-specific "
266 "representation of the saved context, that includes the calling thread's "
269 "I<sigset_t> と I<stack_t> は I<E<lt>signal.hE<gt>> で定義されている。 ここで "
270 "I<uc_link> は、 現在のコンテキストが終了したとき、 続いて切り替わるコンテキス"
271 "トへのポインタである (現在のコンテキストが B<makecontext>(3) で生成されたも"
272 "のの場合)。 I<uc_sigmask> はこのコンテキストでブロックされている シグナル群で"
273 "ある (B<sigprocmask>(2) を見よ)。 I<uc_stack> はこのコンテキストが用いている"
274 "スタックである (B<signalstack>(2) を見よ)。 I<uc_mcontext> は保存されている"
275 "コンテキストの マシン特有の表現形式であり、 ここには呼び出したスレッドのマシ"
279 #: build/C/man2/getcontext.2:80
281 "The function B<getcontext>() initializes the structure pointed at by I<ucp> "
282 "to the currently active context."
284 "B<getcontext>() 関数は、 ポインタ I<ucp> が指す構造体を、 現在アクティブなコ"
288 #: build/C/man2/getcontext.2:92
290 "The function B<setcontext>() restores the user context pointed at by "
291 "I<ucp>. A successful call does not return. The context should have been "
292 "obtained by a call of B<getcontext>(), or B<makecontext>(3), or passed as "
293 "third argument to a signal handler."
295 "B<setcontext>() 関数は、ポインタ I<ucp> が指すユーザコンテキストをリストアす"
296 "る。 呼び出しに成功すると返らない。 このコンテキストは、以前に B<getcontext>"
297 "() または B<makecontext>(3) で得られたものか、 あるいはシグナルの第三引数と"
301 #: build/C/man2/getcontext.2:96
303 "If the context was obtained by a call of B<getcontext>(), program execution "
304 "continues as if this call just returned."
306 "コンテキストが B<getcontext>() の呼び出しによって得られていたものの場合は、 "
307 "プログラムはこの呼び出しから返った直後からのように実行を継続する。"
310 #: build/C/man2/getcontext.2:107
312 "If the context was obtained by a call of B<makecontext>(3), program "
313 "execution continues by a call to the function I<func> specified as the "
314 "second argument of that call to B<makecontext>(3). When the function "
315 "I<func> returns, we continue with the I<uc_link> member of the structure "
316 "I<ucp> specified as the first argument of that call to B<makecontext>(3). "
317 "When this member is NULL, the thread exits."
319 "コンテキストが B<makecontext>(3) の呼び出しによって得られていたものの場合"
320 "は、 プログラムの実行はその B<makecontext>(3) 呼び出しの第二引数で指定された"
321 "関数 I<func> を呼び出すかたちで継続する。 I<func> から返ると、 B<makecontext>"
322 "(3) 呼び出しの第一引数で指定されていた I<ucp> 構造体の I<uc_link> メンバで継"
323 "続する。 このメンバが NULL だった場合は、そのスレッドは終了する。"
326 #: build/C/man2/getcontext.2:114
328 "If the context was obtained by a call to a signal handler, then old standard "
329 "text says that \"program execution continues with the program instruction "
330 "following the instruction interrupted by the signal\". However, this "
331 "sentence was removed in SUSv2, and the present verdict is \"the result is "
334 "コンテキストがシグナルハンドラの呼び出しによって得られていたものの場合は、 古"
335 "い標準によれば 「プログラムの実行はシグナルによって割り込まれた命令の次の命令"
336 "から継続される」。 しかしこの文は SUSv2 で削除されたので、 現在の判断は「結果"
340 #: build/C/man2/getcontext.2:114 build/C/man3/makecontext.3:81
341 #: build/C/man3/pthread_attr_init.3:66
342 #: build/C/man3/pthread_attr_setaffinity_np.3:74
343 #: build/C/man3/pthread_attr_setdetachstate.3:75
344 #: build/C/man3/pthread_attr_setguardsize.3:88
345 #: build/C/man3/pthread_attr_setinheritsched.3:82
346 #: build/C/man3/pthread_attr_setschedparam.3:72
347 #: build/C/man3/pthread_attr_setschedpolicy.3:70
348 #: build/C/man3/pthread_attr_setscope.3:89
349 #: build/C/man3/pthread_attr_setstack.3:83
350 #: build/C/man3/pthread_attr_setstackaddr.3:72
351 #: build/C/man3/pthread_attr_setstacksize.3:59
352 #: build/C/man3/pthread_cancel.3:107 build/C/man3/pthread_cleanup_push.3:117
353 #: build/C/man3/pthread_create.3:113 build/C/man3/pthread_detach.3:47
354 #: build/C/man3/pthread_equal.3:39 build/C/man3/pthread_exit.3:69
355 #: build/C/man3/pthread_getattr_np.3:71
356 #: build/C/man3/pthread_getcpuclockid.3:44 build/C/man3/pthread_join.3:68
357 #: build/C/man3/pthread_kill.3:50 build/C/man3/pthread_self.3:44
358 #: build/C/man3/pthread_setaffinity_np.3:75
359 #: build/C/man3/pthread_setcancelstate.3:90
360 #: build/C/man3/pthread_setconcurrency.3:54
361 #: build/C/man3/pthread_setschedparam.3:102
362 #: build/C/man3/pthread_setschedprio.3:51 build/C/man3/pthread_sigmask.3:47
363 #: build/C/man3/pthread_sigqueue.3:63 build/C/man3/pthread_testcancel.3:48
364 #: build/C/man3/pthread_tryjoin_np.3:83 build/C/man3/pthread_yield.3:41
370 #: build/C/man2/getcontext.2:122
372 "When successful, B<getcontext>() returns 0 and B<setcontext>() does not "
373 "return. On error, both return -1 and set I<errno> appropriately."
375 "成功すると、 B<getcontext>() は 0 を返し、 B<setcontext>() は返らない。 失"
376 "敗すると、両者とも -1 を返し、I<errno> をエラーに応じて設定する。"
379 #: build/C/man2/getcontext.2:122 build/C/man3/makecontext.3:93
380 #: build/C/man3/pthread_attr_init.3:69
381 #: build/C/man3/pthread_attr_setaffinity_np.3:77
382 #: build/C/man3/pthread_attr_setdetachstate.3:78
383 #: build/C/man3/pthread_attr_setguardsize.3:91
384 #: build/C/man3/pthread_attr_setinheritsched.3:85
385 #: build/C/man3/pthread_attr_setschedparam.3:75
386 #: build/C/man3/pthread_attr_setschedpolicy.3:73
387 #: build/C/man3/pthread_attr_setscope.3:92
388 #: build/C/man3/pthread_attr_setstack.3:86
389 #: build/C/man3/pthread_attr_setstackaddr.3:75
390 #: build/C/man3/pthread_attr_setstacksize.3:62
391 #: build/C/man3/pthread_cancel.3:112 build/C/man3/pthread_cleanup_push.3:119
392 #: build/C/man3/pthread_create.3:120 build/C/man3/pthread_detach.3:52
393 #: build/C/man3/pthread_equal.3:43 build/C/man3/pthread_exit.3:71
394 #: build/C/man3/pthread_getattr_np.3:74
395 #: build/C/man3/pthread_getcpuclockid.3:47 build/C/man3/pthread_join.3:73
396 #: build/C/man3/pthread_kill.3:55 build/C/man3/pthread_self.3:46
397 #: build/C/man3/pthread_setaffinity_np.3:78
398 #: build/C/man3/pthread_setcancelstate.3:93
399 #: build/C/man3/pthread_setconcurrency.3:66
400 #: build/C/man3/pthread_setschedparam.3:110
401 #: build/C/man3/pthread_setschedprio.3:59 build/C/man3/pthread_sigmask.3:52
402 #: build/C/man3/pthread_sigqueue.3:68 build/C/man3/pthread_testcancel.3:52
403 #: build/C/man3/pthread_tryjoin_np.3:87 build/C/man3/pthread_yield.3:46
409 #: build/C/man2/getcontext.2:124
410 msgid "None defined."
414 #: build/C/man2/getcontext.2:124 build/C/man3/makecontext.3:102
415 #: build/C/man3/pthread_attr_init.3:77
416 #: build/C/man3/pthread_attr_setaffinity_np.3:106
417 #: build/C/man3/pthread_attr_setdetachstate.3:85
418 #: build/C/man3/pthread_attr_setguardsize.3:104
419 #: build/C/man3/pthread_attr_setinheritsched.3:99
420 #: build/C/man3/pthread_attr_setschedparam.3:87
421 #: build/C/man3/pthread_attr_setschedpolicy.3:87
422 #: build/C/man3/pthread_attr_setscope.3:105
423 #: build/C/man3/pthread_attr_setstack.3:110
424 #: build/C/man3/pthread_attr_setstackaddr.3:81
425 #: build/C/man3/pthread_attr_setstacksize.3:81
426 #: build/C/man3/pthread_cancel.3:120 build/C/man3/pthread_cleanup_push.3:123
427 #: build/C/man3/pthread_cleanup_push_defer_np.3:99
428 #: build/C/man3/pthread_create.3:144 build/C/man3/pthread_detach.3:62
429 #: build/C/man3/pthread_equal.3:45 build/C/man3/pthread_exit.3:73
430 #: build/C/man3/pthread_getattr_np.3:96
431 #: build/C/man3/pthread_getcpuclockid.3:63 build/C/man3/pthread_join.3:96
432 #: build/C/man3/pthread_kill.3:64
433 #: build/C/man3/pthread_kill_other_threads_np.3:45
434 #: build/C/man3/pthread_self.3:48 build/C/man3/pthread_setaffinity_np.3:119
435 #: build/C/man3/pthread_setcancelstate.3:111
436 #: build/C/man3/pthread_setconcurrency.3:81
437 #: build/C/man3/pthread_setschedparam.3:139
438 #: build/C/man3/pthread_setschedprio.3:81 build/C/man3/pthread_sigmask.3:55
439 #: build/C/man3/pthread_sigqueue.3:91 build/C/man3/pthread_testcancel.3:56
440 #: build/C/man3/pthread_tryjoin_np.3:110 build/C/man3/pthread_yield.3:50
442 msgid "CONFORMING TO"
446 #: build/C/man2/getcontext.2:130
448 "SUSv2, POSIX.1-2001. POSIX.1-2008 removes the specification of B<getcontext>"
449 "(), citing portability issues, and recommending that applications be "
450 "rewritten to use POSIX threads instead."
452 "SUSv2, POSIX.1-2001. POSIX.1-2008 では、移植性の問題から B<getcontext>() の"
453 "仕様が削除された。 代わりに、アプリケーションを POSIX スレッドを使って書き直"
457 #: build/C/man2/getcontext.2:130 build/C/man3/makecontext.3:110
458 #: build/C/man3/pthread_attr_init.3:79
459 #: build/C/man3/pthread_attr_setaffinity_np.3:109
460 #: build/C/man3/pthread_attr_setdetachstate.3:87
461 #: build/C/man3/pthread_attr_setguardsize.3:106
462 #: build/C/man3/pthread_attr_setschedparam.3:89
463 #: build/C/man3/pthread_attr_setscope.3:107
464 #: build/C/man3/pthread_attr_setstack.3:112
465 #: build/C/man3/pthread_attr_setstackaddr.3:84
466 #: build/C/man3/pthread_attr_setstacksize.3:83
467 #: build/C/man3/pthread_cancel.3:122 build/C/man3/pthread_cleanup_push.3:125
468 #: build/C/man3/pthread_create.3:146 build/C/man3/pthread_detach.3:64
469 #: build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75
470 #: build/C/man3/pthread_getcpuclockid.3:65 build/C/man3/pthread_join.3:98
471 #: build/C/man3/pthread_kill.3:66
472 #: build/C/man3/pthread_kill_other_threads_np.3:48
473 #: build/C/man3/pthread_self.3:50 build/C/man3/pthread_setaffinity_np.3:122
474 #: build/C/man3/pthread_setcancelstate.3:113
475 #: build/C/man3/pthread_setconcurrency.3:83
476 #: build/C/man3/pthread_setschedparam.3:141
477 #: build/C/man3/pthread_setschedprio.3:83 build/C/man3/pthread_sigmask.3:57
478 #: build/C/man3/pthread_yield.3:56
484 #: build/C/man2/getcontext.2:147
486 "The earliest incarnation of this mechanism was the B<setjmp>(3)/B<longjmp>"
487 "(3) mechanism. Since that does not define the handling of the signal "
488 "context, the next stage was the B<sigsetjmp>(3)/B<siglongjmp>(3) pair. The "
489 "present mechanism gives much more control. On the other hand, there is no "
490 "easy way to detect whether a return from B<getcontext>() is from the first "
491 "call, or via a B<setcontext>() call. The user has to invent her own "
492 "bookkeeping device, and a register variable won't do since registers are "
495 "このメカニズムの最古の実装は、 B<setjmp>(3)/B<longjmp>(3) 機構であった。 こ"
496 "れらにはシグナルコンテキストの取り扱いが定義されていなかったので、 次の段階で"
497 "は B<sigsetjmp>(3)/B<siglongjmp>(3) のペアが現われた。 現在の機構ではずっと"
498 "細かな制御ができる。 一方 B<getcontext>() から返ったとき、 これが最初の呼び"
499 "出しであったか、 それとも B<setcontext>() 呼び出しからのものであるかを 区別"
500 "する容易な方法がなくなってしまった。 ユーザは「しおり」機構を自分で作らなけれ"
501 "ばならない。 レジスタ変数は (レジスタはリストアされてしまうので) これをやって"
505 #: build/C/man2/getcontext.2:158
507 "When a signal occurs, the current user context is saved and a new context is "
508 "created by the kernel for the signal handler. Do not leave the handler "
509 "using B<longjmp>(3): it is undefined what would happen with contexts. Use "
510 "B<siglongjmp>(3) or B<setcontext>() instead."
512 "シグナルが発生すると、 現在のユーザコンテキストは保存され、 シグナルハンドラ"
513 "用のコンテキストがカーネルによって生成される。 今後はハンドラに B<longjmp>"
514 "(3) を使わせないこと: この関数のコンテキスト下での動作は定義されていない。 "
515 "代わりに B<siglongjmp>(3) か B<setcontext>() を使うこと。"
518 #: build/C/man2/getcontext.2:158 build/C/man3/makecontext.3:217
519 #: build/C/man3/pthread_attr_init.3:295
520 #: build/C/man3/pthread_attr_setaffinity_np.3:116
521 #: build/C/man3/pthread_attr_setdetachstate.3:109
522 #: build/C/man3/pthread_attr_setguardsize.3:156
523 #: build/C/man3/pthread_attr_setinheritsched.3:120
524 #: build/C/man3/pthread_attr_setschedparam.3:96
525 #: build/C/man3/pthread_attr_setschedpolicy.3:92
526 #: build/C/man3/pthread_attr_setscope.3:118
527 #: build/C/man3/pthread_attr_setstack.3:154
528 #: build/C/man3/pthread_attr_setstackaddr.3:108
529 #: build/C/man3/pthread_attr_setstacksize.3:109
530 #: build/C/man3/pthread_cancel.3:221 build/C/man3/pthread_cleanup_push.3:309
531 #: build/C/man3/pthread_cleanup_push_defer_np.3:102
532 #: build/C/man3/pthread_create.3:367 build/C/man3/pthread_detach.3:95
533 #: build/C/man3/pthread_equal.3:54 build/C/man3/pthread_exit.3:103
534 #: build/C/man3/pthread_getattr_np.3:343
535 #: build/C/man3/pthread_getcpuclockid.3:167 build/C/man3/pthread_join.3:125
536 #: build/C/man3/pthread_kill.3:73
537 #: build/C/man3/pthread_kill_other_threads_np.3:64
538 #: build/C/man3/pthread_self.3:74 build/C/man3/pthread_setaffinity_np.3:204
539 #: build/C/man3/pthread_setcancelstate.3:175
540 #: build/C/man3/pthread_setconcurrency.3:98
541 #: build/C/man3/pthread_setschedparam.3:429
542 #: build/C/man3/pthread_setschedprio.3:89 build/C/man3/pthread_sigmask.3:133
543 #: build/C/man3/pthread_sigqueue.3:93 build/C/man3/pthread_testcancel.3:61
544 #: build/C/man3/pthread_tryjoin_np.3:133 build/C/man3/pthread_yield.3:59
545 #: build/C/man7/pthreads.7:893
551 #: build/C/man2/getcontext.2:165
553 "B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), B<longjmp>(3), "
554 "B<makecontext>(3), B<sigsetjmp>(3)"
556 "B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), B<longjmp>(3), "
557 "B<makecontext>(3), B<sigsetjmp>(3)"
560 #: build/C/man2/getcontext.2:165 build/C/man3/makecontext.3:223
561 #: build/C/man3/pthread_attr_init.3:309
562 #: build/C/man3/pthread_attr_setaffinity_np.3:122
563 #: build/C/man3/pthread_attr_setdetachstate.3:115
564 #: build/C/man3/pthread_attr_setguardsize.3:164
565 #: build/C/man3/pthread_attr_setinheritsched.3:129
566 #: build/C/man3/pthread_attr_setschedparam.3:106
567 #: build/C/man3/pthread_attr_setschedpolicy.3:101
568 #: build/C/man3/pthread_attr_setscope.3:126
569 #: build/C/man3/pthread_attr_setstack.3:164
570 #: build/C/man3/pthread_attr_setstackaddr.3:114
571 #: build/C/man3/pthread_attr_setstacksize.3:116
572 #: build/C/man3/pthread_cancel.3:231 build/C/man3/pthread_cleanup_push.3:315
573 #: build/C/man3/pthread_cleanup_push_defer_np.3:108
574 #: build/C/man3/pthread_create.3:378 build/C/man3/pthread_detach.3:102
575 #: build/C/man3/pthread_equal.3:58 build/C/man3/pthread_exit.3:107
576 #: build/C/man3/pthread_getattr_np.3:357
577 #: build/C/man3/pthread_getcpuclockid.3:175 build/C/man3/pthread_join.3:132
578 #: build/C/man3/pthread_kill.3:82
579 #: build/C/man3/pthread_kill_other_threads_np.3:70
580 #: build/C/man3/pthread_self.3:78 build/C/man3/pthread_setaffinity_np.3:212
581 #: build/C/man3/pthread_setcancelstate.3:180
582 #: build/C/man3/pthread_setconcurrency.3:101
583 #: build/C/man3/pthread_setschedparam.3:441
584 #: build/C/man3/pthread_setschedprio.3:101 build/C/man3/pthread_sigmask.3:142
585 #: build/C/man3/pthread_sigqueue.3:101 build/C/man3/pthread_testcancel.3:66
586 #: build/C/man3/pthread_tryjoin_np.3:138 build/C/man3/pthread_yield.3:63
587 #: build/C/man7/pthreads.7:927
593 #: build/C/man2/getcontext.2:172 build/C/man3/makecontext.3:230
594 #: build/C/man3/pthread_attr_init.3:316
595 #: build/C/man3/pthread_attr_setaffinity_np.3:129
596 #: build/C/man3/pthread_attr_setdetachstate.3:122
597 #: build/C/man3/pthread_attr_setguardsize.3:171
598 #: build/C/man3/pthread_attr_setinheritsched.3:136
599 #: build/C/man3/pthread_attr_setschedparam.3:113
600 #: build/C/man3/pthread_attr_setschedpolicy.3:108
601 #: build/C/man3/pthread_attr_setscope.3:133
602 #: build/C/man3/pthread_attr_setstack.3:171
603 #: build/C/man3/pthread_attr_setstackaddr.3:121
604 #: build/C/man3/pthread_attr_setstacksize.3:123
605 #: build/C/man3/pthread_cancel.3:238 build/C/man3/pthread_cleanup_push.3:322
606 #: build/C/man3/pthread_cleanup_push_defer_np.3:115
607 #: build/C/man3/pthread_create.3:385 build/C/man3/pthread_detach.3:109
608 #: build/C/man3/pthread_equal.3:65 build/C/man3/pthread_exit.3:114
609 #: build/C/man3/pthread_getattr_np.3:364
610 #: build/C/man3/pthread_getcpuclockid.3:182 build/C/man3/pthread_join.3:139
611 #: build/C/man3/pthread_kill.3:89
612 #: build/C/man3/pthread_kill_other_threads_np.3:77
613 #: build/C/man3/pthread_self.3:85 build/C/man3/pthread_setaffinity_np.3:219
614 #: build/C/man3/pthread_setcancelstate.3:187
615 #: build/C/man3/pthread_setconcurrency.3:108
616 #: build/C/man3/pthread_setschedparam.3:448
617 #: build/C/man3/pthread_setschedprio.3:108 build/C/man3/pthread_sigmask.3:149
618 #: build/C/man3/pthread_sigqueue.3:108 build/C/man3/pthread_testcancel.3:73
619 #: build/C/man3/pthread_tryjoin_np.3:145 build/C/man3/pthread_yield.3:70
620 #: build/C/man7/pthreads.7:934
622 "This page is part of release 3.38 of the Linux I<man-pages> project. A "
623 "description of the project, and information about reporting bugs, can be "
624 "found at http://www.kernel.org/doc/man-pages/."
626 "この man ページは Linux I<man-pages> プロジェクトのリリース 3.38 の一部である。\n"
627 "プロジェクトの説明とバグ報告に関する情報は\n"
628 "http://www.kernel.org/doc/man-pages/ に書かれている。"
631 #: build/C/man3/makecontext.3:25
637 #: build/C/man3/makecontext.3:25
643 #: build/C/man3/makecontext.3:25
649 #: build/C/man3/makecontext.3:28
650 msgid "makecontext, swapcontext - manipulate user context"
651 msgstr "makecontext, swapcontext - ユーザコンテキストを操作する"
654 #: build/C/man3/makecontext.3:33
656 "B<void makecontext(ucontext_t *>I<ucp>B<, void (*>I<func>B<)(),> B<int "
659 "B<void makecontext(ucontext_t *>I<ucp>B<, void (*>I<func>B<)(),> B<int "
663 #: build/C/man3/makecontext.3:35
664 msgid "B<int swapcontext(ucontext_t *>I<oucp>B<, ucontext_t *>I<ucp>B<);>"
665 msgstr "B<int swapcontext(ucontext_t *>I<oucp>B<, ucontext_t *>I<ucp>B<);>"
668 #: build/C/man3/makecontext.3:46
670 "In a System V-like environment, one has the type I<ucontext_t> defined in "
671 "I<E<lt>ucontext.hE<gt>> and the four functions B<getcontext>(2), "
672 "B<setcontext>(2), B<makecontext>() and B<swapcontext>() that allow user-"
673 "level context switching between multiple threads of control within a process."
675 "System V 的な環境では、 B<mcontext_t> および B<ucontext_t> という 2 つの型"
676 "と、 B<getcontext>(2), B<setcontext>(2), B<makecontext>(), B<swapcontext>() "
677 "という 4 つの関数が I<E<lt>ucontext.hE<gt>> で定義されており、あるプロセス内"
678 "部で制御下にある複数のスレッド間で、 ユーザレベルのコンテキスト切替えができる"
682 #: build/C/man3/makecontext.3:49
683 msgid "For the type and the first two functions, see B<getcontext>(2)."
685 "これらの型と、最初の 2 つの関数については、 B<getcontext>(2) を参照のこと。"
688 #: build/C/man3/makecontext.3:61
690 "The B<makecontext>() function modifies the context pointed to by I<ucp> "
691 "(which was obtained from a call to B<getcontext>(2)). Before invoking "
692 "B<makecontext>(), the caller must allocate a new stack for this context and "
693 "assign its address to I<ucp-E<gt>uc_stack>, and define a successor context "
694 "and assign its address to I<ucp-E<gt>uc_link>."
696 "B<makecontext>() 関数は、ポインタ I<ucp> が指すコンテキストを変更する "
697 "(I<ucp> は以前の B<getcontext>(2) 呼び出しで得られたものである)。 "
698 "B<makecontext>() を起動する前には、呼び出し者は、このコンテキスト用に 新しい"
699 "スタックを確保し、そのアドレスを I<ucp-E<gt>uc_stack> に代入し、 さらに後継の"
700 "コンテキストを定義し、そのアドレスを I<ucp-E<gt>uc_link> に 代入しなければな"
704 #: build/C/man3/makecontext.3:75
706 "When this context is later activated (using B<setcontext>(2) or "
707 "B<swapcontext>()) the function I<func> is called, and passed the series of "
708 "integer (I<int>) arguments that follow I<argc>; the caller must specify the "
709 "number of these arguments in I<argc>. When this function returns, the "
710 "successor context is activated. If the successor context pointer is NULL, "
713 "このコンテキストが将来 (B<setcontext>(2) または B<swapcontext>() によっ"
714 "て) 有効にされると、関数 I<func> が呼ばれ、 引き数として I<argc> 以降の整数 "
715 "(I<int>) 引き数の列が渡される。 呼び出し者は I<argc> にこれらの引き数の個数"
716 "を指定しなければならない。 この関数が戻ると、後継のコンテキストが有効にな"
717 "る。 後継コンテキストのポインタが NULL の場合、そのスレッドが終了する。"
720 #: build/C/man3/makecontext.3:81
722 "The B<swapcontext>() function saves the current context in the structure "
723 "pointed to by I<oucp>, and then activates the context pointed to by I<ucp>."
725 "B<swapcontext>() 関数は現在のコンテキストを ポインタ I<oucp> が指す構造体に"
726 "保存し、 ポインタ I<ucp> が指すコンテキストを有効にする。"
729 #: build/C/man3/makecontext.3:93
731 "When successful, B<swapcontext>() does not return. (But we may return "
732 "later, in case I<oucp> is activated, in which case it looks like "
733 "B<swapcontext>() returns 0.) On error, B<swapcontext>() returns -1 and "
734 "sets I<errno> appropriately."
736 "成功すると、 B<swapcontext>() は返らない (しかし後に I<oucp> が有効になった"
737 "場合には返ることがある。 このときには B<swapcontext>() は 0 を返すように見え"
738 "る。) 失敗すると、 B<swapcontext>() は -1 を返し、 I<errno> をエラーに応じ"
742 #: build/C/man3/makecontext.3:94
743 #: build/C/man3/pthread_attr_setaffinity_np.3:100
744 #: build/C/man3/pthread_getattr_np.3:75
750 #: build/C/man3/makecontext.3:97
751 msgid "Insufficient stack space left."
752 msgstr "スタックに割り当てる空間が残っていない。"
755 #: build/C/man3/makecontext.3:97
756 #: build/C/man3/pthread_attr_setaffinity_np.3:104
757 #: build/C/man3/pthread_attr_setguardsize.3:102
758 #: build/C/man3/pthread_attr_setstack.3:108
759 #: build/C/man3/pthread_attr_setstackaddr.3:79
760 #: build/C/man3/pthread_attr_setstacksize.3:79
761 #: build/C/man3/pthread_getattr_np.3:94
762 #: build/C/man3/pthread_getcpuclockid.3:61
763 #: build/C/man3/pthread_setaffinity_np.3:117
764 #: build/C/man3/pthread_setconcurrency.3:79
765 #: build/C/man3/pthread_setschedprio.3:79 build/C/man3/pthread_sigqueue.3:87
766 #: build/C/man3/pthread_tryjoin_np.3:108
772 #: build/C/man3/makecontext.3:102
774 "B<makecontext>() and B<swapcontext>() are provided in glibc since version "
777 "B<makecontext>() と B<swapcontext>() は、バージョン 2.1 以降の glibc で提供"
781 #: build/C/man3/makecontext.3:110
783 "SUSv2, POSIX.1-2001. POSIX.1-2008 removes the specifications of "
784 "B<makecontext>() and B<swapcontext>(), citing portability issues, and "
785 "recommending that applications be rewritten to use POSIX threads instead."
787 "SUSv2, POSIX.1-2001. POSIX.1-2008 では、移植性の問題から B<makecontext>() "
788 "と B<swapcontext>() の仕様が削除されている。 代わりに、アプリケーションを "
789 "POSIX スレッドを使って書き直すことが 推奨されている。"
792 #: build/C/man3/makecontext.3:118
794 "The interpretation of I<ucp-E<gt>uc_stack> is just as in B<sigaltstack>(2), "
795 "namely, this struct contains the start and length of a memory area to be "
796 "used as the stack, regardless of the direction of growth of the stack. "
797 "Thus, it is not necessary for the user program to worry about this direction."
799 "I<ucp-E<gt>uc_stack> の解釈は B<sigaltstack>(2) の場合と同じである。 すなわ"
800 "ちこの構造体には、 スタックとして用いられるメモリ領域の開始アドレスと長さが含"
801 "まれ、 これはスタックが伸びる方向がどちらであるかには関係しない。 したがっ"
802 "て、ユーザプログラムはこの件については心配しなくてよい。"
805 #: build/C/man3/makecontext.3:134
807 "On architectures where I<int> and pointer types are the same size (e.g., "
808 "x86-32, where both types are 32 bits), you may be able to get away with "
809 "passing pointers as arguments to B<makecontext>() following I<argc>. "
810 "However, doing this is not guaranteed to be portable, is undefined according "
811 "to the standards, and won't work on architectures where pointers are larger "
812 "than I<int>s. Nevertheless, starting with version 2.8, glibc makes some "
813 "changes to B<makecontext>(), to permit this on some 64-bit architectures (e."
816 "I<int> とポインタ型が同じ大きさであるアーキテクチャでは (x86-32 はその例であ"
817 "り、両方の型とも 32 ビットである)、 B<makecontext>() の I<argc> 以降の引き数"
818 "としてポインタを渡してもうまく動くかもしれない。 しかしながら、このようにする"
819 "と、移植性は保証されず、 標準に従えば動作は未定義であり、ポインタが I<int> よ"
820 "りも大きいアーキテクチャでは正しく動作しないことだろう。 それにも関わらず、"
821 "バージョン 2.8 以降の glibc では、 B<makecontext>() に変更が行われ、(x86-64 "
822 "などの) いくつかの 64 ビットアーキテクチャで 引き数としてポインタを渡すことが"
826 #: build/C/man3/makecontext.3:134 build/C/man3/pthread_attr_init.3:85
827 #: build/C/man3/pthread_attr_setdetachstate.3:106
828 #: build/C/man3/pthread_attr_setguardsize.3:153
829 #: build/C/man3/pthread_attr_setinheritsched.3:117
830 #: build/C/man3/pthread_attr_setschedparam.3:93
831 #: build/C/man3/pthread_attr_setschedpolicy.3:89
832 #: build/C/man3/pthread_attr_setstack.3:151
833 #: build/C/man3/pthread_attr_setstacksize.3:106
834 #: build/C/man3/pthread_cancel.3:130 build/C/man3/pthread_cleanup_push.3:149
835 #: build/C/man3/pthread_create.3:200 build/C/man3/pthread_detach.3:91
836 #: build/C/man3/pthread_getattr_np.3:99
837 #: build/C/man3/pthread_getcpuclockid.3:76 build/C/man3/pthread_join.3:122
838 #: build/C/man3/pthread_setaffinity_np.3:152
839 #: build/C/man3/pthread_setcancelstate.3:172
840 #: build/C/man3/pthread_setschedparam.3:147 build/C/man3/pthread_sigmask.3:59
841 #: build/C/man3/pthread_testcancel.3:58 build/C/man3/pthread_tryjoin_np.3:113
847 #: build/C/man3/makecontext.3:142
849 "The example program below demonstrates the use of B<getcontext>(2), "
850 "B<makecontext>(), and B<swapcontext>(). Running the program produces the "
853 "以下のサンプル・プログラムは、 B<getcontext>(2), B<makecontext>(), "
854 "B<swapcontext>() の使用方法の例を示すものである。 このプログラムを実行する"
858 #: build/C/man3/makecontext.3:154
862 "main: swapcontext(&uctx_main, &uctx_func2)\n"
864 "func2: swapcontext(&uctx_func2, &uctx_func1)\n"
866 "func1: swapcontext(&uctx_func1, &uctx_func2)\n"
872 "main: swapcontext(&uctx_main, &uctx_func2)\n"
874 "func2: swapcontext(&uctx_func2, &uctx_func1)\n"
876 "func1: swapcontext(&uctx_func1, &uctx_func2)\n"
882 #: build/C/man3/makecontext.3:156 build/C/man3/pthread_attr_init.3:146
883 #: build/C/man3/pthread_cancel.3:146 build/C/man3/pthread_cleanup_push.3:225
884 #: build/C/man3/pthread_create.3:239 build/C/man3/pthread_getattr_np.3:177
885 #: build/C/man3/pthread_getcpuclockid.3:93
886 #: build/C/man3/pthread_setschedparam.3:222 build/C/man3/pthread_sigmask.3:77
888 msgid "Program source"
892 #: build/C/man3/makecontext.3:162
895 "#include E<lt>ucontext.hE<gt>\n"
896 "#include E<lt>stdio.hE<gt>\n"
897 "#include E<lt>stdlib.hE<gt>\n"
899 "#include E<lt>ucontext.hE<gt>\n"
900 "#include E<lt>stdio.hE<gt>\n"
901 "#include E<lt>stdlib.hE<gt>\n"
904 #: build/C/man3/makecontext.3:164
906 msgid "static ucontext_t uctx_main, uctx_func1, uctx_func2;\n"
907 msgstr "static ucontext_t uctx_main, uctx_func1, uctx_func2;\n"
910 #: build/C/man3/makecontext.3:167
913 "#define handle_error(msg) \\e\n"
914 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
916 "#define handle_error(msg) \\e\n"
917 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
920 #: build/C/man3/makecontext.3:177
926 " printf(\"func1: started\\en\");\n"
927 " printf(\"func1: swapcontext(&uctx_func1, &uctx_func2)\\en\");\n"
928 " if (swapcontext(&uctx_func1, &uctx_func2) == -1)\n"
929 " handle_error(\"swapcontext\");\n"
930 " printf(\"func1: returning\\en\");\n"
936 " printf(\"func1: started\\en\");\n"
937 " printf(\"func1: swapcontext(&uctx_func1, &uctx_func2)\\en\");\n"
938 " if (swapcontext(&uctx_func1, &uctx_func2) == -1)\n"
939 " handle_error(\"swapcontext\");\n"
940 " printf(\"func1: returning\\en\");\n"
944 #: build/C/man3/makecontext.3:187
950 " printf(\"func2: started\\en\");\n"
951 " printf(\"func2: swapcontext(&uctx_func2, &uctx_func1)\\en\");\n"
952 " if (swapcontext(&uctx_func2, &uctx_func1) == -1)\n"
953 " handle_error(\"swapcontext\");\n"
954 " printf(\"func2: returning\\en\");\n"
960 " printf(\"func2: started\\en\");\n"
961 " printf(\"func2: swapcontext(&uctx_func2, &uctx_func1)\\en\");\n"
962 " if (swapcontext(&uctx_func2, &uctx_func1) == -1)\n"
963 " handle_error(\"swapcontext\");\n"
964 " printf(\"func2: returning\\en\");\n"
968 #: build/C/man3/makecontext.3:193
972 "main(int argc, char *argv[])\n"
974 " char func1_stack[16384];\n"
975 " char func2_stack[16384];\n"
978 "main(int argc, char *argv[])\n"
980 " char func1_stack[16384];\n"
981 " char func2_stack[16384];\n"
984 #: build/C/man3/makecontext.3:200
987 " if (getcontext(&uctx_func1) == -1)\n"
988 " handle_error(\"getcontext\");\n"
989 " uctx_func1.uc_stack.ss_sp = func1_stack;\n"
990 " uctx_func1.uc_stack.ss_size = sizeof(func1_stack);\n"
991 " uctx_func1.uc_link = &uctx_main;\n"
992 " makecontext(&uctx_func1, func1, 0);\n"
994 " if (getcontext(&uctx_func1) == -1)\n"
995 " handle_error(\"getcontext\");\n"
996 " uctx_func1.uc_stack.ss_sp = func1_stack;\n"
997 " uctx_func1.uc_stack.ss_size = sizeof(func1_stack);\n"
998 " uctx_func1.uc_link = &uctx_main;\n"
999 " makecontext(&uctx_func1, func1, 0);\n"
1002 #: build/C/man3/makecontext.3:208
1005 " if (getcontext(&uctx_func2) == -1)\n"
1006 " handle_error(\"getcontext\");\n"
1007 " uctx_func2.uc_stack.ss_sp = func2_stack;\n"
1008 " uctx_func2.uc_stack.ss_size = sizeof(func2_stack);\n"
1009 " /* Successor context is f1(), unless argc E<gt> 1 */\n"
1010 " uctx_func2.uc_link = (argc E<gt> 1) ? NULL : &uctx_func1;\n"
1011 " makecontext(&uctx_func2, func2, 0);\n"
1013 " if (getcontext(&uctx_func2) == -1)\n"
1014 " handle_error(\"getcontext\");\n"
1015 " uctx_func2.uc_stack.ss_sp = func2_stack;\n"
1016 " uctx_func2.uc_stack.ss_size = sizeof(func2_stack);\n"
1017 " /* Successor context is f1(), unless argc E<gt> 1 */\n"
1018 " uctx_func2.uc_link = (argc E<gt> 1) ? NULL : &uctx_func1;\n"
1019 " makecontext(&uctx_func2, func2, 0);\n"
1022 #: build/C/man3/makecontext.3:212
1025 " printf(\"main: swapcontext(&uctx_main, &uctx_func2)\\en\");\n"
1026 " if (swapcontext(&uctx_main, &uctx_func2) == -1)\n"
1027 " handle_error(\"swapcontext\");\n"
1029 " printf(\"main: swapcontext(&uctx_main, &uctx_func2)\\en\");\n"
1030 " if (swapcontext(&uctx_main, &uctx_func2) == -1)\n"
1031 " handle_error(\"swapcontext\");\n"
1034 #: build/C/man3/makecontext.3:216
1037 " printf(\"main: exiting\\en\");\n"
1038 " exit(EXIT_SUCCESS);\n"
1041 " printf(\"main: exiting\\en\");\n"
1042 " exit(EXIT_SUCCESS);\n"
1046 #: build/C/man3/makecontext.3:223
1048 "B<getcontext>(2), B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), "
1051 "B<getcontext>(2), B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), "
1055 #: build/C/man3/pthread_attr_init.3:24
1057 msgid "PTHREAD_ATTR_INIT"
1058 msgstr "PTHREAD_ATTR_INIT"
1061 #: build/C/man3/pthread_attr_init.3:24
1067 #: build/C/man3/pthread_attr_init.3:28
1069 "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread "
1074 #: build/C/man3/pthread_attr_init.3:31
1075 #: build/C/man3/pthread_attr_setdetachstate.3:31
1076 #: build/C/man3/pthread_attr_setguardsize.3:31
1077 #: build/C/man3/pthread_attr_setinheritsched.3:31
1078 #: build/C/man3/pthread_attr_setschedparam.3:31
1079 #: build/C/man3/pthread_attr_setschedpolicy.3:31
1080 #: build/C/man3/pthread_attr_setscope.3:31
1081 #: build/C/man3/pthread_attr_setstack.3:31
1082 #: build/C/man3/pthread_attr_setstackaddr.3:31
1083 #: build/C/man3/pthread_attr_setstacksize.3:31
1084 #: build/C/man3/pthread_cancel.3:30 build/C/man3/pthread_cleanup_push.3:31
1085 #: build/C/man3/pthread_cleanup_push_defer_np.3:31
1086 #: build/C/man3/pthread_create.3:30 build/C/man3/pthread_detach.3:30
1087 #: build/C/man3/pthread_equal.3:30 build/C/man3/pthread_exit.3:30
1088 #: build/C/man3/pthread_join.3:30
1089 #: build/C/man3/pthread_kill_other_threads_np.3:30
1090 #: build/C/man3/pthread_self.3:30 build/C/man3/pthread_setcancelstate.3:31
1091 #: build/C/man3/pthread_setconcurrency.3:30
1092 #: build/C/man3/pthread_setschedparam.3:31
1093 #: build/C/man3/pthread_setschedprio.3:30 build/C/man3/pthread_sigqueue.3:29
1094 #: build/C/man3/pthread_testcancel.3:30 build/C/man3/pthread_yield.3:29
1096 msgid "B<#include E<lt>pthread.hE<gt>>\n"
1097 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
1100 #: build/C/man3/pthread_attr_init.3:34
1103 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
1104 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
1106 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
1107 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
1110 #: build/C/man3/pthread_attr_init.3:36
1111 #: build/C/man3/pthread_attr_setaffinity_np.3:39
1112 #: build/C/man3/pthread_attr_setdetachstate.3:38
1113 #: build/C/man3/pthread_attr_setguardsize.3:38
1114 #: build/C/man3/pthread_attr_setinheritsched.3:38
1115 #: build/C/man3/pthread_attr_setschedparam.3:38
1116 #: build/C/man3/pthread_attr_setschedpolicy.3:38
1117 #: build/C/man3/pthread_attr_setscope.3:38
1118 #: build/C/man3/pthread_attr_setstack.3:38
1119 #: build/C/man3/pthread_attr_setstackaddr.3:38
1120 #: build/C/man3/pthread_attr_setstacksize.3:38
1121 #: build/C/man3/pthread_cancel.3:34 build/C/man3/pthread_cleanup_push.3:37
1122 #: build/C/man3/pthread_equal.3:34 build/C/man3/pthread_exit.3:34
1123 #: build/C/man3/pthread_getattr_np.3:35
1124 #: build/C/man3/pthread_getcpuclockid.3:35 build/C/man3/pthread_self.3:34
1125 #: build/C/man3/pthread_setaffinity_np.3:39
1126 #: build/C/man3/pthread_setcancelstate.3:36
1127 #: build/C/man3/pthread_setconcurrency.3:35
1128 #: build/C/man3/pthread_setschedparam.3:38
1129 #: build/C/man3/pthread_setschedprio.3:34 build/C/man3/pthread_testcancel.3:34
1131 msgid "Compile and link with I<-pthread>.\n"
1135 #: build/C/man3/pthread_attr_init.3:48
1137 "The B<pthread_attr_init>() function initializes the thread attributes "
1138 "object pointed to by I<attr> with default attribute values. After this "
1139 "call, individual attributes of the object can be set using various related "
1140 "functions (listed under SEE ALSO), and then the object can be used in one or "
1141 "more B<pthread_create>(3) calls that create threads."
1145 #: build/C/man3/pthread_attr_init.3:53
1147 "Calling B<pthread_attr_init>() on a thread attributes object that has "
1148 "already been initialized results in undefined behavior."
1152 #: build/C/man3/pthread_attr_init.3:60
1154 "When a thread attributes object is no longer required, it should be "
1155 "destroyed using the B<pthread_attr_destroy>() function. Destroying a "
1156 "thread attributes object has no effect on threads that were created using "
1161 #: build/C/man3/pthread_attr_init.3:66
1163 "Once a thread attributes object has been destroyed, it can be reinitialized "
1164 "using B<pthread_attr_init>(). Any other use of a destroyed thread "
1165 "attributes object has undefined results."
1169 #: build/C/man3/pthread_attr_init.3:69
1170 #: build/C/man3/pthread_attr_setaffinity_np.3:77
1171 #: build/C/man3/pthread_attr_setdetachstate.3:78
1172 #: build/C/man3/pthread_attr_setguardsize.3:91
1173 #: build/C/man3/pthread_attr_setinheritsched.3:85
1174 #: build/C/man3/pthread_attr_setschedparam.3:75
1175 #: build/C/man3/pthread_attr_setschedpolicy.3:73
1176 #: build/C/man3/pthread_attr_setscope.3:92
1177 #: build/C/man3/pthread_attr_setstack.3:86
1178 #: build/C/man3/pthread_attr_setstackaddr.3:75
1179 #: build/C/man3/pthread_attr_setstacksize.3:62
1180 #: build/C/man3/pthread_setaffinity_np.3:78
1181 #: build/C/man3/pthread_setcancelstate.3:93
1183 "On success, these functions return 0; on error, they return a nonzero error "
1188 #: build/C/man3/pthread_attr_init.3:77
1190 "POSIX.1-2001 documents an B<ENOMEM> error for B<pthread_attr_init>(); on "
1191 "Linux these functions always succeed (but portable and future-proof "
1192 "applications should nevertheless handle a possible error return)."
1196 #: build/C/man3/pthread_attr_init.3:79
1197 #: build/C/man3/pthread_attr_setdetachstate.3:87
1198 #: build/C/man3/pthread_attr_setguardsize.3:106
1199 #: build/C/man3/pthread_attr_setinheritsched.3:101
1200 #: build/C/man3/pthread_attr_setschedparam.3:89
1201 #: build/C/man3/pthread_attr_setschedpolicy.3:89
1202 #: build/C/man3/pthread_attr_setscope.3:107
1203 #: build/C/man3/pthread_attr_setstack.3:112
1204 #: build/C/man3/pthread_attr_setstacksize.3:83
1205 #: build/C/man3/pthread_cancel.3:122 build/C/man3/pthread_cleanup_push.3:125
1206 #: build/C/man3/pthread_create.3:146 build/C/man3/pthread_detach.3:64
1207 #: build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75
1208 #: build/C/man3/pthread_getcpuclockid.3:65 build/C/man3/pthread_join.3:98
1209 #: build/C/man3/pthread_kill.3:66 build/C/man3/pthread_self.3:50
1210 #: build/C/man3/pthread_setcancelstate.3:113
1211 #: build/C/man3/pthread_setconcurrency.3:83
1212 #: build/C/man3/pthread_setschedparam.3:141
1213 #: build/C/man3/pthread_setschedprio.3:83 build/C/man3/pthread_sigmask.3:57
1214 #: build/C/man3/pthread_testcancel.3:58
1215 msgid "POSIX.1-2001."
1219 #: build/C/man3/pthread_attr_init.3:85
1221 "The I<pthread_attr_t> type should be treated as opaque: any access to the "
1222 "object other than via pthreads functions is nonportable and produces "
1223 "undefined results."
1227 #: build/C/man3/pthread_attr_init.3:94
1229 "The program below optionally makes use of B<pthread_attr_init>() and "
1230 "various related functions to initialize a thread attributes object that is "
1231 "used to create a single thread. Once created, the thread uses the "
1232 "B<pthread_getattr_np>(3) function (a nonstandard GNU extension) to retrieve "
1233 "the thread's attributes, and then displays those attributes."
1237 #: build/C/man3/pthread_attr_init.3:103
1239 "If the program is run with no command-line argument, then it passes NULL as "
1240 "the I<attr> argument of B<pthread_create>(3), so that the thread is created "
1241 "with default attributes. Running the program on Linux/x86-32 with the NPTL "
1242 "threading implementation, we see the following:"
1245 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
1247 #: build/C/man3/pthread_attr_init.3:119
1250 "$B< ulimit -s> # No stack imit ==E<gt> default stack size is 2MB\n"
1253 "Thread attributes:\n"
1254 " Detach state = PTHREAD_CREATE_JOINABLE\n"
1255 " Scope = PTHREAD_SCOPE_SYSTEM\n"
1256 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
1257 " Scheduling policy = SCHED_OTHER\n"
1258 " Scheduling priority = 0\n"
1259 " Guard size = 4096 bytes\n"
1260 " Stack address = 0x40196000\n"
1261 " Stack size = 0x201000 bytes\n"
1263 "$B< ulimit -s> # No stack imit ==E<gt> default stack size is 2MB\n"
1266 "Thread attributes:\n"
1267 " Detach state = PTHREAD_CREATE_JOINABLE\n"
1268 " Scope = PTHREAD_SCOPE_SYSTEM\n"
1269 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
1270 " Scheduling policy = SCHED_OTHER\n"
1271 " Scheduling priority = 0\n"
1272 " Guard size = 4096 bytes\n"
1273 " Stack address = 0x40196000\n"
1274 " Stack size = 0x201000 bytes\n"
1277 #: build/C/man3/pthread_attr_init.3:129
1279 "When we supply a stack size as a command-line argument, the program "
1280 "initializes a thread attributes object, sets various attributes in that "
1281 "object, and passes a pointer to the object in the call to B<pthread_create>"
1282 "(3). Running the program on Linux/x86-32 with the NPTL threading "
1283 "implementation, we see the following:"
1286 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
1288 #: build/C/man3/pthread_attr_init.3:144
1291 "$B< ./a.out 0x3000000>\n"
1292 "posix_memalign() allocated at 0x40197000\n"
1293 "Thread attributes:\n"
1294 " Detach state = PTHREAD_CREATE_DETACHED\n"
1295 " Scope = PTHREAD_SCOPE_SYSTEM\n"
1296 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
1297 " Scheduling policy = SCHED_OTHER\n"
1298 " Scheduling priority = 0\n"
1299 " Guard size = 0 bytes\n"
1300 " Stack address = 0x40197000\n"
1301 " Stack size = 0x3000000 bytes\n"
1303 "$B< ./a.out 0x3000000>\n"
1304 "posix_memalign() allocated at 0x40197000\n"
1305 "Thread attributes:\n"
1306 " Detach state = PTHREAD_CREATE_DETACHED\n"
1307 " Scope = PTHREAD_SCOPE_SYSTEM\n"
1308 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
1309 " Scheduling policy = SCHED_OTHER\n"
1310 " Scheduling priority = 0\n"
1311 " Guard size = 0 bytes\n"
1312 " Stack address = 0x40197000\n"
1313 " Stack size = 0x3000000 bytes\n"
1316 #: build/C/man3/pthread_attr_init.3:155 build/C/man3/pthread_getattr_np.3:186
1319 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
1320 "#include E<lt>pthread.hE<gt>\n"
1321 "#include E<lt>stdio.hE<gt>\n"
1322 "#include E<lt>stdlib.hE<gt>\n"
1323 "#include E<lt>unistd.hE<gt>\n"
1324 "#include E<lt>errno.hE<gt>\n"
1326 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
1327 "#include E<lt>pthread.hE<gt>\n"
1328 "#include E<lt>stdio.hE<gt>\n"
1329 "#include E<lt>stdlib.hE<gt>\n"
1330 "#include E<lt>unistd.hE<gt>\n"
1331 "#include E<lt>errno.hE<gt>\n"
1334 #: build/C/man3/pthread_attr_init.3:158 build/C/man3/pthread_cancel.3:157
1335 #: build/C/man3/pthread_cleanup_push.3:237 build/C/man3/pthread_create.3:252
1336 #: build/C/man3/pthread_getattr_np.3:189
1337 #: build/C/man3/pthread_getcpuclockid.3:111
1338 #: build/C/man3/pthread_setaffinity_np.3:170
1339 #: build/C/man3/pthread_setschedparam.3:235 build/C/man3/pthread_sigmask.3:91
1342 "#define handle_error_en(en, msg) \\e\n"
1343 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1345 "#define handle_error_en(en, msg) \\e\n"
1346 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1349 #: build/C/man3/pthread_attr_init.3:166
1353 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
1358 " struct sched_param sp;\n"
1361 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
1366 " struct sched_param sp;\n"
1369 #: build/C/man3/pthread_attr_init.3:174
1372 " s = pthread_attr_getdetachstate(attr, &i);\n"
1374 " handle_error_en(s, \"pthread_attr_getdetachstate\");\n"
1375 " printf(\"%sDetach state = %s\\en\", prefix,\n"
1376 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
1377 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
1380 " s = pthread_attr_getdetachstate(attr, &i);\n"
1382 " handle_error_en(s, \"pthread_attr_getdetachstate\");\n"
1383 " printf(\"%sDetach state = %s\\en\", prefix,\n"
1384 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
1385 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
1389 #: build/C/man3/pthread_attr_init.3:182
1392 " s = pthread_attr_getscope(attr, &i);\n"
1394 " handle_error_en(s, \"pthread_attr_getscope\");\n"
1395 " printf(\"%sScope = %s\\en\", prefix,\n"
1396 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
1397 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
1400 " s = pthread_attr_getscope(attr, &i);\n"
1402 " handle_error_en(s, \"pthread_attr_getscope\");\n"
1403 " printf(\"%sScope = %s\\en\", prefix,\n"
1404 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
1405 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
1409 #: build/C/man3/pthread_attr_init.3:190
1412 " s = pthread_attr_getinheritsched(attr, &i);\n"
1414 " handle_error_en(s, \"pthread_attr_getinheritsched\");\n"
1415 " printf(\"%sInherit scheduler = %s\\en\", prefix,\n"
1416 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
1417 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
1420 " s = pthread_attr_getinheritsched(attr, &i);\n"
1422 " handle_error_en(s, \"pthread_attr_getinheritsched\");\n"
1423 " printf(\"%sInherit scheduler = %s\\en\", prefix,\n"
1424 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
1425 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
1429 #: build/C/man3/pthread_attr_init.3:199
1432 " s = pthread_attr_getschedpolicy(attr, &i);\n"
1434 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
1435 " printf(\"%sScheduling policy = %s\\en\", prefix,\n"
1436 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
1437 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
1438 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
1441 " s = pthread_attr_getschedpolicy(attr, &i);\n"
1443 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
1444 " printf(\"%sScheduling policy = %s\\en\", prefix,\n"
1445 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
1446 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
1447 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
1451 #: build/C/man3/pthread_attr_init.3:204
1454 " s = pthread_attr_getschedparam(attr, &sp);\n"
1456 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
1457 " printf(\"%sScheduling priority = %d\\en\", prefix, sp.sched_priority);\n"
1459 " s = pthread_attr_getschedparam(attr, &sp);\n"
1461 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
1462 " printf(\"%sScheduling priority = %d\\en\", prefix, sp.sched_priority);\n"
1465 #: build/C/man3/pthread_attr_init.3:209
1468 " s = pthread_attr_getguardsize(attr, &v);\n"
1470 " handle_error_en(s, \"pthread_attr_getguardsize\");\n"
1471 " printf(\"%sGuard size = %d bytes\\en\", prefix, v);\n"
1473 " s = pthread_attr_getguardsize(attr, &v);\n"
1475 " handle_error_en(s, \"pthread_attr_getguardsize\");\n"
1476 " printf(\"%sGuard size = %d bytes\\en\", prefix, v);\n"
1479 #: build/C/man3/pthread_attr_init.3:216
1482 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
1484 " handle_error_en(s, \"pthread_attr_getstack\");\n"
1485 " printf(\"%sStack address = %p\\en\", prefix, stkaddr);\n"
1486 " printf(\"%sStack size = 0x%x bytes\\en\", prefix, v);\n"
1489 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
1491 " handle_error_en(s, \"pthread_attr_getstack\");\n"
1492 " printf(\"%sStack address = %p\\en\", prefix, stkaddr);\n"
1493 " printf(\"%sStack size = 0x%x bytes\\en\", prefix, v);\n"
1497 #: build/C/man3/pthread_attr_init.3:222
1501 "thread_start(void *arg)\n"
1504 " pthread_attr_t gattr;\n"
1507 "thread_start(void *arg)\n"
1510 " pthread_attr_t gattr;\n"
1513 #: build/C/man3/pthread_attr_init.3:226
1516 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
1517 " retrieves the attributes of the thread specified in its\n"
1518 " first argument */\n"
1520 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
1521 " retrieves the attributes of the thread specified in its\n"
1522 " first argument */\n"
1525 #: build/C/man3/pthread_attr_init.3:230
1528 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
1530 " handle_error_en(s, \"pthread_getattr_np\");\n"
1532 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
1534 " handle_error_en(s, \"pthread_getattr_np\");\n"
1537 #: build/C/man3/pthread_attr_init.3:233
1540 " printf(\"Thread attributes:\\en\");\n"
1541 " display_pthread_attr(&gattr, \"\\et\");\n"
1543 " printf(\"Thread attributes:\\en\");\n"
1544 " display_pthread_attr(&gattr, \"\\et\");\n"
1547 #: build/C/man3/pthread_attr_init.3:236 build/C/man3/pthread_getattr_np.3:238
1550 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
1553 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
1557 #: build/C/man3/pthread_attr_init.3:244
1561 "main(int argc, char *argv[])\n"
1564 " pthread_attr_t attr;\n"
1565 " pthread_attr_t *attrp; /* NULL or &attr */\n"
1569 "main(int argc, char *argv[])\n"
1572 " pthread_attr_t attr;\n"
1573 " pthread_attr_t *attrp; /* NULL or &attr */\n"
1577 #: build/C/man3/pthread_attr_init.3:246
1578 #: build/C/man3/pthread_setschedparam.3:353
1580 msgid " attrp = NULL;\n"
1581 msgstr " attrp = NULL;\n"
1584 #: build/C/man3/pthread_attr_init.3:250
1587 " /* If a command-line argument was supplied, use it to set the\n"
1588 " stack-size attribute and set a few other thread attributes,\n"
1589 " and set attrp pointing to thread attributes object */\n"
1591 " /* If a command-line argument was supplied, use it to set the\n"
1592 " stack-size attribute and set a few other thread attributes,\n"
1593 " and set attrp pointing to thread attributes object */\n"
1596 #: build/C/man3/pthread_attr_init.3:254
1599 " if (argc E<gt> 1) {\n"
1600 " int stack_size;\n"
1603 " if (argc E<gt> 1) {\n"
1604 " int stack_size;\n"
1608 #: build/C/man3/pthread_attr_init.3:256
1610 msgid " attrp = &attr;\n"
1611 msgstr " attrp = &attr;\n"
1614 #: build/C/man3/pthread_attr_init.3:260
1617 " s = pthread_attr_init(&attr);\n"
1619 " handle_error_en(s, \"pthread_attr_init\");\n"
1621 " s = pthread_attr_init(&attr);\n"
1623 " handle_error_en(s, \"pthread_attr_init\");\n"
1626 #: build/C/man3/pthread_attr_init.3:264
1629 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
1631 " handle_error_en(s, \"pthread_attr_setdetachstate\");\n"
1633 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
1635 " handle_error_en(s, \"pthread_attr_setdetachstate\");\n"
1638 #: build/C/man3/pthread_attr_init.3:268
1641 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
1643 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
1645 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
1647 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
1650 #: build/C/man3/pthread_attr_init.3:270
1652 msgid " stack_size = strtoul(argv[1], NULL, 0);\n"
1653 msgstr " stack_size = strtoul(argv[1], NULL, 0);\n"
1656 #: build/C/man3/pthread_attr_init.3:274
1659 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
1661 " handle_error_en(s, \"posix_memalign\");\n"
1663 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
1665 " handle_error_en(s, \"posix_memalign\");\n"
1668 #: build/C/man3/pthread_attr_init.3:276
1670 msgid " printf(\"posix_memalign() allocated at %p\\en\", sp);\n"
1671 msgstr " printf(\"posix_memalign() allocated at %p\\en\", sp);\n"
1674 #: build/C/man3/pthread_attr_init.3:281
1677 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
1679 " handle_error_en(s, \"pthread_attr_setstack\");\n"
1682 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
1684 " handle_error_en(s, \"pthread_attr_setstack\");\n"
1688 #: build/C/man3/pthread_attr_init.3:285 build/C/man3/pthread_getattr_np.3:333
1691 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
1693 " handle_error_en(s, \"pthread_create\");\n"
1695 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
1697 " handle_error_en(s, \"pthread_create\");\n"
1700 #: build/C/man3/pthread_attr_init.3:291 build/C/man3/pthread_getattr_np.3:339
1703 " if (attrp != NULL) {\n"
1704 " s = pthread_attr_destroy(attrp);\n"
1706 " handle_error_en(s, \"pthread_attr_destroy\");\n"
1709 " if (attrp != NULL) {\n"
1710 " s = pthread_attr_destroy(attrp);\n"
1712 " handle_error_en(s, \"pthread_attr_destroy\");\n"
1716 #: build/C/man3/pthread_attr_init.3:294 build/C/man3/pthread_getattr_np.3:342
1719 " pause(); /* Terminates when other thread calls exit() */\n"
1722 " pause(); /* Terminates when other thread calls exit() */\n"
1726 #: build/C/man3/pthread_attr_init.3:309
1728 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
1729 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
1730 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
1731 "B<pthread_attr_setscope>(3), B<pthread_attr_setstack>(3), "
1732 "B<pthread_attr_setstackaddr>(3), B<pthread_attr_setstacksize>(3), "
1733 "B<pthread_create>(3), B<pthread_getattr_np>(3), B<pthreads>(7)"
1735 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
1736 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
1737 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
1738 "B<pthread_attr_setscope>(3), B<pthread_attr_setstack>(3), "
1739 "B<pthread_attr_setstackaddr>(3), B<pthread_attr_setstacksize>(3), "
1740 "B<pthread_create>(3), B<pthread_getattr_np>(3), B<pthreads>(7)"
1743 #: build/C/man3/pthread_attr_setaffinity_np.3:24
1745 msgid "PTHREAD_ATTR_SETAFFINITY_NP"
1746 msgstr "PTHREAD_ATTR_SETAFFINITY_NP"
1749 #: build/C/man3/pthread_attr_setaffinity_np.3:24
1750 #: build/C/man3/pthread_getattr_np.3:24
1751 #: build/C/man3/pthread_setaffinity_np.3:24
1752 #: build/C/man3/pthread_tryjoin_np.3:24
1758 #: build/C/man3/pthread_attr_setaffinity_np.3:28
1760 "pthread_attr_setaffinity_np, pthread_attr_getaffinity_np - set/get CPU "
1761 "affinity attribute in thread attributes object"
1765 #: build/C/man3/pthread_attr_setaffinity_np.3:32
1766 #: build/C/man3/pthread_getattr_np.3:31
1767 #: build/C/man3/pthread_setaffinity_np.3:32
1768 #: build/C/man3/pthread_tryjoin_np.3:32
1771 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
1772 "B<#include E<lt>pthread.hE<gt>>\n"
1774 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
1775 "B<#include E<lt>pthread.hE<gt>>\n"
1778 #: build/C/man3/pthread_attr_setaffinity_np.3:37
1781 "B<int pthread_attr_setaffinity_np(pthread_attr_t *>I<attr>B<,>\n"
1782 "B< size_t >I<cpusetsize>B<, const cpu_set_t *>I<cpuset>B<);>\n"
1783 "B<int pthread_attr_getaffinity_np(pthread_attr_t *>I<attr>B<,>\n"
1784 "B< size_t >I<cpusetsize>B<, cpu_set_t *>I<cpuset>B<);>\n"
1786 "B<int pthread_attr_setaffinity_np(pthread_attr_t *>I<attr>B<,>\n"
1787 "B< size_t >I<cpusetsize>B<, const cpu_set_t *>I<cpuset>B<);>\n"
1788 "B<int pthread_attr_getaffinity_np(pthread_attr_t *>I<attr>B<,>\n"
1789 "B< size_t >I<cpusetsize>B<, cpu_set_t *>I<cpuset>B<);>\n"
1792 #: build/C/man3/pthread_attr_setaffinity_np.3:52
1794 "The B<pthread_attr_setaffinity_np>() function sets the CPU affinity mask "
1795 "attribute of the thread attributes object referred to by I<attr> to the "
1796 "value specified in I<cpuset>. This attribute determines the CPU affinity "
1797 "mask of a thread created using the thread attributes object I<attr>."
1801 #: build/C/man3/pthread_attr_setaffinity_np.3:61
1803 "The B<pthread_attr_getaffinity_np>() function returns the CPU affinity mask "
1804 "attribute of the thread attributes object referred to by I<attr> in the "
1805 "buffer pointed to by I<cpuset>."
1809 #: build/C/man3/pthread_attr_setaffinity_np.3:68
1811 "The argument I<cpusetsize> is the length (in bytes) of the buffer pointed to "
1812 "by I<cpuset>. Typically, this argument would be specified as I<sizeof"
1817 #: build/C/man3/pthread_attr_setaffinity_np.3:74
1818 #: build/C/man3/pthread_setaffinity_np.3:65
1820 "For more details on CPU affinity masks, see B<sched_setaffinity>(2). For a "
1821 "description of a set of macros that can be used to manipulate and inspect "
1822 "CPU sets, see B<CPU_SET>(3)."
1826 #: build/C/man3/pthread_attr_setaffinity_np.3:78
1827 #: build/C/man3/pthread_attr_setaffinity_np.3:90
1828 #: build/C/man3/pthread_attr_setdetachstate.3:81
1829 #: build/C/man3/pthread_attr_setinheritsched.3:88
1830 #: build/C/man3/pthread_attr_setschedpolicy.3:76
1831 #: build/C/man3/pthread_attr_setscope.3:95
1832 #: build/C/man3/pthread_attr_setstack.3:89
1833 #: build/C/man3/pthread_attr_setstacksize.3:65
1834 #: build/C/man3/pthread_create.3:135 build/C/man3/pthread_detach.3:53
1835 #: build/C/man3/pthread_join.3:83 build/C/man3/pthread_join.3:87
1836 #: build/C/man3/pthread_kill.3:56 build/C/man3/pthread_setaffinity_np.3:82
1837 #: build/C/man3/pthread_setaffinity_np.3:91
1838 #: build/C/man3/pthread_setaffinity_np.3:107
1839 #: build/C/man3/pthread_setcancelstate.3:97
1840 #: build/C/man3/pthread_setcancelstate.3:105
1841 #: build/C/man3/pthread_setconcurrency.3:69
1842 #: build/C/man3/pthread_setschedparam.3:120
1843 #: build/C/man3/pthread_setschedprio.3:60 build/C/man3/pthread_sigqueue.3:75
1849 #. The raw sched_getaffinity() system call returns the size (in bytes)
1850 #. of the cpumask_t type.
1852 #: build/C/man3/pthread_attr_setaffinity_np.3:90
1854 "(B<pthread_attr_setaffinity_np>()) I<cpuset> specified a CPU that was "
1855 "outside the set supported by the kernel. (The kernel configuration option "
1856 "B<CONFIG_NR_CPUS> defines the range of the set supported by the kernel data "
1857 "type used to represent CPU sets.)"
1861 #: build/C/man3/pthread_attr_setaffinity_np.3:100
1863 "(B<pthread_attr_getaffinity_np>()) A CPU in the affinity mask of the thread "
1864 "attributes object referred to by I<attr> lies outside the range specified by "
1865 "I<cpusetsize> (i.e., I<cpuset>/I<cpusetsize> is too small)."
1869 #: build/C/man3/pthread_attr_setaffinity_np.3:104
1870 msgid "(B<pthread_attr_setaffinity_np>()) Could not allocate memory."
1874 #: build/C/man3/pthread_attr_setaffinity_np.3:106
1875 #: build/C/man3/pthread_setaffinity_np.3:119
1876 msgid "These functions are provided by glibc since version 2.3.4."
1880 #: build/C/man3/pthread_attr_setaffinity_np.3:109
1881 #: build/C/man3/pthread_cleanup_push_defer_np.3:102
1882 #: build/C/man3/pthread_setaffinity_np.3:122
1883 #: build/C/man3/pthread_tryjoin_np.3:113
1885 "These functions are nonstandard GNU extensions; hence the suffix \"_np"
1886 "\" (nonportable) in the names."
1890 #: build/C/man3/pthread_attr_setaffinity_np.3:116
1891 #: build/C/man3/pthread_setaffinity_np.3:148
1893 "In glibc 2.3.3 only, versions of these functions were provided that did not "
1894 "have a I<cpusetsize> argument. Instead the CPU set size given to the "
1895 "underlying system calls was always I<sizeof(cpu_set_t)>."
1899 #: build/C/man3/pthread_attr_setaffinity_np.3:122
1901 "B<sched_setaffinity>(2), B<pthread_attr_init>(3), B<pthread_setaffinity_np>"
1902 "(3), B<cpuset>(7), B<pthreads>(7)"
1904 "B<sched_setaffinity>(2), B<pthread_attr_init>(3), B<pthread_setaffinity_np>"
1905 "(3), B<cpuset>(7), B<pthreads>(7)"
1908 #: build/C/man3/pthread_attr_setdetachstate.3:24
1910 msgid "PTHREAD_ATTR_SETDETACHSTATE"
1911 msgstr "PTHREAD_ATTR_SETDETACHSTATE"
1914 #: build/C/man3/pthread_attr_setdetachstate.3:24
1915 #: build/C/man3/pthread_attr_setschedpolicy.3:24
1921 #: build/C/man3/pthread_attr_setdetachstate.3:28
1923 "pthread_attr_setdetachstate, pthread_attr_getdetachstate - set/get detach "
1924 "state attribute in thread attributes object"
1928 #: build/C/man3/pthread_attr_setdetachstate.3:36
1931 "B<int pthread_attr_setdetachstate(pthread_attr_t *>I<attr>B<, int >I<detachstate>B<);>\n"
1932 "B<int pthread_attr_getdetachstate(pthread_attr_t *>I<attr>B<, int *>I<detachstate>B<);>\n"
1934 "B<int pthread_attr_setdetachstate(pthread_attr_t *>I<attr>B<, int >I<detachstate>B<);>\n"
1935 "B<int pthread_attr_getdetachstate(pthread_attr_t *>I<attr>B<, int *>I<detachstate>B<);>\n"
1938 #: build/C/man3/pthread_attr_setdetachstate.3:51
1940 "The B<pthread_attr_setdetachstate>() function sets the detach state "
1941 "attribute of the thread attributes object referred to by I<attr> to the "
1942 "value specified in I<detachstate>. The detach state attribute determines "
1943 "whether a thread created using the thread attributes object I<attr> will be "
1944 "created in a joinable or a detached state."
1948 #: build/C/man3/pthread_attr_setdetachstate.3:54
1949 msgid "The following values may be specified in I<detachstate>:"
1953 #: build/C/man3/pthread_attr_setdetachstate.3:54
1955 msgid "B<PTHREAD_CREATE_DETACHED>"
1956 msgstr "B<PTHREAD_CREATE_DETACHED>"
1959 #: build/C/man3/pthread_attr_setdetachstate.3:59
1961 "Threads that are created using I<attr> will be created in a detached state."
1965 #: build/C/man3/pthread_attr_setdetachstate.3:59
1967 msgid "B<PTHREAD_CREATE_JOINABLE>"
1968 msgstr "B<PTHREAD_CREATE_JOINABLE>"
1971 #: build/C/man3/pthread_attr_setdetachstate.3:64
1973 "Threads that are created using I<attr> will be created in a joinable state."
1977 #: build/C/man3/pthread_attr_setdetachstate.3:68
1979 "The default setting of the detach state attribute in a newly initialized "
1980 "thread attributes object is B<PTHREAD_CREATE_JOINABLE>."
1984 #: build/C/man3/pthread_attr_setdetachstate.3:75
1986 "The B<pthread_attr_getdetachstate>() returns the detach state attribute of "
1987 "the thread attributes object I<attr> in the buffer pointed to by "
1992 #: build/C/man3/pthread_attr_setdetachstate.3:81
1993 msgid "B<pthread_attr_setdetachstate>() can fail with the following error:"
1997 #: build/C/man3/pthread_attr_setdetachstate.3:85
1998 msgid "An invalid value was specified in I<detachstate>."
2002 #: build/C/man3/pthread_attr_setdetachstate.3:91
2004 "See B<pthread_create>(3) for more details on detached and joinable threads."
2008 #: build/C/man3/pthread_attr_setdetachstate.3:99
2010 "A thread that is created in a joinable state should eventually either be "
2011 "joined using B<pthread_join>(3) or detached using B<pthread_detach>(3); see "
2012 "B<pthread_create>(3)."
2016 #: build/C/man3/pthread_attr_setdetachstate.3:106
2018 "It is an error to specify the thread ID of a thread that was created in a "
2019 "detached state in a later call to B<pthread_detach>(3) or B<pthread_join>"
2024 #: build/C/man3/pthread_attr_setdetachstate.3:109
2025 #: build/C/man3/pthread_attr_setstack.3:154
2026 msgid "See B<pthread_attr_init>(3)."
2030 #: build/C/man3/pthread_attr_setdetachstate.3:115
2032 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthread_detach>(3), "
2033 "B<pthread_join>(3), B<pthreads>(7)"
2035 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthread_detach>(3), "
2036 "B<pthread_join>(3), B<pthreads>(7)"
2039 #: build/C/man3/pthread_attr_setguardsize.3:24
2041 msgid "PTHREAD_ATTR_SETGUARDSIZE"
2042 msgstr "PTHREAD_ATTR_SETGUARDSIZE"
2045 #: build/C/man3/pthread_attr_setguardsize.3:24
2046 #: build/C/man3/pthread_attr_setscope.3:24
2047 #: build/C/man3/pthread_attr_setstack.3:24
2048 #: build/C/man3/pthread_attr_setstackaddr.3:24 build/C/man3/pthread_self.3:24
2054 #: build/C/man3/pthread_attr_setguardsize.3:28
2056 "pthread_attr_setguardsize, pthread_attr_getguardsize - set/get guard size "
2057 "attribute in thread attributes object"
2061 #: build/C/man3/pthread_attr_setguardsize.3:36
2064 "B<int pthread_attr_setguardsize(pthread_attr_t *>I<attr>B<, size_t >I<guardsize>B<);>\n"
2065 "B<int pthread_attr_getguardsize(pthread_attr_t *>I<attr>B<, size_t *>I<guardsize>B<);>\n"
2067 "B<int pthread_attr_setguardsize(pthread_attr_t *>I<attr>B<, size_t >I<guardsize>B<);>\n"
2068 "B<int pthread_attr_getguardsize(pthread_attr_t *>I<attr>B<, size_t *>I<guardsize>B<);>\n"
2071 #: build/C/man3/pthread_attr_setguardsize.3:47
2073 "The B<pthread_attr_setguardsize>() function sets the guard size attribute "
2074 "of the thread attributes object referred to by I<attr> to the value "
2075 "specified in I<guardsize>."
2079 #: build/C/man3/pthread_attr_setguardsize.3:57
2081 "If I<guardsize> is greater than 0, then for each new thread created using "
2082 "I<attr> the system allocates an additional region of at least I<guardsize> "
2083 "bytes at the end of the thread's stack to act as the guard area for the "
2084 "stack (but see BUGS)."
2088 #: build/C/man3/pthread_attr_setguardsize.3:63
2090 "If I<guardsize> is 0, then new threads created with I<attr> will not have a "
2095 #: build/C/man3/pthread_attr_setguardsize.3:65
2096 msgid "The default guard size is the same as the system page size."
2100 #: build/C/man3/pthread_attr_setguardsize.3:80
2102 "If the stack address attribute has been set in I<attr> (using "
2103 "B<pthread_attr_setstack>(3) or B<pthread_attr_setstackaddr>(3)), meaning "
2104 "that the caller is allocating the thread's stack, then the guard size "
2105 "attribute is ignored (i.e., no guard area is created by the system): it is "
2106 "the application's responsibility to handle stack overflow (perhaps by using "
2107 "B<mprotect>(2) to manually define a guard area at the end of the stack that "
2108 "it has allocated)."
2112 #: build/C/man3/pthread_attr_setguardsize.3:88
2114 "The B<pthread_attr_getguardsize>() function returns the guard size "
2115 "attribute of the thread attributes object referred to by I<attr> in the "
2116 "buffer pointed to by I<guardsize>."
2120 #: build/C/man3/pthread_attr_setguardsize.3:102
2122 "POSIX.1-2001 documents an B<EINVAL> error if I<attr> or I<guardsize> is "
2123 "invalid. On Linux these functions always succeed (but portable and future-"
2124 "proof applications should nevertheless handle a possible error return)."
2128 #: build/C/man3/pthread_attr_setguardsize.3:104
2129 #: build/C/man3/pthread_attr_setstackaddr.3:81
2130 #: build/C/man3/pthread_attr_setstacksize.3:81
2131 msgid "These functions are provided by glibc since version 2.1."
2135 #: build/C/man3/pthread_attr_setguardsize.3:120
2137 "A guard area consists of virtual memory pages that are protected to prevent "
2138 "read and write access. If a thread overflows its stack into the guard area, "
2139 "then, on most hard architectures, it receives a B<SIGSEGV> signal, thus "
2140 "notifying it of the overflow. Guard areas start on page boundaries, and the "
2141 "guard size is internally rounded up to the system page size when creating a "
2142 "thread. (Nevertheless, B<pthread_attr_getguardsize>() returns the guard "
2143 "size that was set by B<pthread_attr_setguardsize>().)"
2147 #: build/C/man3/pthread_attr_setguardsize.3:124
2149 "Setting a guard size of 0 may be useful to save memory in an application "
2150 "that creates many threads and knows that stack overflow can never occur."
2154 #: build/C/man3/pthread_attr_setguardsize.3:128
2156 "Choosing a guard size larger than the default size may be necessary for "
2157 "detecting stack overflows if a thread allocates large data structures on the "
2162 #: build/C/man3/pthread_attr_setguardsize.3:128
2163 #: build/C/man3/pthread_attr_setinheritsched.3:101
2164 #: build/C/man3/pthread_attr_setstacksize.3:94
2165 #: build/C/man3/pthread_create.3:194 build/C/man3/pthread_exit.3:91
2171 #: build/C/man3/pthread_attr_setguardsize.3:139
2173 "As at glibc 2.8, the NPTL threading implementation includes the guard area "
2174 "within the stack size allocation, rather than allocating extra space at the "
2175 "end of the stack, as POSIX.1 requires. (This can result in an B<EINVAL> "
2176 "error from B<pthread_create>(3) if the guard size value is too large, "
2177 "leaving no space for the actual stack.)"
2180 #. glibc includes the guardsize within the allocated stack size,
2181 #. which looks pretty clearly to be in violation of POSIX.
2182 #. Filed bug, 22 Oct 2008:
2183 #. http://sources.redhat.com/bugzilla/show_bug.cgi?id=6973
2185 #. https//bugzilla.redhat.com/show_bug.cgi?id=435337
2186 #. Reportedly, LinuxThreads did the right thing, allocating
2187 #. extra space at the end of the stack:
2188 #. http://sourceware.org/ml/libc-alpha/2008-05/msg00086.html
2190 #: build/C/man3/pthread_attr_setguardsize.3:153
2192 "The obsolete LinuxThreads implementation did the right thing, allocating "
2193 "extra space at the end of the stack for the guard area."
2197 #: build/C/man3/pthread_attr_setguardsize.3:156
2198 msgid "See B<pthread_getattr_np>(3)."
2202 #: build/C/man3/pthread_attr_setguardsize.3:164
2204 "B<mmap>(2), B<mprotect>(2), B<pthread_attr_init>(3), B<pthread_attr_setstack>"
2205 "(3), B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2207 "B<mmap>(2), B<mprotect>(2), B<pthread_attr_init>(3), B<pthread_attr_setstack>"
2208 "(3), B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2211 #: build/C/man3/pthread_attr_setinheritsched.3:24
2213 msgid "PTHREAD_ATTR_SETINHERITSCHED"
2214 msgstr "PTHREAD_ATTR_SETINHERITSCHED"
2217 #: build/C/man3/pthread_attr_setinheritsched.3:24
2218 #: build/C/man3/pthread_attr_setschedparam.3:24
2219 #: build/C/man3/pthread_attr_setstacksize.3:24
2220 #: build/C/man3/pthread_create.3:24
2226 #: build/C/man3/pthread_attr_setinheritsched.3:28
2228 "pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get inherit "
2229 "scheduler attribute in thread attributes object"
2233 #: build/C/man3/pthread_attr_setinheritsched.3:36
2236 "B<int pthread_attr_setinheritsched(pthread_attr_t *>I<attr>B<,>\n"
2237 "B< int >I<inheritsched>B<);>\n"
2238 "B<int pthread_attr_getinheritsched(pthread_attr_t *>I<attr>B<,>\n"
2239 "B< int *>I<inheritsched>B<);>\n"
2241 "B<int pthread_attr_setinheritsched(pthread_attr_t *>I<attr>B<,>\n"
2242 "B< int >I<inheritsched>B<);>\n"
2243 "B<int pthread_attr_getinheritsched(pthread_attr_t *>I<attr>B<,>\n"
2244 "B< int *>I<inheritsched>B<);>\n"
2247 #: build/C/man3/pthread_attr_setinheritsched.3:53
2249 "The B<pthread_attr_setinheritsched>() function sets the inherit scheduler "
2250 "attribute of the thread attributes object referred to by I<attr> to the "
2251 "value specified in I<inheritsched>. The inherit scheduler attribute "
2252 "determines whether a thread created using the thread attributes object "
2253 "I<attr> will inherit its scheduling attributes from the calling thread or "
2254 "whether it will take them from I<attr>."
2258 #: build/C/man3/pthread_attr_setinheritsched.3:56
2259 msgid "The following values may be specified in I<inheritsched>:"
2263 #: build/C/man3/pthread_attr_setinheritsched.3:56
2265 msgid "B<PTHREAD_INHERIT_SCHED>"
2266 msgstr "B<PTHREAD_INHERIT_SCHED>"
2269 #: build/C/man3/pthread_attr_setinheritsched.3:64
2271 "Threads that are created using I<attr> inherit scheduling attributes from "
2272 "the creating thread; the scheduling attributes in I<attr> are ignored."
2276 #: build/C/man3/pthread_attr_setinheritsched.3:64
2278 msgid "B<PTHREAD_EXPLICIT_SCHED>"
2279 msgstr "B<PTHREAD_EXPLICIT_SCHED>"
2281 #. FIXME what are the defaults for scheduler settings?
2283 #: build/C/man3/pthread_attr_setinheritsched.3:71
2285 "Threads that are created using I<attr> take their scheduling attributes from "
2286 "the values specified by the attributes object."
2290 #: build/C/man3/pthread_attr_setinheritsched.3:75
2292 "The default setting of the inherit scheduler attribute in a newly "
2293 "initialized thread attributes object is B<PTHREAD_INHERIT_SCHED>."
2297 #: build/C/man3/pthread_attr_setinheritsched.3:82
2299 "The B<pthread_attr_getinheritsched>() returns the inherit scheduler "
2300 "attribute of the thread attributes object I<attr> in the buffer pointed to "
2301 "by I<inheritsched>."
2305 #: build/C/man3/pthread_attr_setinheritsched.3:88
2306 msgid "B<pthread_attr_setinheritsched>() can fail with the following error:"
2310 #: build/C/man3/pthread_attr_setinheritsched.3:92
2311 msgid "Invalid value in I<inheritsched>."
2315 #. Available since glibc 2.0.
2317 #: build/C/man3/pthread_attr_setinheritsched.3:99
2319 "POSIX.1-2001 also documents an optional B<ENOTSUP> error (\"attempt was made "
2320 "to set the attribute to an unsupported value\") for "
2321 "B<pthread_attr_setinheritsched>()."
2324 #. FIXME . Track status of the following bug:
2325 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7007
2327 #: build/C/man3/pthread_attr_setinheritsched.3:117
2329 "As at glibc 2.8, if a thread attributes object is initialized using "
2330 "B<pthread_attr_init>(3), then the scheduling policy of the attributes object "
2331 "is set to B<SCHED_OTHER> and the scheduling priority is set to 0. However, "
2332 "if the inherit scheduler attribute is then set to B<PTHREAD_EXPLICIT_SCHED>, "
2333 "then a thread created using the attribute object wrongly inherits its "
2334 "scheduling attributes from the creating thread. This bug does not occur if "
2335 "either the scheduling policy or scheduling priority attribute is explicitly "
2336 "set in the thread attributes object before calling B<pthread_create>(3)."
2340 #: build/C/man3/pthread_attr_setinheritsched.3:120
2341 #: build/C/man3/pthread_attr_setschedparam.3:96
2342 #: build/C/man3/pthread_attr_setschedpolicy.3:92
2343 msgid "See B<pthread_setschedparam>(3)."
2347 #: build/C/man3/pthread_attr_setinheritsched.3:129
2349 "B<sched_setscheduler>(2), B<pthread_attr_init>(3), "
2350 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
2351 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2352 "(3), B<pthreads>(7)"
2354 "B<sched_setscheduler>(2), B<pthread_attr_init>(3), "
2355 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
2356 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2357 "(3), B<pthreads>(7)"
2360 #: build/C/man3/pthread_attr_setschedparam.3:24
2362 msgid "PTHREAD_ATTR_SETSCHEDPARAM"
2363 msgstr "PTHREAD_ATTR_SETSCHEDPARAM"
2366 #: build/C/man3/pthread_attr_setschedparam.3:28
2368 "pthread_attr_setschedparam, pthread_attr_getschedparam - set/get scheduling "
2369 "parameter attributes in thread attributes object"
2373 #: build/C/man3/pthread_attr_setschedparam.3:36
2376 "B<int pthread_attr_setschedparam(pthread_attr_t *>I<attr>B<,>\n"
2377 "B< const struct sched_param *>I<param>B<);>\n"
2378 "B<int pthread_attr_getschedparam(pthread_attr_t *>I<attr>B<,>\n"
2379 "B< struct sched_param *>I<param>B<);>\n"
2381 "B<int pthread_attr_setschedparam(pthread_attr_t *>I<attr>B<,>\n"
2382 "B< const struct sched_param *>I<param>B<);>\n"
2383 "B<int pthread_attr_getschedparam(pthread_attr_t *>I<attr>B<,>\n"
2384 "B< struct sched_param *>I<param>B<);>\n"
2387 #: build/C/man3/pthread_attr_setschedparam.3:50
2389 "The B<pthread_attr_setschedparam>() function sets the scheduling parameter "
2390 "attributes of the thread attributes object referred to by I<attr> to the "
2391 "values specified in the buffer pointed to by I<param>. These attributes "
2392 "determine the scheduling parameters of a thread created using the thread "
2393 "attributes object I<attr>."
2397 #: build/C/man3/pthread_attr_setschedparam.3:57
2399 "The B<pthread_attr_getschedparam>() returns the scheduling parameter "
2400 "attributes of the thread attributes object I<attr> in the buffer pointed to "
2405 #: build/C/man3/pthread_attr_setschedparam.3:59
2406 msgid "Scheduling parameters are maintained in the following structure:"
2410 #: build/C/man3/pthread_attr_setschedparam.3:65
2411 #: build/C/man3/pthread_setschedparam.3:67
2414 "struct sched_param {\n"
2415 " int sched_priority; /* Scheduling priority */\n"
2418 "struct sched_param {\n"
2419 " int sched_priority; /* Scheduling priority */\n"
2423 #: build/C/man3/pthread_attr_setschedparam.3:72
2424 #: build/C/man3/pthread_setschedparam.3:74
2426 "As can be seen, only one scheduling parameter is supported. For details of "
2427 "the permitted ranges for scheduling priorities in each scheduling policy, "
2428 "see B<sched_setscheduler>(2)."
2432 #. Available since glibc 2.0.
2434 #: build/C/man3/pthread_attr_setschedparam.3:87
2436 "POSIX.1 documents B<EINVAL> and B<ENOTSUP> errors for "
2437 "B<pthread_attr_setschedparam>(). On Linux these functions always succeed "
2438 "(but portable and future-proof applications should nevertheless handle a "
2439 "possible error return)."
2443 #: build/C/man3/pthread_attr_setschedparam.3:93
2445 "See B<pthread_attr_setschedpolicy>(3) for a list of the thread scheduling "
2446 "policies supported on Linux."
2450 #: build/C/man3/pthread_attr_setschedparam.3:106
2452 "B<sched_get_priority_min>(2), B<sched_setscheduler>(2), B<pthread_attr_init>"
2453 "(3), B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedpolicy>(3), "
2454 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2455 "(3), B<pthreads>(7)"
2457 "B<sched_get_priority_min>(2), B<sched_setscheduler>(2), B<pthread_attr_init>"
2458 "(3), B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedpolicy>(3), "
2459 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2460 "(3), B<pthreads>(7)"
2463 #: build/C/man3/pthread_attr_setschedpolicy.3:24
2465 msgid "PTHREAD_ATTR_SETSCHEDPOLICY"
2466 msgstr "PTHREAD_ATTR_SETSCHEDPOLICY"
2469 #: build/C/man3/pthread_attr_setschedpolicy.3:28
2471 "pthread_attr_setschedpolicy, pthread_attr_getschedpolicy - set/get "
2472 "scheduling policy attribute in thread attributes object"
2476 #: build/C/man3/pthread_attr_setschedpolicy.3:36
2479 "B<int pthread_attr_setschedpolicy(pthread_attr_t *>I<attr>B<, int >I<policy>B<);>\n"
2480 "B<int pthread_attr_getschedpolicy(pthread_attr_t *>I<attr>B<, int >I<*policy>B<);>\n"
2482 "B<int pthread_attr_setschedpolicy(pthread_attr_t *>I<attr>B<, int >I<policy>B<);>\n"
2483 "B<int pthread_attr_getschedpolicy(pthread_attr_t *>I<attr>B<, int >I<*policy>B<);>\n"
2486 #: build/C/man3/pthread_attr_setschedpolicy.3:50
2488 "The B<pthread_attr_setschedpolicy>() function sets the scheduling policy "
2489 "attribute of the thread attributes object referred to by I<attr> to the "
2490 "value specified in I<policy>. This attribute determines the scheduling "
2491 "policy of a thread created using the thread attributes object I<attr>."
2494 #. FIXME . pthread_setschedparam() places no restriction on the policy,
2495 #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
2496 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013
2498 #: build/C/man3/pthread_attr_setschedpolicy.3:63
2500 "The supported values for I<policy> are B<SCHED_FIFO>, B<SCHED_RR>, and "
2501 "B<SCHED_OTHER>, with the semantics described in B<sched_setscheduler>(2)."
2505 #: build/C/man3/pthread_attr_setschedpolicy.3:70
2507 "The B<pthread_attr_getschedpolicy>() returns the scheduling policy "
2508 "attribute of the thread attributes object I<attr> in the buffer pointed to "
2513 #: build/C/man3/pthread_attr_setschedpolicy.3:76
2514 msgid "B<pthread_attr_setschedpolicy>() can fail with the following error:"
2518 #: build/C/man3/pthread_attr_setschedpolicy.3:80
2519 msgid "Invalid value in I<policy>."
2523 #. Available since glibc 2.0.
2525 #: build/C/man3/pthread_attr_setschedpolicy.3:87
2527 "POSIX.1-2001 also documents an optional B<ENOTSUP> error (\"attempt was made "
2528 "to set the attribute to an unsupported value\") for "
2529 "B<pthread_attr_setschedpolicy>()."
2533 #: build/C/man3/pthread_attr_setschedpolicy.3:101
2535 "B<sched_setscheduler>(2), B<pthread_attr_init>(3), "
2536 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
2537 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2538 "(3), B<pthreads>(7)"
2540 "B<sched_setscheduler>(2), B<pthread_attr_init>(3), "
2541 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
2542 "B<pthread_create>(3), B<pthread_setschedparam>(3), B<pthread_setschedprio>"
2543 "(3), B<pthreads>(7)"
2546 #: build/C/man3/pthread_attr_setscope.3:24
2548 msgid "PTHREAD_ATTR_SETSCOPE"
2549 msgstr "PTHREAD_ATTR_SETSCOPE"
2552 #: build/C/man3/pthread_attr_setscope.3:28
2554 "pthread_attr_setscope, pthread_attr_getscope - set/get contention scope "
2555 "attribute in thread attributes object"
2559 #: build/C/man3/pthread_attr_setscope.3:36
2562 "B<int pthread_attr_setscope(pthread_attr_t *>I<attr>B<, int >I<scope>B<);>\n"
2563 "B<int pthread_attr_getscope(pthread_attr_t *>I<attr>B<, int *>I<scope>B<);>\n"
2565 "B<int pthread_attr_setscope(pthread_attr_t *>I<attr>B<, int >I<scope>B<);>\n"
2566 "B<int pthread_attr_getscope(pthread_attr_t *>I<attr>B<, int *>I<scope>B<);>\n"
2569 #: build/C/man3/pthread_attr_setscope.3:51
2571 "The B<pthread_attr_setscope>() function sets the contention scope attribute "
2572 "of the thread attributes object referred to by I<attr> to the value "
2573 "specified in I<scope>. The contention scope attribute defines the set of "
2574 "threads against which a thread competes for resources such as the CPU. "
2575 "POSIX.1-2001 specifies two possible values for I<scope>:"
2579 #: build/C/man3/pthread_attr_setscope.3:51
2581 msgid "B<PTHREAD_SCOPE_SYSTEM>"
2582 msgstr "B<PTHREAD_SCOPE_SYSTEM>"
2585 #: build/C/man3/pthread_attr_setscope.3:59
2587 "The thread competes for resources with all other threads in all processes on "
2588 "the system that are in the same scheduling allocation domain (a group of one "
2589 "or more processors). B<PTHREAD_SCOPE_SYSTEM> threads are scheduled relative "
2590 "to one another according to their scheduling policy and priority."
2594 #: build/C/man3/pthread_attr_setscope.3:59
2596 msgid "B<PTHREAD_SCOPE_PROCESS>"
2597 msgstr "B<PTHREAD_SCOPE_PROCESS>"
2600 #: build/C/man3/pthread_attr_setscope.3:74
2602 "The thread competes for resources with all other threads in the same process "
2603 "that were also created with the B<PTHREAD_SCOPE_PROCESS> contention scope. "
2604 "B<PTHREAD_SCOPE_PROCESS> threads are scheduled relative to other threads in "
2605 "the process according to their scheduling policy and priority. POSIX.1-2001 "
2606 "leaves it unspecified how these threads contend with other threads in other "
2607 "process on the system or with other threads in the same process that were "
2608 "created with the B<PTHREAD_SCOPE_SYSTEM> contention scope."
2612 #: build/C/man3/pthread_attr_setscope.3:81
2614 "POSIX.1-2001 only requires that an implementation support one of these "
2615 "contention scopes, but permits both to be supported. Linux supports "
2616 "B<PTHREAD_SCOPE_SYSTEM>, but not B<PTHREAD_SCOPE_PROCESS>."
2620 #: build/C/man3/pthread_attr_setscope.3:89
2622 "The B<pthread_attr_getscope>() function returns the contention scope "
2623 "attribute of the thread attributes object referred to by I<attr> in the "
2624 "buffer pointed to by I<scope>."
2628 #: build/C/man3/pthread_attr_setscope.3:95
2629 msgid "B<pthread_attr_setscope>() can fail with the following errors:"
2633 #: build/C/man3/pthread_attr_setscope.3:99
2634 msgid "An invalid value was specified in I<scope>."
2638 #: build/C/man3/pthread_attr_setscope.3:99
2644 #: build/C/man3/pthread_attr_setscope.3:105
2646 "I<scope> specified the value B<PTHREAD_SCOPE_PROCESS>, which is not "
2647 "supported on Linux."
2651 #: build/C/man3/pthread_attr_setscope.3:115
2653 "The B<PTHREAD_SCOPE_SYSTEM> contention scope typically indicates that a "
2654 "userspace thread is bound directly to a single kernel-scheduling entity. "
2655 "This is the case on Linux for the obsolete LinuxThreads implementation and "
2656 "the modern NPTL implementation, which are both 1:1 threading implementations."
2660 #: build/C/man3/pthread_attr_setscope.3:118
2662 "POSIX.1-2001 specifies that the default contention scope is implementation-"
2667 #: build/C/man3/pthread_attr_setscope.3:126
2669 "B<pthread_attr_init>(3), B<pthread_attr_setaffinity_np>(3), "
2670 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
2671 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthreads>(7)"
2673 "B<pthread_attr_init>(3), B<pthread_attr_setaffinity_np>(3), "
2674 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
2675 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthreads>(7)"
2678 #: build/C/man3/pthread_attr_setstack.3:24
2680 msgid "PTHREAD_ATTR_SETSTACK"
2681 msgstr "PTHREAD_ATTR_SETSTACK"
2684 #: build/C/man3/pthread_attr_setstack.3:28
2686 "pthread_attr_setstack, pthread_attr_getstack - set/get stack attributes in "
2687 "thread attributes object"
2691 #: build/C/man3/pthread_attr_setstack.3:36
2694 "B<int pthread_attr_setstack(pthread_attr_t *>I<attr>B<,>\n"
2695 "B< void *>I<stackaddr>B<, size_t >I<stacksize>B<);>\n"
2696 "B<int pthread_attr_getstack(pthread_attr_t *>I<attr>B<,>\n"
2697 "B< void **>I<stackaddr>B<, size_t *>I<stacksize>B<);>\n"
2699 "B<int pthread_attr_setstack(pthread_attr_t *>I<attr>B<,>\n"
2700 "B< void *>I<stackaddr>B<, size_t >I<stacksize>B<);>\n"
2701 "B<int pthread_attr_getstack(pthread_attr_t *>I<attr>B<,>\n"
2702 "B< void **>I<stackaddr>B<, size_t *>I<stacksize>B<);>\n"
2705 #: build/C/man3/pthread_attr_setstack.3:43 build/C/man3/pthread_sigqueue.3:39
2707 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
2711 #: build/C/man3/pthread_attr_setstack.3:48
2712 msgid "B<pthread_attr_getstack>(), B<pthread_attr_setstack>():"
2713 msgstr "B<pthread_attr_getstack>(), B<pthread_attr_setstack>():"
2716 #: build/C/man3/pthread_attr_setstack.3:50
2717 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
2718 msgstr "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
2721 #: build/C/man3/pthread_attr_setstack.3:66
2723 "The B<pthread_attr_setstack>() function sets the stack address and stack "
2724 "size attributes of the thread attributes object referred to by I<attr> to "
2725 "the values specified in I<stackaddr> and I<stacksize>, respectively. These "
2726 "attributes specify the location and size of the stack that should be used by "
2727 "a thread that is created using the thread attributes object I<attr>."
2731 #: build/C/man3/pthread_attr_setstack.3:72
2733 "I<stackaddr> should point to the lowest addressable byte of a buffer of "
2734 "I<stacksize> bytes that was allocated by the caller. The pages of the "
2735 "allocated buffer should be both readable and writable."
2739 #: build/C/man3/pthread_attr_setstack.3:83
2741 "The B<pthread_attr_getstack>() function returns the stack address and stack "
2742 "size attributes of the thread attributes object referred to by I<attr> in "
2743 "the buffers pointed to by I<stackaddr> and I<stacksize>, respectively."
2747 #: build/C/man3/pthread_attr_setstack.3:89
2748 msgid "B<pthread_attr_setstack>() can fail with the following error:"
2752 #: build/C/man3/pthread_attr_setstack.3:100
2754 "I<stacksize> is less than B<PTHREAD_STACK_MIN> (16384) bytes. On some "
2755 "systems, this error may also occur if I<stackaddr> or I<stackaddr\\ +\\ "
2756 "stacksize> is not suitably aligned."
2760 #: build/C/man3/pthread_attr_setstack.3:108
2762 "POSIX.1-2001 also documents an B<EACCES> error if the stack area described "
2763 "by I<stackaddr> and I<stacksize> is not both readable and writable by the "
2768 #: build/C/man3/pthread_attr_setstack.3:110
2769 msgid "These functions are provided by glibc since version 2.2."
2773 #: build/C/man3/pthread_attr_setstack.3:120
2775 "These functions are provided for applications that must ensure that a "
2776 "thread's stack is placed in a particular location. For most applications, "
2777 "this is not necessary, and the use of these functions should be avoided. "
2778 "(Use B<pthread_attr_setstacksize>(3) if an application simply requires a "
2779 "stack size other than the default.)"
2783 #: build/C/man3/pthread_attr_setstack.3:131
2785 "When an application employs B<pthread_attr_setstack>(), it takes over the "
2786 "responsibility of allocating the stack. Any guard size value that was set "
2787 "using B<pthread_attr_setguardsize>(3) is ignored. If deemed necessary, it "
2788 "is the application's responsibility to allocate a guard area (one or more "
2789 "pages protected against reading and writing) to handle the possibility of "
2794 #: build/C/man3/pthread_attr_setstack.3:142
2796 "The address specified in I<stackaddr> should be suitably aligned: for full "
2797 "portability, align it on a page boundary (I<sysconf(_SC_PAGESIZE)>). "
2798 "B<posix_memalign>(3) may be useful for allocation. Probably, I<stacksize> "
2799 "should also be a multiple of the system page size."
2803 #: build/C/man3/pthread_attr_setstack.3:151
2805 "If I<attr> is used to create multiple threads, then the caller must change "
2806 "the stack address attribute between calls to B<pthread_create>(3); "
2807 "otherwise, the threads will attempt to use the same memory area for their "
2808 "stacks, and chaos will ensue."
2812 #: build/C/man3/pthread_attr_setstack.3:164
2814 "B<mmap>(2), B<mprotect>(2), B<posix_memalign>(3), B<pthread_attr_init>(3), "
2815 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setstackaddr>(3), "
2816 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2818 "B<mmap>(2), B<mprotect>(2), B<posix_memalign>(3), B<pthread_attr_init>(3), "
2819 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setstackaddr>(3), "
2820 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2823 #: build/C/man3/pthread_attr_setstackaddr.3:24
2825 msgid "PTHREAD_ATTR_SETSTACKADDR"
2826 msgstr "PTHREAD_ATTR_SETSTACKADDR"
2829 #: build/C/man3/pthread_attr_setstackaddr.3:28
2831 "pthread_attr_setstackaddr, pthread_attr_getstackaddr - set/get stack address "
2832 "attribute in thread attributes object"
2836 #: build/C/man3/pthread_attr_setstackaddr.3:36
2839 "B<int pthread_attr_setstackaddr(pthread_attr_t *>I<attr>B<, void *>I<stackaddr>B<);>\n"
2840 "B<int pthread_attr_getstackaddr(pthread_attr_t *>I<attr>B<, void **>I<stackaddr>B<);>\n"
2842 "B<int pthread_attr_setstackaddr(pthread_attr_t *>I<attr>B<, void *>I<stackaddr>B<);>\n"
2843 "B<int pthread_attr_getstackaddr(pthread_attr_t *>I<attr>B<, void **>I<stackaddr>B<);>\n"
2846 #: build/C/man3/pthread_attr_setstackaddr.3:47
2848 "These functions are obsolete: B<do not use them.> Use "
2849 "B<pthread_attr_setstack>(3) and B<pthread_attr_getstack>(3) instead."
2853 #: build/C/man3/pthread_attr_setstackaddr.3:58
2855 "The B<pthread_attr_setstackaddr>() function sets the stack address "
2856 "attribute of the thread attributes object referred to by I<attr> to the "
2857 "value specified in I<stackaddr>. This attribute specifies the location of "
2858 "the stack that should be used by a thread that is created using the thread "
2859 "attributes object I<attr>."
2863 #: build/C/man3/pthread_attr_setstackaddr.3:64
2865 "I<stackaddr> should point to a buffer of at least B<PTHREAD_STACK_MIN> bytes "
2866 "that was allocated by the caller. The pages of the allocated buffer should "
2867 "be both readable and writable."
2871 #: build/C/man3/pthread_attr_setstackaddr.3:72
2873 "The B<pthread_attr_getstackaddr>() function returns the stack address "
2874 "attribute of the thread attributes object referred to by I<attr> in the "
2875 "buffer pointed to by I<stackaddr>."
2879 #: build/C/man3/pthread_attr_setstackaddr.3:79
2881 "No errors are defined (but applications should nevertheless handle a "
2882 "possible error return)."
2886 #: build/C/man3/pthread_attr_setstackaddr.3:84
2888 "POSIX.1-2001 specifies these functions but marks them as obsolete. "
2889 "POSIX.1-2008 removes the specification of these functions."
2893 #: build/C/man3/pthread_attr_setstackaddr.3:108
2895 "I<Do not use these functions!> They cannot be portably used, since they "
2896 "provide no way of specifying the direction of growth or the range of the "
2897 "stack. For example, on architectures with a stack that grows downward, "
2898 "I<stackaddr> specifies the next address past the I<highest> address of the "
2899 "allocated stack area. However, on architectures with a stack that grows "
2900 "upward, I<stackaddr> specifies the I<lowest> address in the allocated stack "
2901 "area. By contrast, the I<stackaddr> used by B<pthread_attr_setstack>(3) "
2902 "and B<pthread_attr_getstack>(3), is always a pointer to the lowest address "
2903 "in the allocated stack area (and the I<stacksize> argument specifies the "
2904 "range of the stack)."
2908 #: build/C/man3/pthread_attr_setstackaddr.3:114
2910 "B<pthread_attr_init>(3), B<pthread_attr_setstack>(3), "
2911 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2913 "B<pthread_attr_init>(3), B<pthread_attr_setstack>(3), "
2914 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2917 #: build/C/man3/pthread_attr_setstacksize.3:24
2919 msgid "PTHREAD_ATTR_SETSTACKSIZE"
2920 msgstr "PTHREAD_ATTR_SETSTACKSIZE"
2923 #: build/C/man3/pthread_attr_setstacksize.3:28
2925 "pthread_attr_setstacksize, pthread_attr_getstacksize - set/get stack size "
2926 "attribute in thread attributes object"
2930 #: build/C/man3/pthread_attr_setstacksize.3:36
2933 "B<int pthread_attr_setstacksize(pthread_attr_t *>I<attr>B<, size_t >I<stacksize>B<);>\n"
2934 "B<int pthread_attr_getstacksize(pthread_attr_t *>I<attr>B<, size_t *>I<stacksize>B<);>\n"
2936 "B<int pthread_attr_setstacksize(pthread_attr_t *>I<attr>B<, size_t >I<stacksize>B<);>\n"
2937 "B<int pthread_attr_getstacksize(pthread_attr_t *>I<attr>B<, size_t *>I<stacksize>B<);>\n"
2940 #: build/C/man3/pthread_attr_setstacksize.3:47
2942 "The B<pthread_attr_setstacksize>() function sets the stack size attribute "
2943 "of the thread attributes object referred to by I<attr> to the value "
2944 "specified in I<stacksize>."
2948 #: build/C/man3/pthread_attr_setstacksize.3:51
2950 "The stack size attribute determines the minimum size (in bytes) that will be "
2951 "allocated for threads created using the thread attributes object I<attr>."
2955 #: build/C/man3/pthread_attr_setstacksize.3:59
2957 "The B<pthread_attr_getstacksize>() function returns the stack size "
2958 "attribute of the thread attributes object referred to by I<attr> in the "
2959 "buffer pointed to by I<stacksize>."
2963 #: build/C/man3/pthread_attr_setstacksize.3:65
2964 msgid "B<pthread_attr_setstacksize>() can fail with the following error:"
2968 #: build/C/man3/pthread_attr_setstacksize.3:70
2969 msgid "The stack size is less than B<PTHREAD_STACK_MIN> (16384) bytes."
2974 #: build/C/man3/pthread_attr_setstacksize.3:79
2976 "On some systems, B<pthread_attr_setstacksize>() can fail with the error "
2977 "B<EINVAL> if I<stacksize> is not a multiple of the system page size."
2981 #: build/C/man3/pthread_attr_setstacksize.3:86
2983 "For details on the default stack size of new threads, see B<pthread_create>"
2988 #: build/C/man3/pthread_attr_setstacksize.3:89
2990 "A thread's stack size is fixed at the time of thread creation. Only the "
2991 "main thread can dynamically grow its stack."
2995 #: build/C/man3/pthread_attr_setstacksize.3:94
2997 "The B<pthread_attr_setstack>(3) function allows an application to set both "
2998 "the size and location of a caller-allocated stack that is to be used by a "
3003 #: build/C/man3/pthread_attr_setstacksize.3:106
3005 "As at glibc 2.8, if the specified I<stacksize> is not a multiple of "
3006 "B<STACK_ALIGN> (16 bytes on most architectures), it may be rounded "
3007 "I<downward>, in violation of POSIX.1-2001, which says that the allocated "
3008 "stack will be at least I<stacksize> bytes."
3012 #: build/C/man3/pthread_attr_setstacksize.3:109
3013 #: build/C/man3/pthread_join.3:125
3014 msgid "See B<pthread_create>(3)."
3018 #: build/C/man3/pthread_attr_setstacksize.3:116
3020 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_attr_setguardsize>(3), "
3021 "B<pthread_attr_setstack>(3), B<pthread_create>(3), B<pthreads>(7)"
3023 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_attr_setguardsize>(3), "
3024 "B<pthread_attr_setstack>(3), B<pthread_create>(3), B<pthreads>(7)"
3027 #: build/C/man3/pthread_cancel.3:24
3029 msgid "PTHREAD_CANCEL"
3030 msgstr "PTHREAD_CANCEL"
3033 #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_setschedparam.3:24
3034 #: build/C/man3/pthread_testcancel.3:24
3040 #: build/C/man3/pthread_cancel.3:27
3041 msgid "pthread_cancel - send a cancellation request to a thread"
3045 #: build/C/man3/pthread_cancel.3:32
3047 msgid "B<int pthread_cancel(pthread_t >I<thread>B<);>\n"
3048 msgstr "B<int pthread_cancel(pthread_t >I<thread>B<);>\n"
3051 #: build/C/man3/pthread_cancel.3:44
3053 "The B<pthread_cancel>() function sends a cancellation request to the thread "
3054 "I<thread>. Whether and when the target thread reacts to the cancellation "
3055 "request depends on two attributes that are under the control of that thread: "
3056 "its cancelability I<state> and I<type>."
3060 #: build/C/man3/pthread_cancel.3:56
3062 "A thread's cancelability state, determined by B<pthread_setcancelstate>(3), "
3063 "can be I<enabled> (the default for new threads) or I<disabled>. If a thread "
3064 "has disabled cancellation, then a cancellation request remains queued until "
3065 "the thread enables cancellation. If a thread has enabled cancellation, then "
3066 "its cancelability type determines when cancellation occurs."
3070 #: build/C/man3/pthread_cancel.3:72
3072 "A thread's cancellation type, determined by B<pthread_setcanceltype>(3), may "
3073 "be either I<asynchronous> or I<deferred> (the default for new threads). "
3074 "Asynchronous cancelability means that the thread can be canceled at any time "
3075 "(usually immediately, but the system does not guarantee this). Deferred "
3076 "cancelability means that cancellation will be delayed until the thread next "
3077 "calls a function that is a I<cancellation point>. A list of functions that "
3078 "are or may be cancellation points is provided in I<pthreads>(7)."
3082 #: build/C/man3/pthread_cancel.3:76
3084 "When a cancellation requested is acted on, the following steps occur for "
3085 "I<thread> (in this order):"
3089 #: build/C/man3/pthread_cancel.3:76 build/C/man3/pthread_cleanup_push.3:67
3095 #: build/C/man3/pthread_cancel.3:81
3097 "Cancellation clean-up handlers are popped (in the reverse of the order in "
3098 "which they were pushed) and called. (See B<pthread_cleanup_push>(3).)"
3102 #: build/C/man3/pthread_cancel.3:81 build/C/man3/pthread_cleanup_push.3:71
3108 #: build/C/man3/pthread_cancel.3:86
3110 "Thread-specific data destructors are called, in an unspecified order. (See "
3111 "B<pthread_key_create>(3).)"
3115 #: build/C/man3/pthread_cancel.3:86 build/C/man3/pthread_cleanup_push.3:79
3121 #: build/C/man3/pthread_cancel.3:90
3122 msgid "The thread is terminated. (See B<pthread_exit>(3).)"
3126 #: build/C/man3/pthread_cancel.3:98
3128 "The above steps happen asynchronously with respect to the B<pthread_cancel>"
3129 "() call; the return status of B<pthread_cancel>() merely informs the "
3130 "caller whether the cancellation request was successfully queued."
3134 #: build/C/man3/pthread_cancel.3:107
3136 "After a canceled thread has terminated, a join with that thread using "
3137 "B<pthread_join>(3) obtains B<PTHREAD_CANCELED> as the thread's exit "
3138 "status. (Joining with a thread is the only way to know that cancellation "
3143 #: build/C/man3/pthread_cancel.3:112
3145 "On success, B<pthread_cancel>() returns 0; on error, it returns a nonzero "
3150 #: build/C/man3/pthread_cancel.3:113 build/C/man3/pthread_detach.3:57
3151 #: build/C/man3/pthread_getcpuclockid.3:56 build/C/man3/pthread_join.3:91
3152 #: build/C/man3/pthread_kill.3:59 build/C/man3/pthread_setaffinity_np.3:112
3153 #: build/C/man3/pthread_setschedparam.3:112
3154 #: build/C/man3/pthread_setschedprio.3:68 build/C/man3/pthread_sigqueue.3:83
3160 #: build/C/man3/pthread_cancel.3:120 build/C/man3/pthread_detach.3:62
3161 #: build/C/man3/pthread_getcpuclockid.3:61 build/C/man3/pthread_join.3:96
3162 #: build/C/man3/pthread_kill.3:64 build/C/man3/pthread_setaffinity_np.3:117
3163 #: build/C/man3/pthread_setschedparam.3:117
3164 #: build/C/man3/pthread_setschedprio.3:73
3165 msgid "No thread with the ID I<thread> could be found."
3169 #: build/C/man3/pthread_cancel.3:130
3171 "On Linux, cancellation is implemented using signals. Under the NPTL "
3172 "threading implementation, the first real-time signal (i.e., signal 32) is "
3173 "used for this purpose. On LinuxThreads, the second real-time signal is "
3174 "used, if real-time signals are available, otherwise B<SIGUSR2> is used."
3178 #: build/C/man3/pthread_cancel.3:136
3180 "The program below creates a thread and then cancels it. The main thread "
3181 "joins with the canceled thread to check that its exit status was "
3182 "B<PTHREAD_CANCELED>. The following shell session shows what happens when we "
3187 #: build/C/man3/pthread_cancel.3:144
3191 "thread_func(): started; cancellation disabled\n"
3192 "main(): sending cancellation request\n"
3193 "thread_func(): about to enable cancellation\n"
3194 "main(): thread was canceled\n"
3197 "thread_func(): started; cancellation disabled\n"
3198 "main(): sending cancellation request\n"
3199 "thread_func(): about to enable cancellation\n"
3200 "main(): thread was canceled\n"
3203 #: build/C/man3/pthread_cancel.3:154
3206 "#include E<lt>pthread.hE<gt>\n"
3207 "#include E<lt>stdio.hE<gt>\n"
3208 "#include E<lt>errno.hE<gt>\n"
3209 "#include E<lt>stdlib.hE<gt>\n"
3210 "#include E<lt>unistd.hE<gt>\n"
3212 "#include E<lt>pthread.hE<gt>\n"
3213 "#include E<lt>stdio.hE<gt>\n"
3214 "#include E<lt>errno.hE<gt>\n"
3215 "#include E<lt>stdlib.hE<gt>\n"
3216 "#include E<lt>unistd.hE<gt>\n"
3219 #: build/C/man3/pthread_cancel.3:162
3223 "thread_func(void *ignored_argument)\n"
3228 "thread_func(void *ignored_argument)\n"
3233 #: build/C/man3/pthread_cancel.3:165
3236 " /* Disable cancellation for a while, so that we don\\(aqt\n"
3237 " immediately react to a cancellation request */\n"
3239 " /* Disable cancellation for a while, so that we don\\(aqt\n"
3240 " immediately react to a cancellation request */\n"
3243 #: build/C/man3/pthread_cancel.3:169
3246 " s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\n"
3248 " handle_error_en(s, \"pthread_setcancelstate\");\n"
3250 " s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\n"
3252 " handle_error_en(s, \"pthread_setcancelstate\");\n"
3255 #: build/C/man3/pthread_cancel.3:173
3258 " printf(\"thread_func(): started; cancellation disabled\\en\");\n"
3260 " printf(\"thread_func(): about to enable cancellation\\en\");\n"
3262 " printf(\"thread_func(): started; cancellation disabled\\en\");\n"
3264 " printf(\"thread_func(): about to enable cancellation\\en\");\n"
3267 #: build/C/man3/pthread_cancel.3:177
3270 " s = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\n"
3272 " handle_error_en(s, \"pthread_setcancelstate\");\n"
3274 " s = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\n"
3276 " handle_error_en(s, \"pthread_setcancelstate\");\n"
3279 #: build/C/man3/pthread_cancel.3:179
3281 msgid " /* sleep() is a cancellation point */\n"
3282 msgstr " /* sleep() is a cancellation point */\n"
3285 #: build/C/man3/pthread_cancel.3:181
3287 msgid " sleep(1000); /* Should get canceled while we sleep */\n"
3288 msgstr " sleep(1000); /* Should get canceled while we sleep */\n"
3291 #: build/C/man3/pthread_cancel.3:183
3293 msgid " /* Should never get here */\n"
3294 msgstr " /* Should never get here */\n"
3297 #: build/C/man3/pthread_cancel.3:187
3300 " printf(\"thread_func(): not canceled!\\en\");\n"
3304 " printf(\"thread_func(): not canceled!\\en\");\n"
3309 #: build/C/man3/pthread_cancel.3:194
3327 #: build/C/man3/pthread_cancel.3:196
3329 msgid " /* Start a thread and then send it a cancellation request */\n"
3330 msgstr " /* Start a thread and then send it a cancellation request */\n"
3333 #: build/C/man3/pthread_cancel.3:200
3336 " s = pthread_create(&thr, NULL, &thread_func, NULL);\n"
3338 " handle_error_en(s, \"pthread_create\");\n"
3340 " s = pthread_create(&thr, NULL, &thread_func, NULL);\n"
3342 " handle_error_en(s, \"pthread_create\");\n"
3345 #: build/C/man3/pthread_cancel.3:202
3347 msgid " sleep(2); /* Give thread a chance to get started */\n"
3348 msgstr " sleep(2); /* Give thread a chance to get started */\n"
3351 #: build/C/man3/pthread_cancel.3:207
3354 " printf(\"main(): sending cancellation request\\en\");\n"
3355 " s = pthread_cancel(thr);\n"
3357 " handle_error_en(s, \"pthread_cancel\");\n"
3359 " printf(\"main(): sending cancellation request\\en\");\n"
3360 " s = pthread_cancel(thr);\n"
3362 " handle_error_en(s, \"pthread_cancel\");\n"
3365 #: build/C/man3/pthread_cancel.3:209
3367 msgid " /* Join with thread to see what its exit status was */\n"
3368 msgstr " /* Join with thread to see what its exit status was */\n"
3371 #: build/C/man3/pthread_cancel.3:213 build/C/man3/pthread_cleanup_push.3:301
3374 " s = pthread_join(thr, &res);\n"
3376 " handle_error_en(s, \"pthread_join\");\n"
3378 " s = pthread_join(thr, &res);\n"
3380 " handle_error_en(s, \"pthread_join\");\n"
3383 #: build/C/man3/pthread_cancel.3:220
3386 " if (res == PTHREAD_CANCELED)\n"
3387 " printf(\"main(): thread was canceled\\en\");\n"
3389 " printf(\"main(): thread wasn\\(aqt canceled (shouldn\\(aqt happen!)\\en\");\n"
3390 " exit(EXIT_SUCCESS);\n"
3393 " if (res == PTHREAD_CANCELED)\n"
3394 " printf(\"main(): thread was canceled\\en\");\n"
3396 " printf(\"main(): thread wasn\\(aqt canceled (shouldn\\(aqt happen!)\\en\");\n"
3397 " exit(EXIT_SUCCESS);\n"
3401 #: build/C/man3/pthread_cancel.3:231
3403 "B<pthread_cleanup_push>(3), B<pthread_create>(3), B<pthread_exit>(3), "
3404 "B<pthread_join>(3), B<pthread_key_create>(3), B<pthread_setcancelstate>(3), "
3405 "B<pthread_setcanceltype>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3407 "B<pthread_cleanup_push>(3), B<pthread_create>(3), B<pthread_exit>(3), "
3408 "B<pthread_join>(3), B<pthread_key_create>(3), B<pthread_setcancelstate>(3), "
3409 "B<pthread_setcanceltype>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3412 #: build/C/man3/pthread_cleanup_push.3:24
3414 msgid "PTHREAD_CLEANUP_PUSH"
3415 msgstr "PTHREAD_CLEANUP_PUSH"
3418 #: build/C/man3/pthread_cleanup_push.3:24
3419 #: build/C/man3/pthread_setcancelstate.3:24
3425 #: build/C/man3/pthread_cleanup_push.3:28
3427 "pthread_cleanup_push, pthread_cleanup_pop - push and pop thread cancellation "
3432 #: build/C/man3/pthread_cleanup_push.3:35
3435 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
3436 "B< void *>I<arg>B<);>\n"
3437 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
3439 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
3440 "B< void *>I<arg>B<);>\n"
3441 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
3444 #: build/C/man3/pthread_cleanup_push.3:46
3446 "These functions manipulate the calling thread's stack of thread-cancellation "
3447 "clean-up handlers. A clean-up handler is a function that is automatically "
3448 "executed when a thread is canceled (or in various other circumstances "
3449 "described below); it might, for example, unlock a mutex so that it becomes "
3450 "available to other threads in the process."
3454 #: build/C/man3/pthread_cleanup_push.3:57
3456 "The B<pthread_cleanup_push>() function pushes I<routine> onto the top of "
3457 "the stack of clean-up handlers. When I<routine> is later invoked, it will "
3458 "be given I<arg> as its argument."
3462 #: build/C/man3/pthread_cleanup_push.3:64
3464 "The B<pthread_cleanup_pop>() function removes the routine at the top of the "
3465 "stack of clean-up handlers, and optionally executes it if I<execute> is "
3470 #: build/C/man3/pthread_cleanup_push.3:67
3472 "A cancellation clean-up handler is popped from the stack and executed in the "
3473 "following circumstances:"
3477 #: build/C/man3/pthread_cleanup_push.3:71
3479 "When a thread is canceled, all of the stacked clean-up handlers are popped "
3480 "and executed in the reverse of the order in which they were pushed onto the "
3485 #: build/C/man3/pthread_cleanup_push.3:79
3487 "When a thread terminates by calling B<pthread_exit>(3), all clean-up "
3488 "handlers are executed as described in the preceding point. (Clean-up "
3489 "handlers are I<not> called if the thread terminates by performing a "
3490 "I<return> from the thread start function.)"
3494 #: build/C/man3/pthread_cleanup_push.3:85
3496 "When a thread calls B<pthread_cleanup_pop>() with a nonzero I<execute> "
3497 "argument, the top-most clean-up handler is popped and executed."
3501 #: build/C/man3/pthread_cleanup_push.3:97
3503 "POSIX.1 permits B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() to "
3504 "be implemented as macros that expand to text containing \\(aqB<{>\\(aq and "
3505 "\\(aqB<}>\\(aq, respectively. For this reason, the caller must ensure that "
3506 "calls to these functions are paired within the same function, and at the "
3507 "same lexical nesting level. (In other words, a clean-up handler is only "
3508 "established during the execution of a specified section of code.)"
3512 #: build/C/man3/pthread_cleanup_push.3:117
3514 "Calling B<longjmp>(3) (B<siglongjmp>(3)) produces undefined results if any "
3515 "call has been made to B<pthread_cleanup_push>() or B<pthread_cleanup_pop>"
3516 "() without the matching call of the pair since the jump buffer was filled "
3517 "by B<setjmp>(3) (B<sigsetjmp>(3)). Likewise, calling B<longjmp>(3) "
3518 "(B<siglongjmp>(3)) from inside a clean-up handler produces undefined "
3519 "results unless the jump buffer was also filled by B<setjmp>(3) (B<sigsetjmp>"
3520 "(3)) inside the handler."
3524 #: build/C/man3/pthread_cleanup_push.3:119
3525 msgid "These functions do not return a value."
3529 #. Available since glibc 2.0
3531 #: build/C/man3/pthread_cleanup_push.3:123
3532 msgid "There are no errors."
3536 #: build/C/man3/pthread_cleanup_push.3:134
3538 "On Linux, the B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() "
3539 "functions I<are> implemented as macros that expand to text containing \\(aqB<"
3540 "{>\\(aq and \\(aqB<}>\\(aq, respectively. This means that variables "
3541 "declared within the scope of paired calls to these functions will only be "
3542 "visible within that scope."
3545 #. The text was actually added in the 2004 TC2
3547 #: build/C/man3/pthread_cleanup_push.3:149
3549 "POSIX.1 says that the effect of using I<return>, I<break>, I<continue>, or "
3550 "I<goto> to prematurely leave a block bracketed B<pthread_cleanup_push>() "
3551 "and B<pthread_cleanup_pop>() is undefined. Portable applications should "
3556 #: build/C/man3/pthread_cleanup_push.3:164
3558 "The program below provides a simple example of the use of the functions "
3559 "described in this page. The program creates a thread that executes a loop "
3560 "bracketed by B<pthread_cleanup_push>() and B<pthread_cleanup_pop>(). This "
3561 "loop increments a global variable, I<cnt>, once each second. Depending on "
3562 "what command-line arguments are supplied, the main thread sends the other "
3563 "thread a cancellation request, or sets a global variable that causes the "
3564 "other thread to exit its loop and terminate normally (by doing a I<return>)."
3568 #: build/C/man3/pthread_cleanup_push.3:167
3570 "In the following shell session, the main thread sends a cancellation request "
3571 "to the other thread:"
3575 #: build/C/man3/pthread_cleanup_push.3:177
3579 "New thread started\n"
3582 "Canceling thread\n"
3583 "Called clean-up handler\n"
3584 "Thread was canceled; cnt = 0\n"
3587 "New thread started\n"
3590 "Canceling thread\n"
3591 "Called clean-up handler\n"
3592 "Thread was canceled; cnt = 0\n"
3595 #: build/C/man3/pthread_cleanup_push.3:185
3597 "From the above, we see that the thread was canceled, and that the "
3598 "cancellation clean-up handler was called and it reset the value of the "
3599 "global variable I<cnt> to 0."
3603 #: build/C/man3/pthread_cleanup_push.3:188
3605 "In the next run, the main program sets a global variable that causes other "
3606 "thread to terminate normally:"
3610 #: build/C/man3/pthread_cleanup_push.3:196
3614 "New thread started\n"
3617 "Thread terminated normally; cnt = 2\n"
3620 "New thread started\n"
3623 "Thread terminated normally; cnt = 2\n"
3626 #: build/C/man3/pthread_cleanup_push.3:204
3628 "From the above, we see that the clean-up handler was not executed (because "
3629 "I<cleanup_pop_arg> was 0), and therefore the value of I<cnt> was not reset."
3633 #: build/C/man3/pthread_cleanup_push.3:209
3635 "In the next run, the main program sets a global variable that causes the "
3636 "other thread to terminate normally, and supplies a nonzero value for "
3637 "I<cleanup_pop_arg>:"
3641 #: build/C/man3/pthread_cleanup_push.3:218
3644 "$ B<./a.out x 1>\n"
3645 "New thread started\n"
3648 "Called clean-up handler\n"
3649 "Thread terminated normally; cnt = 0\n"
3651 "$ B<./a.out x 1>\n"
3652 "New thread started\n"
3655 "Called clean-up handler\n"
3656 "Thread terminated normally; cnt = 0\n"
3659 #: build/C/man3/pthread_cleanup_push.3:225
3661 "In the above, we see that although the thread was not canceled, the clean-up "
3662 "handler was executed, because the argument given to B<pthread_cleanup_pop>"
3667 #: build/C/man3/pthread_cleanup_push.3:234
3670 "#include E<lt>pthread.hE<gt>\n"
3671 "#include E<lt>sys/types.hE<gt>\n"
3672 "#include E<lt>stdio.hE<gt>\n"
3673 "#include E<lt>stdlib.hE<gt>\n"
3674 "#include E<lt>unistd.hE<gt>\n"
3675 "#include E<lt>errno.hE<gt>\n"
3677 "#include E<lt>pthread.hE<gt>\n"
3678 "#include E<lt>sys/types.hE<gt>\n"
3679 "#include E<lt>stdio.hE<gt>\n"
3680 "#include E<lt>stdlib.hE<gt>\n"
3681 "#include E<lt>unistd.hE<gt>\n"
3682 "#include E<lt>errno.hE<gt>\n"
3685 #: build/C/man3/pthread_cleanup_push.3:241
3688 "static int done = 0;\n"
3689 "static int cleanup_pop_arg = 0;\n"
3690 "static int cnt = 0;\n"
3692 "static int done = 0;\n"
3693 "static int cleanup_pop_arg = 0;\n"
3694 "static int cnt = 0;\n"
3697 #: build/C/man3/pthread_cleanup_push.3:248
3701 "cleanup_handler(void *arg)\n"
3703 " printf(\"Called clean-up handler\\en\");\n"
3708 "cleanup_handler(void *arg)\n"
3710 " printf(\"Called clean-up handler\\en\");\n"
3715 #: build/C/man3/pthread_cleanup_push.3:253
3719 "thread_start(void *arg)\n"
3721 " time_t start, curr;\n"
3724 "thread_start(void *arg)\n"
3726 " time_t start, curr;\n"
3729 #: build/C/man3/pthread_cleanup_push.3:255
3731 msgid " printf(\"New thread started\\en\");\n"
3732 msgstr " printf(\"New thread started\\en\");\n"
3735 #: build/C/man3/pthread_cleanup_push.3:257
3737 msgid " pthread_cleanup_push(cleanup_handler, NULL);\n"
3738 msgstr " pthread_cleanup_push(cleanup_handler, NULL);\n"
3741 #: build/C/man3/pthread_cleanup_push.3:259
3743 msgid " curr = start = time(NULL);\n"
3744 msgstr " curr = start = time(NULL);\n"
3747 #: build/C/man3/pthread_cleanup_push.3:268
3750 " while (!done) {\n"
3751 " pthread_testcancel(); /* A cancellation point */\n"
3752 " if (curr E<lt> time(NULL)) {\n"
3753 " curr = time(NULL);\n"
3754 " printf(\"cnt = %d\\en\", cnt); /* A cancellation point */\n"
3759 " while (!done) {\n"
3760 " pthread_testcancel(); /* A cancellation point */\n"
3761 " if (curr E<lt> time(NULL)) {\n"
3762 " curr = time(NULL);\n"
3763 " printf(\"cnt = %d\\en\", cnt); /* A cancellation point */\n"
3769 #: build/C/man3/pthread_cleanup_push.3:272
3772 " pthread_cleanup_pop(cleanup_pop_arg);\n"
3776 " pthread_cleanup_pop(cleanup_pop_arg);\n"
3781 #: build/C/man3/pthread_cleanup_push.3:279
3785 "main(int argc, char *argv[])\n"
3792 "main(int argc, char *argv[])\n"
3799 #: build/C/man3/pthread_cleanup_push.3:283
3802 " s = pthread_create(&thr, NULL, thread_start, NULL);\n"
3804 " handle_error_en(s, \"pthread_create\");\n"
3806 " s = pthread_create(&thr, NULL, thread_start, NULL);\n"
3808 " handle_error_en(s, \"pthread_create\");\n"
3811 #: build/C/man3/pthread_cleanup_push.3:285
3813 msgid " sleep(2); /* Allow new thread to run a while */\n"
3814 msgstr " sleep(2); /* Allow new thread to run a while */\n"
3817 #: build/C/man3/pthread_cleanup_push.3:290
3820 " if (argc E<gt> 1) {\n"
3821 " if (argc E<gt> 2)\n"
3822 " cleanup_pop_arg = atoi(argv[2]);\n"
3825 " if (argc E<gt> 1) {\n"
3826 " if (argc E<gt> 2)\n"
3827 " cleanup_pop_arg = atoi(argv[2]);\n"
3831 #: build/C/man3/pthread_cleanup_push.3:297
3835 " printf(\"Canceling thread\\en\");\n"
3836 " s = pthread_cancel(thr);\n"
3838 " handle_error_en(s, \"pthread_cancel\");\n"
3842 " printf(\"Canceling thread\\en\");\n"
3843 " s = pthread_cancel(thr);\n"
3845 " handle_error_en(s, \"pthread_cancel\");\n"
3849 #: build/C/man3/pthread_cleanup_push.3:308
3852 " if (res == PTHREAD_CANCELED)\n"
3853 " printf(\"Thread was canceled; cnt = %d\\en\", cnt);\n"
3855 " printf(\"Thread terminated normally; cnt = %d\\en\", cnt);\n"
3856 " exit(EXIT_SUCCESS);\n"
3859 " if (res == PTHREAD_CANCELED)\n"
3860 " printf(\"Thread was canceled; cnt = %d\\en\", cnt);\n"
3862 " printf(\"Thread terminated normally; cnt = %d\\en\", cnt);\n"
3863 " exit(EXIT_SUCCESS);\n"
3867 #: build/C/man3/pthread_cleanup_push.3:315
3869 "B<pthread_cancel>(3), B<pthread_cleanup_push_defer_np>(3), "
3870 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3872 "B<pthread_cancel>(3), B<pthread_cleanup_push_defer_np>(3), "
3873 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3876 #: build/C/man3/pthread_cleanup_push_defer_np.3:24
3878 msgid "PTHREAD_CLEANUP_PUSH_DEFER_NP"
3879 msgstr "PTHREAD_CLEANUP_PUSH_DEFER_NP"
3882 #: build/C/man3/pthread_cleanup_push_defer_np.3:24
3888 #: build/C/man3/pthread_cleanup_push_defer_np.3:28
3890 "pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np - push and pop "
3891 "thread cancellation clean-up handlers while saving cancelability type"
3895 #: build/C/man3/pthread_cleanup_push_defer_np.3:35
3898 "B<void pthread_cleanup_push_defer_np(void (*>I<routine>B<)(void *),>\n"
3899 "B< void *>I<arg>B<);>\n"
3900 "B<void pthread_cleanup_pop_restore_np(int >I<execute>B<);>\n"
3902 "B<void pthread_cleanup_push_defer_np(void (*>I<routine>B<)(void *),>\n"
3903 "B< void *>I<arg>B<);>\n"
3904 "B<void pthread_cleanup_pop_restore_np(int >I<execute>B<);>\n"
3907 #: build/C/man3/pthread_cleanup_push_defer_np.3:38
3908 #: build/C/man3/pthread_create.3:36 build/C/man3/pthread_detach.3:35
3909 #: build/C/man3/pthread_join.3:35 build/C/man3/pthread_kill.3:35
3910 #: build/C/man3/pthread_sigmask.3:36 build/C/man3/pthread_sigqueue.3:35
3911 #: build/C/man3/pthread_tryjoin_np.3:40 build/C/man3/pthread_yield.3:34
3912 msgid "Compile and link with I<-pthread>."
3916 #: build/C/man3/pthread_cleanup_push_defer_np.3:44
3918 "These functions are the same as B<pthread_cleanup_push>(3) and "
3919 "B<pthread_cleanup_pop>(3), except for the differences noted on this page."
3923 #: build/C/man3/pthread_cleanup_push_defer_np.3:57
3925 "Like B<pthread_cleanup_push>(3), B<pthread_cleanup_push_defer_np>() pushes "
3926 "I<routine> onto the thread's stack of cancellation clean-up handlers. In "
3927 "addition, it also saves the thread's current cancelability type, and sets "
3928 "the cancelability type to \"deferred\" (see B<pthread_setcanceltype>(3)); "
3929 "this ensures that cancellation clean-up will occur even if the thread's "
3930 "cancelability type was \"asynchronous\" before the call."
3934 #: build/C/man3/pthread_cleanup_push_defer_np.3:66
3936 "Like B<pthread_cleanup_pop>(3), B<pthread_cleanup_pop_restore_np>() pops "
3937 "the top-most clean-up handler from the thread's stack of cancellation clean-"
3938 "up handlers. In addition, it restores the thread's cancelability type to "
3939 "its value at the time of the matching B<pthread_cleanup_push_defer_np>()."
3943 #: build/C/man3/pthread_cleanup_push_defer_np.3:72
3945 "The caller must ensure that calls to these functions are paired within the "
3946 "same function, and at the same lexical nesting level. Other restrictions "
3947 "apply, as described in B<pthread_cleanup_push>(3)."
3951 #: build/C/man3/pthread_cleanup_push_defer_np.3:74
3952 msgid "This sequence of calls:"
3956 #: build/C/man3/pthread_cleanup_push_defer_np.3:79
3959 "pthread_cleanup_push_defer_np(routine, arg);\n"
3960 "pthread_cleanup_pop_restore_np(execute);\n"
3964 #: build/C/man3/pthread_cleanup_push_defer_np.3:83
3965 msgid "is equivalent to (but shorter and more efficient than):"
3969 #: build/C/man3/pthread_cleanup_push_defer_np.3:89
3971 msgid "int oldtype;\n"
3972 msgstr "int oldtype;\n"
3975 #: build/C/man3/pthread_cleanup_push_defer_np.3:95
3978 "pthread_cleanup_push(routine, arg);\n"
3979 "pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);\n"
3981 "pthread_setcanceltype(oldtype, NULL);\n"
3982 "pthread_cleanup_pop(execute);\n"
3984 "pthread_cleanup_push(routine, arg);\n"
3985 "pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);\n"
3987 "pthread_setcanceltype(oldtype, NULL);\n"
3988 "pthread_cleanup_pop(execute);\n"
3991 #: build/C/man3/pthread_cleanup_push_defer_np.3:108
3993 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_setcancelstate>"
3994 "(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3996 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_setcancelstate>"
3997 "(3), B<pthread_testcancel>(3), B<pthreads>(7)"
4000 #: build/C/man3/pthread_create.3:24
4002 msgid "PTHREAD_CREATE"
4003 msgstr "PTHREAD_CREATE"
4006 #: build/C/man3/pthread_create.3:27
4007 msgid "pthread_create - create a new thread"
4011 #: build/C/man3/pthread_create.3:33
4014 "B<int pthread_create(pthread_t *>I<thread>B<, const pthread_attr_t *>I<attr>B<,>\n"
4015 "B< void *(*>I<start_routine>B<) (void *), void *>I<arg>B<);>\n"
4017 "B<int pthread_create(pthread_t *>I<thread>B<, const pthread_attr_t *>I<attr>B<,>\n"
4018 "B< void *(*>I<start_routine>B<) (void *), void *>I<arg>B<);>\n"
4021 #: build/C/man3/pthread_create.3:45
4023 "The B<pthread_create>() function starts a new thread in the calling "
4024 "process. The new thread starts execution by invoking I<start_routine>(); "
4025 "I<arg> is passed as the sole argument of I<start_routine>()."
4029 #: build/C/man3/pthread_create.3:47
4030 msgid "The new thread terminates in one of the following ways:"
4034 #: build/C/man3/pthread_create.3:47 build/C/man3/pthread_create.3:53
4035 #: build/C/man3/pthread_create.3:61 build/C/man3/pthread_create.3:64
4036 #: build/C/man3/pthread_getattr_np.3:50 build/C/man3/pthread_getattr_np.3:53
4037 #: build/C/man3/pthread_getattr_np.3:56
4043 #: build/C/man3/pthread_create.3:53
4045 "It calls B<pthread_exit>(3), specifying an exit status value that is "
4046 "available to another thread in the same process that calls B<pthread_join>"
4051 #: build/C/man3/pthread_create.3:61
4053 "It returns from I<start_routine>(). This is equivalent to calling "
4054 "B<pthread_exit>(3) with the value supplied in the I<return> statement."
4058 #: build/C/man3/pthread_create.3:64
4059 msgid "It is canceled (see B<pthread_cancel>(3))."
4063 #: build/C/man3/pthread_create.3:70
4065 "Any of the threads in the process calls B<exit>(3), or the main thread "
4066 "performs a return from I<main>(). This causes the termination of all "
4067 "threads in the process."
4071 #: build/C/man3/pthread_create.3:84
4073 "The I<attr> argument points to a I<pthread_attr_t> structure whose contents "
4074 "are used at thread creation time to determine attributes for the new thread; "
4075 "this structure is initialized using B<pthread_attr_init>(3) and related "
4076 "functions. If I<attr> is NULL, then the thread is created with default "
4081 #: build/C/man3/pthread_create.3:91
4083 "Before returning, a successful call to B<pthread_create>() stores the ID of "
4084 "the new thread in the buffer pointed to by I<thread>; this identifier is "
4085 "used to refer to the thread in subsequent calls to other pthreads functions."
4089 #: build/C/man3/pthread_create.3:99
4091 "The new thread inherits a copy of the creating thread's signal mask "
4092 "(B<pthread_sigmask>(3)). The set of pending signals for the new thread is "
4093 "empty (B<sigpending>(2)). The new thread does not inherit the creating "
4094 "thread's alternate signal stack (B<sigaltstack>(2))."
4098 #: build/C/man3/pthread_create.3:102
4100 "The new thread inherits the calling thread's floating-point environment "
4104 #. CLOCK_THREAD_CPUTIME_ID in clock_gettime(2)
4106 #: build/C/man3/pthread_create.3:107
4108 "The initial value of the new thread's CPU-time clock is 0 (see "
4109 "B<pthread_getcpuclockid>(3))."
4113 #: build/C/man3/pthread_create.3:107
4115 msgid "Linux-specific details"
4119 #: build/C/man3/pthread_create.3:113
4121 "The new thread inherits copies of the calling thread's capability sets (see "
4122 "B<capabilities>(7)) and CPU affinity mask (see B<sched_setaffinity>(2))."
4126 #: build/C/man3/pthread_create.3:120
4128 "On success, B<pthread_create>() returns 0; on error, it returns an error "
4129 "number, and the contents of I<*thread> are undefined."
4133 #: build/C/man3/pthread_create.3:121 build/C/man3/pthread_sigqueue.3:69
4139 #: build/C/man3/pthread_create.3:135
4141 "Insufficient resources to create another thread, or a system-imposed limit "
4142 "on the number of threads was encountered. The latter case may occur in two "
4143 "ways: the B<RLIMIT_NPROC> soft resource limit (set via B<setrlimit>(2)), "
4144 "which limits the number of process for a real user ID, was reached; or the "
4145 "kernel's system-wide limit on the number of threads, I</proc/sys/kernel/"
4146 "threads-max>, was reached."
4150 #: build/C/man3/pthread_create.3:139
4151 msgid "Invalid settings in I<attr>."
4155 #: build/C/man3/pthread_create.3:139 build/C/man3/pthread_setschedparam.3:127
4156 #: build/C/man3/pthread_setschedprio.3:64
4162 #: build/C/man3/pthread_create.3:144
4164 "No permission to set the scheduling policy and parameters specified in "
4169 #: build/C/man3/pthread_create.3:158
4171 "See B<pthread_self>(3) for further information on the thread ID returned in "
4172 "I<*thread> by B<pthread_create>(). Unless real-time scheduling policies are "
4173 "being employed, after a call to B<pthread_create>(), it is indeterminate "
4174 "which thread\\(emthe caller or the new thread\\(emwill next execute."
4178 #: build/C/man3/pthread_create.3:178
4180 "A thread may either be I<joinable> or I<detached>. If a thread is joinable, "
4181 "then another thread can call B<pthread_join>(3) to wait for the thread to "
4182 "terminate and fetch its exit status. Only when a terminated joinable thread "
4183 "has been joined are the last of its resources released back to the system. "
4184 "When a detached thread terminates, its resources are automatically released "
4185 "back to the system: it is not possible to join with the thread in order to "
4186 "obtain its exit status. Making a thread detached is useful for some types "
4187 "of daemon threads whose exit status the application does not need to care "
4188 "about. By default, a new thread is created in a joinable state, unless "
4189 "I<attr> was set to create the thread in a detached state (using "
4190 "B<pthread_attr_setdetachstate>(3))."
4193 #. FIXME . Perhaps some of the following detail should be in
4194 #. a future pthread_attr_setstacksize(3) page.
4196 #: build/C/man3/pthread_create.3:194
4198 "On Linux/x86-32, the default stack size for a new thread is 2 megabytes. "
4199 "Under the NPTL threading implementation, if the B<RLIMIT_STACK> soft "
4200 "resource limit I<at the time the program started> has any value other than "
4201 "\"unlimited\", then it determines the default stack size of new threads. "
4202 "Using B<pthread_attr_setstacksize>(3), the stack size attribute can be "
4203 "explicitly set in the I<attr> argument used to create a thread, in order to "
4204 "obtain a stack size other than the default."
4208 #: build/C/man3/pthread_create.3:200
4210 "In the obsolete LinuxThreads implementation, each of the threads in a "
4211 "process has a different process ID. This is in violation of the POSIX "
4212 "threads specification, and is the source of many other nonconformances to "
4213 "the standard; see B<pthreads>(7)."
4217 #: build/C/man3/pthread_create.3:204
4219 "The program below demonstrates the use of B<pthread_create>(), as well as a "
4220 "number of other functions in the pthreads API."
4224 #: build/C/man3/pthread_create.3:209
4226 "In the following run, on a system providing the NPTL threading "
4227 "implementation, the stack size defaults to the value given by the \"stack "
4228 "size\" resource limit:"
4232 #: build/C/man3/pthread_create.3:221
4236 "8192 # The stack size limit is 8 MB (0x80000 bytes)\n"
4237 "$B< ./a.out hola salut servus>\n"
4238 "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n"
4239 "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n"
4240 "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n"
4241 "Joined with thread 1; returned value was HOLA\n"
4242 "Joined with thread 2; returned value was SALUT\n"
4243 "Joined with thread 3; returned value was SERVUS\n"
4246 "8192 # The stack size limit is 8 MB (0x80000 bytes)\n"
4247 "$B< ./a.out hola salut servus>\n"
4248 "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n"
4249 "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n"
4250 "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n"
4251 "Joined with thread 1; returned value was HOLA\n"
4252 "Joined with thread 2; returned value was SALUT\n"
4253 "Joined with thread 3; returned value was SERVUS\n"
4256 #: build/C/man3/pthread_create.3:227
4258 "In the next run, the program explicitly sets a stack size of 1MB (using "
4259 "B<pthread_attr_setstacksize>(3)) for the created threads:"
4263 #: build/C/man3/pthread_create.3:237
4266 "$B< ./a.out -s 0x100000 hola salut servus>\n"
4267 "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n"
4268 "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n"
4269 "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n"
4270 "Joined with thread 1; returned value was HOLA\n"
4271 "Joined with thread 2; returned value was SALUT\n"
4272 "Joined with thread 3; returned value was SERVUS\n"
4274 "$B< ./a.out -s 0x100000 hola salut servus>\n"
4275 "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n"
4276 "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n"
4277 "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n"
4278 "Joined with thread 1; returned value was HOLA\n"
4279 "Joined with thread 2; returned value was SALUT\n"
4280 "Joined with thread 3; returned value was SERVUS\n"
4283 #: build/C/man3/pthread_create.3:249
4286 "#include E<lt>pthread.hE<gt>\n"
4287 "#include E<lt>string.hE<gt>\n"
4288 "#include E<lt>stdio.hE<gt>\n"
4289 "#include E<lt>stdlib.hE<gt>\n"
4290 "#include E<lt>unistd.hE<gt>\n"
4291 "#include E<lt>errno.hE<gt>\n"
4292 "#include E<lt>ctype.hE<gt>\n"
4294 "#include E<lt>pthread.hE<gt>\n"
4295 "#include E<lt>string.hE<gt>\n"
4296 "#include E<lt>stdio.hE<gt>\n"
4297 "#include E<lt>stdlib.hE<gt>\n"
4298 "#include E<lt>unistd.hE<gt>\n"
4299 "#include E<lt>errno.hE<gt>\n"
4300 "#include E<lt>ctype.hE<gt>\n"
4303 #: build/C/man3/pthread_create.3:255 build/C/man3/pthread_getcpuclockid.3:108
4306 "#define handle_error(msg) \\e\n"
4307 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
4309 "#define handle_error(msg) \\e\n"
4310 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
4313 #: build/C/man3/pthread_create.3:261
4316 "struct thread_info { /* Used as argument to thread_start() */\n"
4317 " pthread_t thread_id; /* ID returned by pthread_create() */\n"
4318 " int thread_num; /* Application-defined thread # */\n"
4319 " char *argv_string; /* From command-line argument */\n"
4322 "struct thread_info { /* Used as argument to thread_start() */\n"
4323 " pthread_t thread_id; /* ID returned by pthread_create() */\n"
4324 " int thread_num; /* Application-defined thread # */\n"
4325 " char *argv_string; /* From command-line argument */\n"
4329 #: build/C/man3/pthread_create.3:264
4332 "/* Thread start function: display address near top of our stack,\n"
4333 " and return upper-cased copy of argv_string */\n"
4335 "/* Thread start function: display address near top of our stack,\n"
4336 " and return upper-cased copy of argv_string */\n"
4339 #: build/C/man3/pthread_create.3:270
4343 "thread_start(void *arg)\n"
4345 " struct thread_info *tinfo = (struct thread_info *) arg;\n"
4346 " char *uargv, *p;\n"
4349 "thread_start(void *arg)\n"
4351 " struct thread_info *tinfo = (struct thread_info *) arg;\n"
4352 " char *uargv, *p;\n"
4355 #: build/C/man3/pthread_create.3:273
4358 " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n"
4359 " tinfo-E<gt>thread_num, &p, tinfo-E<gt>argv_string);\n"
4361 " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n"
4362 " tinfo-E<gt>thread_num, &p, tinfo-E<gt>argv_string);\n"
4365 #: build/C/man3/pthread_create.3:277
4368 " uargv = strdup(tinfo-E<gt>argv_string);\n"
4369 " if (uargv == NULL)\n"
4370 " handle_error(\"strdup\");\n"
4372 " uargv = strdup(tinfo-E<gt>argv_string);\n"
4373 " if (uargv == NULL)\n"
4374 " handle_error(\"strdup\");\n"
4377 #: build/C/man3/pthread_create.3:280
4380 " for (p = uargv; *p != \\(aq\\e0\\(aq; p++)\n"
4381 " *p = toupper(*p);\n"
4383 " for (p = uargv; *p != \\(aq\\e0\\(aq; p++)\n"
4384 " *p = toupper(*p);\n"
4387 #: build/C/man3/pthread_create.3:283
4397 #: build/C/man3/pthread_create.3:292
4401 "main(int argc, char *argv[])\n"
4403 " int s, tnum, opt, num_threads;\n"
4404 " struct thread_info *tinfo;\n"
4405 " pthread_attr_t attr;\n"
4406 " int stack_size;\n"
4410 "main(int argc, char *argv[])\n"
4412 " int s, tnum, opt, num_threads;\n"
4413 " struct thread_info *tinfo;\n"
4414 " pthread_attr_t attr;\n"
4415 " int stack_size;\n"
4419 #: build/C/man3/pthread_create.3:294
4421 msgid " /* The \"-s\" option specifies a stack size for our threads */\n"
4422 msgstr " /* The \"-s\" option specifies a stack size for our threads */\n"
4425 #: build/C/man3/pthread_create.3:301
4428 " stack_size = -1;\n"
4429 " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n"
4431 " case \\(aqs\\(aq:\n"
4432 " stack_size = strtoul(optarg, NULL, 0);\n"
4435 " stack_size = -1;\n"
4436 " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n"
4438 " case \\(aqs\\(aq:\n"
4439 " stack_size = strtoul(optarg, NULL, 0);\n"
4443 #: build/C/man3/pthread_create.3:308
4447 " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n"
4449 " exit(EXIT_FAILURE);\n"
4454 " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n"
4456 " exit(EXIT_FAILURE);\n"
4461 #: build/C/man3/pthread_create.3:310
4463 msgid " num_threads = argc - optind;\n"
4464 msgstr " num_threads = argc - optind;\n"
4467 #: build/C/man3/pthread_create.3:312
4469 msgid " /* Initialize thread creation attributes */\n"
4470 msgstr " /* Initialize thread creation attributes */\n"
4473 #: build/C/man3/pthread_create.3:316
4476 " s = pthread_attr_init(&attr);\n"
4478 " handle_error_en(s, \"pthread_attr_init\");\n"
4480 " s = pthread_attr_init(&attr);\n"
4482 " handle_error_en(s, \"pthread_attr_init\");\n"
4485 #: build/C/man3/pthread_create.3:322
4488 " if (stack_size E<gt> 0) {\n"
4489 " s = pthread_attr_setstacksize(&attr, stack_size);\n"
4491 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
4494 " if (stack_size E<gt> 0) {\n"
4495 " s = pthread_attr_setstacksize(&attr, stack_size);\n"
4497 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
4501 #: build/C/man3/pthread_create.3:324
4503 msgid " /* Allocate memory for pthread_create() arguments */\n"
4504 msgstr " /* Allocate memory for pthread_create() arguments */\n"
4507 #: build/C/man3/pthread_create.3:328
4510 " tinfo = calloc(num_threads, sizeof(struct thread_info));\n"
4511 " if (tinfo == NULL)\n"
4512 " handle_error(\"calloc\");\n"
4514 " tinfo = calloc(num_threads, sizeof(struct thread_info));\n"
4515 " if (tinfo == NULL)\n"
4516 " handle_error(\"calloc\");\n"
4519 #: build/C/man3/pthread_create.3:330
4521 msgid " /* Create one thread for each command-line argument */\n"
4522 msgstr " /* Create one thread for each command-line argument */\n"
4525 #: build/C/man3/pthread_create.3:334
4528 " for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
4529 " tinfo[tnum].thread_num = tnum + 1;\n"
4530 " tinfo[tnum].argv_string = argv[optind + tnum];\n"
4532 " for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
4533 " tinfo[tnum].thread_num = tnum + 1;\n"
4534 " tinfo[tnum].argv_string = argv[optind + tnum];\n"
4537 #: build/C/man3/pthread_create.3:337
4540 " /* The pthread_create() call stores the thread ID into\n"
4541 " corresponding element of tinfo[] */\n"
4543 " /* The pthread_create() call stores the thread ID into\n"
4544 " corresponding element of tinfo[] */\n"
4547 #: build/C/man3/pthread_create.3:343
4550 " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n"
4551 " &thread_start, &tinfo[tnum]);\n"
4553 " handle_error_en(s, \"pthread_create\");\n"
4556 " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n"
4557 " &thread_start, &tinfo[tnum]);\n"
4559 " handle_error_en(s, \"pthread_create\");\n"
4563 #: build/C/man3/pthread_create.3:346
4566 " /* Destroy the thread attributes object, since it is no\n"
4567 " longer needed */\n"
4569 " /* Destroy the thread attributes object, since it is no\n"
4570 " longer needed */\n"
4573 #: build/C/man3/pthread_create.3:350 build/C/man3/pthread_setschedparam.3:421
4576 " s = pthread_attr_destroy(&attr);\n"
4578 " handle_error_en(s, \"pthread_attr_destroy\");\n"
4580 " s = pthread_attr_destroy(&attr);\n"
4582 " handle_error_en(s, \"pthread_attr_destroy\");\n"
4585 #: build/C/man3/pthread_create.3:352
4587 msgid " /* Now join with each thread, and display its returned value */\n"
4588 msgstr " /* Now join with each thread, and display its returned value */\n"
4591 #: build/C/man3/pthread_create.3:357
4594 " for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
4595 " s = pthread_join(tinfo[tnum].thread_id, &res);\n"
4597 " handle_error_en(s, \"pthread_join\");\n"
4599 " for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
4600 " s = pthread_join(tinfo[tnum].thread_id, &res);\n"
4602 " handle_error_en(s, \"pthread_join\");\n"
4605 #: build/C/man3/pthread_create.3:362
4608 " printf(\"Joined with thread %d; returned value was %s\\en\",\n"
4609 " tinfo[tnum].thread_num, (char *) res);\n"
4610 " free(res); /* Free memory allocated by thread */\n"
4613 " printf(\"Joined with thread %d; returned value was %s\\en\",\n"
4614 " tinfo[tnum].thread_num, (char *) res);\n"
4615 " free(res); /* Free memory allocated by thread */\n"
4619 #: build/C/man3/pthread_create.3:366
4623 " exit(EXIT_SUCCESS);\n"
4627 " exit(EXIT_SUCCESS);\n"
4631 #: build/C/man3/pthread_create.3:378
4633 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_cancel>(3), "
4634 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), "
4635 "B<pthread_getattr_np>(3), B<pthread_join>(3), B<pthread_self>(3), B<pthreads>"
4638 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_cancel>(3), "
4639 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), "
4640 "B<pthread_getattr_np>(3), B<pthread_join>(3), B<pthread_self>(3), B<pthreads>"
4644 #: build/C/man3/pthread_detach.3:24
4646 msgid "PTHREAD_DETACH"
4647 msgstr "PTHREAD_DETACH"
4650 #: build/C/man3/pthread_detach.3:24 build/C/man3/pthread_join.3:24
4656 #: build/C/man3/pthread_detach.3:27
4657 msgid "pthread_detach - detach a thread"
4661 #: build/C/man3/pthread_detach.3:32
4663 msgid "B<int pthread_detach(pthread_t >I<thread>B<);>\n"
4664 msgstr "B<int pthread_detach(pthread_t >I<thread>B<);>\n"
4667 #: build/C/man3/pthread_detach.3:44
4669 "The B<pthread_detach>() function marks the thread identified by I<thread> "
4670 "as detached. When a detached thread terminates, its resources are "
4671 "automatically released back to the system without the need for another "
4672 "thread to join with the terminated thread."
4676 #: build/C/man3/pthread_detach.3:47
4678 "Attempting to detach an already detached thread results in unspecified "
4683 #: build/C/man3/pthread_detach.3:52
4685 "On success, B<pthread_detach>() returns 0; on error, it returns an error "
4690 #: build/C/man3/pthread_detach.3:57 build/C/man3/pthread_join.3:87
4691 msgid "I<thread> is not a joinable thread."
4695 #: build/C/man3/pthread_detach.3:68
4697 "Once a thread has been detached, it can't be joined with B<pthread_join>(3) "
4698 "or be made joinable again."
4702 #: build/C/man3/pthread_detach.3:75
4704 "A new thread can be created in a detached state using "
4705 "B<pthread_attr_setdetachstate>(3) to set the detached attribute of the "
4706 "I<attr> argument of B<pthread_create>(3)."
4710 #: build/C/man3/pthread_detach.3:82
4712 "The detached attribute merely determines the behavior of the system when the "
4713 "thread terminates; it does not prevent the thread from being terminated if "
4714 "the process terminates using B<exit>(3) (or equivalently, if the main "
4719 #: build/C/man3/pthread_detach.3:91
4721 "Either B<pthread_join>(3) or B<pthread_detach>() should be called for each "
4722 "thread that an application creates, so that system resources for the thread "
4723 "can be released. (But note that the resources of all threads are freed when "
4724 "the process terminates.)"
4728 #: build/C/man3/pthread_detach.3:93
4729 msgid "The following statement detaches the calling thread:"
4733 #: build/C/man3/pthread_detach.3:95
4735 msgid " pthread_detach(pthread_self());\n"
4736 msgstr " pthread_detach(pthread_self());\n"
4739 #: build/C/man3/pthread_detach.3:102
4741 "B<pthread_attr_setdetachstate>(3), B<pthread_cancel>(3), B<pthread_create>"
4742 "(3), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
4744 "B<pthread_attr_setdetachstate>(3), B<pthread_cancel>(3), B<pthread_create>"
4745 "(3), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
4748 #: build/C/man3/pthread_equal.3:24
4750 msgid "PTHREAD_EQUAL"
4751 msgstr "PTHREAD_EQUAL"
4754 #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24
4760 #: build/C/man3/pthread_equal.3:27
4761 msgid "pthread_equal - compare thread IDs"
4765 #: build/C/man3/pthread_equal.3:32
4767 msgid "B<int pthread_equal(pthread_t >I<t1>B<, pthread_t >I<t2>B<);>\n"
4768 msgstr "B<int pthread_equal(pthread_t >I<t1>B<, pthread_t >I<t2>B<);>\n"
4771 #: build/C/man3/pthread_equal.3:39
4772 msgid "The B<pthread_equal>() function compares two thread identifiers."
4776 #: build/C/man3/pthread_equal.3:43
4778 "If the two thread IDs are equal, B<pthread_equal>() returns a nonzero "
4779 "value; otherwise, it returns 0."
4783 #. Available since glibc 2.0
4785 #: build/C/man3/pthread_equal.3:45 build/C/man3/pthread_exit.3:73
4786 #: build/C/man3/pthread_self.3:48 build/C/man3/pthread_testcancel.3:56
4787 msgid "This function always succeeds."
4791 #: build/C/man3/pthread_equal.3:54
4793 "The B<pthread_equal>() function is necessary because thread IDs should be "
4794 "considered opaque: there is no portable way for applications to directly "
4795 "compare two I<pthread_t> values."
4799 #: build/C/man3/pthread_equal.3:58
4800 msgid "B<pthread_create>(3), B<pthread_self>(3), B<pthreads>(7)"
4801 msgstr "B<pthread_create>(3), B<pthread_self>(3), B<pthreads>(7)"
4804 #: build/C/man3/pthread_exit.3:24
4806 msgid "PTHREAD_EXIT"
4807 msgstr "PTHREAD_EXIT"
4810 #: build/C/man3/pthread_exit.3:27
4811 msgid "pthread_exit - terminate calling thread"
4815 #: build/C/man3/pthread_exit.3:32
4817 msgid "B<void pthread_exit(void *>I<retval>B<);>\n"
4818 msgstr "B<void pthread_exit(void *>I<retval>B<);>\n"
4821 #: build/C/man3/pthread_exit.3:43
4823 "The B<pthread_exit>() function terminates the calling thread and returns a "
4824 "value via I<retval> that (if the thread is joinable) is available to "
4825 "another thread in the same process that calls B<pthread_join>(3)."
4829 #: build/C/man3/pthread_exit.3:53
4831 "Any clean-up handlers established by B<pthread_cleanup_push>(3) that have "
4832 "not yet been popped, are popped (in the reverse of the order in which they "
4833 "were pushed) and executed. If the thread has any thread-specific data, "
4834 "then, after the clean-up handlers have been executed, the corresponding "
4835 "destructor functions are called, in an unspecified order."
4839 #: build/C/man3/pthread_exit.3:60
4841 "When a thread terminates, process-shared resources (e.g., mutexes, condition "
4842 "variables, semaphores, and file descriptors) are not released, and functions "
4843 "registered using B<atexit>(3) are not called."
4847 #: build/C/man3/pthread_exit.3:69
4849 "After the last thread in a process terminates, the process terminates as by "
4850 "calling B<exit>(3) with an exit status of zero; thus, process-shared "
4851 "resources are released and functions registered using B<atexit>(3) are "
4856 #: build/C/man3/pthread_exit.3:71
4857 msgid "This function does not return to the caller."
4861 #: build/C/man3/pthread_exit.3:80
4863 "Performing a return from the start function of any thread other than the "
4864 "main thread results in an implicit call to B<pthread_exit>(), using the "
4865 "function's return value as the thread's exit status."
4869 #: build/C/man3/pthread_exit.3:86
4871 "To allow other threads to continue execution, the main thread should "
4872 "terminate by calling B<pthread_exit>() rather than B<exit>(3)."
4876 #: build/C/man3/pthread_exit.3:91
4878 "The value pointed to by I<retval> should not be located on the calling "
4879 "thread's stack, since the contents of that stack are undefined after the "
4880 "thread terminates."
4884 #. FIXME . review a later kernel to see if this gets fixed
4885 #. http://thread.gmane.org/gmane.linux.kernel/611611
4886 #. http://marc.info/?l=linux-kernel&m=122525468300823&w=2
4888 #: build/C/man3/pthread_exit.3:103
4890 "Currently, there are limitations in the kernel implementation logic for "
4891 "B<wait>(2)ing on a stopped thread group with a dead thread group leader. "
4892 "This can manifest in problems such as a locked terminal if a stop signal is "
4893 "sent to a foreground process whose thread group leader has already called "
4894 "B<pthread_exit>()."
4898 #: build/C/man3/pthread_exit.3:107
4899 msgid "B<pthread_create>(3), B<pthread_join>(3), B<pthreads>(7)"
4900 msgstr "B<pthread_create>(3), B<pthread_join>(3), B<pthreads>(7)"
4903 #: build/C/man3/pthread_getattr_np.3:24
4905 msgid "PTHREAD_GETATTR_NP"
4906 msgstr "PTHREAD_GETATTR_NP"
4909 #: build/C/man3/pthread_getattr_np.3:27
4910 msgid "pthread_getattr_np - get attributes of created thread"
4914 #: build/C/man3/pthread_getattr_np.3:33
4916 msgid "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
4917 msgstr "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
4920 #: build/C/man3/pthread_getattr_np.3:43
4922 "The B<pthread_getattr_np>() function initializes the thread attributes "
4923 "object referred to by I<attr> so that it contains actual attribute values "
4924 "describing the running thread I<thread>."
4928 #: build/C/man3/pthread_getattr_np.3:50
4930 "The returned attribute values may differ from the corresponding attribute "
4931 "values passed in the I<attr> object that was used to create the thread using "
4932 "B<pthread_create>(3). In particular, the following attributes may differ:"
4936 #: build/C/man3/pthread_getattr_np.3:53
4938 "the detach state, since a joinable thread may have detached itself after "
4943 #: build/C/man3/pthread_getattr_np.3:56
4945 "the stack size, which the implementation may align to a suitable boundary."
4949 #: build/C/man3/pthread_getattr_np.3:61
4951 "and the guard size, which the implementation may round upward to a multiple "
4952 "of the page size, or ignore (i.e., treat as 0), if the application is "
4953 "allocating its own stack."
4957 #: build/C/man3/pthread_getattr_np.3:66
4959 "Furthermore, if the stack address attribute was not set in the thread "
4960 "attributes object used to create the thread, then the returned thread "
4961 "attributes object will report the actual stack address that the "
4962 "implementation selected for the thread."
4966 #: build/C/man3/pthread_getattr_np.3:71
4968 "When the thread attributes object returned by B<pthread_getattr_np>() is no "
4969 "longer required, it should be destroyed using B<pthread_attr_destroy>(3)."
4973 #: build/C/man3/pthread_getattr_np.3:74
4974 #: build/C/man3/pthread_getcpuclockid.3:47
4976 "On success, this function returns 0; on error, it returns a nonzero error "
4980 #. Can happen (but unlikely) while trying to allocate memory for cpuset
4982 #: build/C/man3/pthread_getattr_np.3:79
4983 msgid "Insufficient memory."
4987 #: build/C/man3/pthread_getattr_np.3:94
4989 "In addition, if I<thread> refers to the main thread, then "
4990 "B<pthread_getattr_np>() can fail because of errors from various underlying "
4991 "calls: B<fopen>(3), if I</proc/self/maps> can't be opened; and B<getrlimit>"
4992 "(2), if the B<RLIMIT_STACK> resource limit is not supported."
4996 #: build/C/man3/pthread_getattr_np.3:96
4997 msgid "This function is available in glibc since version 2.2.3."
5001 #: build/C/man3/pthread_getattr_np.3:99
5002 #: build/C/man3/pthread_kill_other_threads_np.3:48
5004 "This function is a nonstandard GNU extension; hence the suffix \"_np"
5005 "\" (nonportable) in the name."
5009 #: build/C/man3/pthread_getattr_np.3:109
5011 "The program below demonstrates the use of B<pthread_getattr_np>(). The "
5012 "program creates a thread that then uses B<pthread_getattr_np>() to retrieve "
5013 "and display its guard size, stack address, and stack size attributes. "
5014 "Command-line arguments can be used to set these attributes to values other "
5015 "than the default when creating the thread. The shell sessions below "
5016 "demonstrate the use of the program."
5020 #: build/C/man3/pthread_getattr_np.3:112
5022 "In the first run, on an x86-32 system, a thread is created using default "
5027 #: build/C/man3/pthread_getattr_np.3:122
5030 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2MB\n"
5033 "Attributes of created thread:\n"
5034 " Guard size = 4096 bytes\n"
5035 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
5036 " Stack size = 0x201000 (2101248) bytes\n"
5038 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2MB\n"
5041 "Attributes of created thread:\n"
5042 " Guard size = 4096 bytes\n"
5043 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
5044 " Stack size = 0x201000 (2101248) bytes\n"
5047 #: build/C/man3/pthread_getattr_np.3:128
5049 "In the following run, we see that if a guard size is specified, it is "
5050 "rounded up to the next multiple of the system page size (4096 bytes on "
5055 #: build/C/man3/pthread_getattr_np.3:136
5058 "$B< ./a.out -g 4097>\n"
5059 "Thread attributes object after initializations:\n"
5060 " Guard size = 4097 bytes\n"
5061 " Stack address = (nil)\n"
5062 " Stack size = 0x0 (0) bytes\n"
5064 "$B< ./a.out -g 4097>\n"
5065 "Thread attributes object after initializations:\n"
5066 " Guard size = 4097 bytes\n"
5067 " Stack address = (nil)\n"
5068 " Stack size = 0x0 (0) bytes\n"
5071 #: build/C/man3/pthread_getattr_np.3:141
5074 "Attributes of created thread:\n"
5075 " Guard size = 8192 bytes\n"
5076 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
5077 " Stack size = 0x201000 (2101248) bytes\n"
5079 "Attributes of created thread:\n"
5080 " Guard size = 8192 bytes\n"
5081 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
5082 " Stack size = 0x201000 (2101248) bytes\n"
5086 #. $ ./a.out \-s 0x8000
5087 #. Thread attributes object after initializations:
5088 #. Guard size = 4096 bytes
5089 #. Stack address = 0xffff8000 (EOS = (nil))
5090 #. Stack size = 0x8000 (32768) bytes
5091 #. Attributes of created thread:
5092 #. Guard size = 4096 bytes
5093 #. Stack address = 0x4001e000 (EOS = 0x40026000)
5094 #. Stack size = 0x8000 (32768) bytes
5098 #: build/C/man3/pthread_getattr_np.3:160
5100 "In the last run, the program manually allocates a stack for the thread. In "
5101 "this case, the guard size attribute is ignored."
5105 #: build/C/man3/pthread_getattr_np.3:165
5108 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
5109 "Allocated thread stack at 0x804d000\n"
5111 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
5112 "Allocated thread stack at 0x804d000\n"
5115 #: build/C/man3/pthread_getattr_np.3:170
5118 "Thread attributes object after initializations:\n"
5119 " Guard size = 4096 bytes\n"
5120 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
5121 " Stack size = 0x8000 (32768) bytes\n"
5123 "Thread attributes object after initializations:\n"
5124 " Guard size = 4096 bytes\n"
5125 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
5126 " Stack size = 0x8000 (32768) bytes\n"
5129 #: build/C/man3/pthread_getattr_np.3:175
5132 "Attributes of created thread:\n"
5133 " Guard size = 0 bytes\n"
5134 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
5135 " Stack size = 0x8000 (32768) bytes\n"
5137 "Attributes of created thread:\n"
5138 " Guard size = 0 bytes\n"
5139 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
5140 " Stack size = 0x8000 (32768) bytes\n"
5143 #: build/C/man3/pthread_getattr_np.3:196
5147 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
5150 " size_t stack_size, guard_size;\n"
5151 " void *stack_addr;\n"
5154 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
5157 " size_t stack_size, guard_size;\n"
5158 " void *stack_addr;\n"
5161 #: build/C/man3/pthread_getattr_np.3:201
5164 " s = pthread_attr_getguardsize(attr, &guard_size);\n"
5166 " handle_error_en(s, \"pthread_attr_getguardsize\");\n"
5167 " printf(\"%sGuard size = %d bytes\\en\", prefix, guard_size);\n"
5169 " s = pthread_attr_getguardsize(attr, &guard_size);\n"
5171 " handle_error_en(s, \"pthread_attr_getguardsize\");\n"
5172 " printf(\"%sGuard size = %d bytes\\en\", prefix, guard_size);\n"
5175 #: build/C/man3/pthread_getattr_np.3:212
5178 " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
5180 " handle_error_en(s, \"pthread_attr_getstack\");\n"
5181 " printf(\"%sStack address = %p\", prefix, stack_addr);\n"
5182 " if (stack_size E<gt> 0)\n"
5183 " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
5184 " printf(\"\\en\");\n"
5185 " printf(\"%sStack size = 0x%x (%d) bytes\\en\",\n"
5186 " prefix, stack_size, stack_size);\n"
5189 " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
5191 " handle_error_en(s, \"pthread_attr_getstack\");\n"
5192 " printf(\"%sStack address = %p\", prefix, stack_addr);\n"
5193 " if (stack_size E<gt> 0)\n"
5194 " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
5195 " printf(\"\\en\");\n"
5196 " printf(\"%sStack size = 0x%x (%d) bytes\\en\",\n"
5197 " prefix, stack_size, stack_size);\n"
5201 #: build/C/man3/pthread_getattr_np.3:218
5205 "display_thread_attributes(pthread_t thread, char *prefix)\n"
5208 " pthread_attr_t attr;\n"
5211 "display_thread_attributes(pthread_t thread, char *prefix)\n"
5214 " pthread_attr_t attr;\n"
5217 #: build/C/man3/pthread_getattr_np.3:222
5220 " s = pthread_getattr_np(thread, &attr);\n"
5222 " handle_error_en(s, \"pthread_getattr_np\");\n"
5224 " s = pthread_getattr_np(thread, &attr);\n"
5226 " handle_error_en(s, \"pthread_getattr_np\");\n"
5229 #: build/C/man3/pthread_getattr_np.3:224
5231 msgid " display_stack_related_attributes(&attr, prefix);\n"
5232 msgstr " display_stack_related_attributes(&attr, prefix);\n"
5235 #: build/C/man3/pthread_getattr_np.3:229
5238 " s = pthread_attr_destroy(&attr);\n"
5240 " handle_error_en(s, \"pthread_attr_destroy\");\n"
5243 " s = pthread_attr_destroy(&attr);\n"
5245 " handle_error_en(s, \"pthread_attr_destroy\");\n"
5249 #: build/C/man3/pthread_getattr_np.3:235
5252 "static void * /* Start function for thread we create */\n"
5253 "thread_start(void *arg)\n"
5255 " printf(\"Attributes of created thread:\\en\");\n"
5256 " display_thread_attributes(pthread_self(), \"\\et\");\n"
5258 "static void * /* Start function for thread we create */\n"
5259 "thread_start(void *arg)\n"
5261 " printf(\"Attributes of created thread:\\en\");\n"
5262 " display_thread_attributes(pthread_self(), \"\\et\");\n"
5265 #: build/C/man3/pthread_getattr_np.3:249
5269 "usage(char *pname, char *msg)\n"
5271 " if (msg != NULL)\n"
5272 " fputs(msg, stderr);\n"
5273 " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
5274 " \" [-g guard-size]\\en\", pname);\n"
5275 " fprintf(stderr, \"\\et\\et-a means program should allocate stack\\en\");\n"
5276 " exit(EXIT_FAILURE);\n"
5280 "usage(char *pname, char *msg)\n"
5282 " if (msg != NULL)\n"
5283 " fputs(msg, stderr);\n"
5284 " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
5285 " \" [-g guard-size]\\en\", pname);\n"
5286 " fprintf(stderr, \"\\et\\et-a means program should allocate stack\\en\");\n"
5287 " exit(EXIT_FAILURE);\n"
5291 #: build/C/man3/pthread_getattr_np.3:262
5294 "static pthread_attr_t * /* Get thread attributes from command line */\n"
5295 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
5296 " pthread_attr_t *attrp)\n"
5298 " int s, opt, allocate_stack;\n"
5299 " long stack_size, guard_size;\n"
5300 " void *stack_addr;\n"
5301 " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n"
5302 " a thread attributes object */\n"
5303 " allocate_stack = 0;\n"
5304 " stack_size = -1;\n"
5305 " guard_size = -1;\n"
5307 "static pthread_attr_t * /* Get thread attributes from command line */\n"
5308 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
5309 " pthread_attr_t *attrp)\n"
5311 " int s, opt, allocate_stack;\n"
5312 " long stack_size, guard_size;\n"
5313 " void *stack_addr;\n"
5314 " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n"
5315 " a thread attributes object */\n"
5316 " allocate_stack = 0;\n"
5317 " stack_size = -1;\n"
5318 " guard_size = -1;\n"
5321 #: build/C/man3/pthread_getattr_np.3:271
5324 " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
5326 " case \\(aqa\\(aq: allocate_stack = 1; break;\n"
5327 " case \\(aqg\\(aq: guard_size = strtoul(optarg, NULL, 0); break;\n"
5328 " case \\(aqs\\(aq: stack_size = strtoul(optarg, NULL, 0); break;\n"
5329 " default: usage(argv[0], NULL);\n"
5333 " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
5335 " case \\(aqa\\(aq: allocate_stack = 1; break;\n"
5336 " case \\(aqg\\(aq: guard_size = strtoul(optarg, NULL, 0); break;\n"
5337 " case \\(aqs\\(aq: stack_size = strtoul(optarg, NULL, 0); break;\n"
5338 " default: usage(argv[0], NULL);\n"
5343 #: build/C/man3/pthread_getattr_np.3:274
5346 " if (allocate_stack && stack_size == -1)\n"
5347 " usage(argv[0], \"Specifying -a without -s makes no sense\\en\");\n"
5349 " if (allocate_stack && stack_size == -1)\n"
5350 " usage(argv[0], \"Specifying -a without -s makes no sense\\en\");\n"
5353 #: build/C/man3/pthread_getattr_np.3:277
5356 " if (argc E<gt> optind)\n"
5357 " usage(argv[0], \"Extraneous command-line arguments\\en\");\n"
5359 " if (argc E<gt> optind)\n"
5360 " usage(argv[0], \"Extraneous command-line arguments\\en\");\n"
5363 #: build/C/man3/pthread_getattr_np.3:280
5366 " if (stack_size E<gt>= 0 || guard_size E<gt> 0) {\n"
5367 " ret_attrp = attrp;\n"
5369 " if (stack_size E<gt>= 0 || guard_size E<gt> 0) {\n"
5370 " ret_attrp = attrp;\n"
5373 #: build/C/man3/pthread_getattr_np.3:285
5376 " s = pthread_attr_init(attrp);\n"
5378 " handle_error_en(s, \"pthread_attr_init\");\n"
5381 " s = pthread_attr_init(attrp);\n"
5383 " handle_error_en(s, \"pthread_attr_init\");\n"
5387 #: build/C/man3/pthread_getattr_np.3:297
5390 " if (stack_size E<gt>= 0) {\n"
5391 " if (!allocate_stack) {\n"
5392 " s = pthread_attr_setstacksize(attrp, stack_size);\n"
5394 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5396 " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
5399 " handle_error_en(s, \"posix_memalign\");\n"
5400 " printf(\"Allocated thread stack at %p\\en\\en\", stack_addr);\n"
5402 " if (stack_size E<gt>= 0) {\n"
5403 " if (!allocate_stack) {\n"
5404 " s = pthread_attr_setstacksize(attrp, stack_size);\n"
5406 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5408 " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
5411 " handle_error_en(s, \"posix_memalign\");\n"
5412 " printf(\"Allocated thread stack at %p\\en\\en\", stack_addr);\n"
5415 #: build/C/man3/pthread_getattr_np.3:303
5418 " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
5420 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5424 " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
5426 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5431 #: build/C/man3/pthread_getattr_np.3:309
5434 " if (guard_size E<gt>= 0) {\n"
5435 " s = pthread_attr_setguardsize(attrp, guard_size);\n"
5437 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5440 " if (guard_size E<gt>= 0) {\n"
5441 " s = pthread_attr_setguardsize(attrp, guard_size);\n"
5443 " handle_error_en(s, \"pthread_attr_setstacksize\");\n"
5447 #: build/C/man3/pthread_getattr_np.3:312
5450 " return ret_attrp;\n"
5453 " return ret_attrp;\n"
5457 #: build/C/man3/pthread_getattr_np.3:321
5461 "main(int argc, char *argv[])\n"
5465 " pthread_attr_t attr;\n"
5466 " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n"
5467 " a thread attributes object */\n"
5470 "main(int argc, char *argv[])\n"
5474 " pthread_attr_t attr;\n"
5475 " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n"
5476 " a thread attributes object */\n"
5479 #: build/C/man3/pthread_getattr_np.3:323
5481 msgid " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
5482 msgstr " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
5485 #: build/C/man3/pthread_getattr_np.3:329
5488 " if (attrp != NULL) {\n"
5489 " printf(\"Thread attributes object after initializations:\\en\");\n"
5490 " display_stack_related_attributes(attrp, \"\\et\");\n"
5491 " printf(\"\\en\");\n"
5494 " if (attrp != NULL) {\n"
5495 " printf(\"Thread attributes object after initializations:\\en\");\n"
5496 " display_stack_related_attributes(attrp, \"\\et\");\n"
5497 " printf(\"\\en\");\n"
5501 #: build/C/man3/pthread_getattr_np.3:357
5503 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
5504 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
5505 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
5506 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
5507 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
5508 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
5510 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
5511 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
5512 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
5513 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
5514 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
5515 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
5518 #: build/C/man3/pthread_getcpuclockid.3:24
5520 msgid "PTHREAD_GETCPUCLOCKID"
5521 msgstr "PTHREAD_GETCPUCLOCKID"
5524 #: build/C/man3/pthread_getcpuclockid.3:24
5530 #: build/C/man3/pthread_getcpuclockid.3:27
5531 msgid "pthread_getcpuclockid - retrieve ID of a thread's CPU time clock"
5535 #: build/C/man3/pthread_getcpuclockid.3:31
5538 "B<#include E<lt>pthread.hE<gt>>\n"
5539 "B<#include E<lt>time.hE<gt>>\n"
5541 "B<#include E<lt>pthread.hE<gt>>\n"
5542 "B<#include E<lt>time.hE<gt>>\n"
5545 #: build/C/man3/pthread_getcpuclockid.3:33
5547 msgid "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t *>I<clock_id);>\n"
5548 msgstr "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t *>I<clock_id);>\n"
5550 #. The clockid is constructed as follows:
5551 #. *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE)
5552 #. where CLOCK_IDFIELD_SIZE is 3.
5554 #: build/C/man3/pthread_getcpuclockid.3:44
5556 "The B<pthread_getcpuclockid>() function returns the clock ID for the CPU "
5557 "time clock of the thread I<thread>."
5561 #: build/C/man3/pthread_getcpuclockid.3:48
5566 #. CLOCK_THREAD_CPUTIME_ID not defined
5567 #. Looking at nptl/pthread_getcpuclockid.c an ERANGE error would
5568 #. be possible if kernel thread IDs took more than 29 bits (which
5569 #. they currently cannot).
5571 #: build/C/man3/pthread_getcpuclockid.3:56
5572 msgid "Per-thread CPU time clocks are not supported by the system."
5576 #: build/C/man3/pthread_getcpuclockid.3:63
5577 msgid "This function is available in glibc since version 2.2."
5581 #: build/C/man3/pthread_getcpuclockid.3:76
5583 "When I<thread> refers to the calling thread, this function returns an "
5584 "identifier that refers to the same clock manipulated by B<clock_gettime>(2) "
5585 "and B<clock_settime>(2) when given the clock ID B<CLOCK_THREAD_CPUTIME_ID>."
5589 #: build/C/man3/pthread_getcpuclockid.3:82
5591 "The program below creates a thread and then uses B<clock_gettime>(2) to "
5592 "retrieve the total process CPU time, and the per-thread CPU time consumed by "
5593 "the two threads. The following shell session shows an example run:"
5597 #: build/C/man3/pthread_getcpuclockid.3:91
5601 "Main thread sleeping\n"
5602 "Subthread starting infinite loop\n"
5603 "Main thread consuming some CPU time...\n"
5604 "Process total CPU time: 1.368\n"
5605 "Main thread CPU time: 0.376\n"
5606 "Subthread CPU time: 0.992\n"
5609 "Main thread sleeping\n"
5610 "Subthread starting infinite loop\n"
5611 "Main thread consuming some CPU time...\n"
5612 "Process total CPU time: 1.368\n"
5613 "Main thread CPU time: 0.376\n"
5614 "Subthread CPU time: 0.992\n"
5617 #: build/C/man3/pthread_getcpuclockid.3:97
5619 msgid "/* Link with \"-lrt\" */\n"
5623 #: build/C/man3/pthread_getcpuclockid.3:105
5626 "#include E<lt>time.hE<gt>\n"
5627 "#include E<lt>stdio.hE<gt>\n"
5628 "#include E<lt>stdlib.hE<gt>\n"
5629 "#include E<lt>unistd.hE<gt>\n"
5630 "#include E<lt>pthread.hE<gt>\n"
5631 "#include E<lt>string.hE<gt>\n"
5632 "#include E<lt>errno.hE<gt>\n"
5634 "#include E<lt>time.hE<gt>\n"
5635 "#include E<lt>stdio.hE<gt>\n"
5636 "#include E<lt>stdlib.hE<gt>\n"
5637 "#include E<lt>unistd.hE<gt>\n"
5638 "#include E<lt>pthread.hE<gt>\n"
5639 "#include E<lt>string.hE<gt>\n"
5640 "#include E<lt>errno.hE<gt>\n"
5643 #: build/C/man3/pthread_getcpuclockid.3:119
5647 "thread_start(void *arg)\n"
5649 " printf(\"Subthread starting infinite loop\\en\");\n"
5655 "thread_start(void *arg)\n"
5657 " printf(\"Subthread starting infinite loop\\en\");\n"
5663 #: build/C/man3/pthread_getcpuclockid.3:124
5667 "pclock(char *msg, clockid_t cid)\n"
5669 " struct timespec ts;\n"
5672 "pclock(char *msg, clockid_t cid)\n"
5674 " struct timespec ts;\n"
5677 #: build/C/man3/pthread_getcpuclockid.3:130
5680 " printf(\"%s\", msg);\n"
5681 " if (clock_gettime(cid, &ts) == -1)\n"
5682 " handle_error(\"clock_gettime\");\n"
5683 " printf(\"%4ld.%03ld\\en\", ts.tv_sec, ts.tv_nsec / 1000000);\n"
5686 " printf(\"%s\", msg);\n"
5687 " if (clock_gettime(cid, &ts) == -1)\n"
5688 " handle_error(\"clock_gettime\");\n"
5689 " printf(\"%4ld.%03ld\\en\", ts.tv_sec, ts.tv_nsec / 1000000);\n"
5693 #: build/C/man3/pthread_getcpuclockid.3:137
5697 "main(int argc, char *argv[])\n"
5699 " pthread_t thread;\n"
5704 "main(int argc, char *argv[])\n"
5706 " pthread_t thread;\n"
5711 #: build/C/man3/pthread_getcpuclockid.3:141
5714 " s = pthread_create(&thread, NULL, thread_start, NULL);\n"
5716 " handle_error_en(s, \"pthread_create\");\n"
5718 " s = pthread_create(&thread, NULL, thread_start, NULL);\n"
5720 " handle_error_en(s, \"pthread_create\");\n"
5723 #: build/C/man3/pthread_getcpuclockid.3:144
5726 " printf(\"Main thread sleeping\\en\");\n"
5729 " printf(\"Main thread sleeping\\en\");\n"
5733 #: build/C/man3/pthread_getcpuclockid.3:148
5736 " printf(\"Main thread consuming some CPU time...\\en\");\n"
5737 " for (j = 0; j E<lt> 2000000; j++)\n"
5740 " printf(\"Main thread consuming some CPU time...\\en\");\n"
5741 " for (j = 0; j E<lt> 2000000; j++)\n"
5745 #: build/C/man3/pthread_getcpuclockid.3:150
5747 msgid " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
5748 msgstr " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
5751 #: build/C/man3/pthread_getcpuclockid.3:155
5754 " s = pthread_getcpuclockid(pthread_self(), &cid);\n"
5756 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
5757 " pclock(\"Main thread CPU time: \", cid);\n"
5759 " s = pthread_getcpuclockid(pthread_self(), &cid);\n"
5761 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
5762 " pclock(\"Main thread CPU time: \", cid);\n"
5765 #: build/C/man3/pthread_getcpuclockid.3:158
5768 " /* The preceding 4 lines of code could have been replaced by:\n"
5769 " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n"
5771 " /* The preceding 4 lines of code could have been replaced by:\n"
5772 " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n"
5775 #: build/C/man3/pthread_getcpuclockid.3:163
5778 " s = pthread_getcpuclockid(thread, &cid);\n"
5780 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
5781 " pclock(\"Subthread CPU time: 1 \", cid);\n"
5783 " s = pthread_getcpuclockid(thread, &cid);\n"
5785 " handle_error_en(s, \"pthread_getcpuclockid\");\n"
5786 " pclock(\"Subthread CPU time: 1 \", cid);\n"
5789 #: build/C/man3/pthread_getcpuclockid.3:166
5792 " exit(EXIT_SUCCESS); /* Terminates both threads */\n"
5795 " exit(EXIT_SUCCESS); /* Terminates both threads */\n"
5799 #: build/C/man3/pthread_getcpuclockid.3:175
5801 "B<clock_gettime>(2), B<clock_settime>(2), B<timer_create>(2), "
5802 "B<clock_getcpuclockid>(3), B<pthread_self>(3), B<pthreads>(7), B<time>(7)"
5804 "B<clock_gettime>(2), B<clock_settime>(2), B<timer_create>(2), "
5805 "B<clock_getcpuclockid>(3), B<pthread_self>(3), B<pthreads>(7), B<time>(7)"
5808 #: build/C/man3/pthread_join.3:24
5810 msgid "PTHREAD_JOIN"
5811 msgstr "PTHREAD_JOIN"
5814 #: build/C/man3/pthread_join.3:27
5815 msgid "pthread_join - join with a terminated thread"
5819 #: build/C/man3/pthread_join.3:32
5821 msgid "B<int pthread_join(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
5822 msgstr "B<int pthread_join(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
5825 #: build/C/man3/pthread_join.3:47
5827 "The B<pthread_join>() function waits for the thread specified by I<thread> "
5828 "to terminate. If that thread has already terminated, then B<pthread_join>"
5829 "() returns immediately. The thread specified by I<thread> must be joinable."
5833 #: build/C/man3/pthread_join.3:61
5835 "If I<retval> is not NULL, then B<pthread_join>() copies the exit status of "
5836 "the target thread (i.e., the value that the target thread supplied to "
5837 "B<pthread_exit>(3)) into the location pointed to by I<*retval>. If the "
5838 "target thread was canceled, then B<PTHREAD_CANCELED> is placed in I<*retval>."
5842 #: build/C/man3/pthread_join.3:68
5844 "If multiple threads simultaneously try to join with the same thread, the "
5845 "results are undefined. If the thread calling B<pthread_join>() is "
5846 "canceled, then the target thread will remain joinable (i.e., it will not be "
5851 #: build/C/man3/pthread_join.3:73
5853 "On success, B<pthread_join>() returns 0; on error, it returns an error "
5858 #: build/C/man3/pthread_join.3:74
5863 #. The following verified by testing on glibc 2.8/NPTL:
5864 #. The following verified by testing on glibc 2.8/NPTL:
5866 #: build/C/man3/pthread_join.3:83
5868 "A deadlock was detected (e.g., two threads tried to join with each other); "
5869 "or I<thread> specifies the calling thread."
5872 #. POSIX.1-2001 does not specify this error case.
5874 #: build/C/man3/pthread_join.3:91
5875 msgid "Another thread is already waiting to join with this thread."
5879 #: build/C/man3/pthread_join.3:102
5881 "After a successful call to B<pthread_join>(), the caller is guaranteed that "
5882 "the target thread has terminated."
5886 #: build/C/man3/pthread_join.3:105
5888 "Joining with a thread that has previously been joined results in undefined "
5893 #: build/C/man3/pthread_join.3:113
5895 "Failure to join with a thread that is joinable (i.e., one that is not "
5896 "detached), produces a \"zombie thread\". Avoid doing this, since each "
5897 "zombie thread consumes some system resources, and when enough zombie threads "
5898 "have accumulated, it will no longer be possible to create new threads (or "
5903 #: build/C/man3/pthread_join.3:119
5905 "There is no pthreads analog of I<waitpid(-1,\\ &status,\\ 0)>, that is, "
5906 "\"join with any terminated thread\". If you believe you need this "
5907 "functionality, you probably need to rethink your application design."
5911 #: build/C/man3/pthread_join.3:122
5913 "All of the threads in a process are peers: any thread can join with any "
5914 "other thread in the process."
5918 #: build/C/man3/pthread_join.3:132
5920 "B<pthread_cancel>(3), B<pthread_create>(3), B<pthread_detach>(3), "
5921 "B<pthread_exit>(3), B<pthread_tryjoin_np>(3), B<pthreads>(7)"
5923 "B<pthread_cancel>(3), B<pthread_create>(3), B<pthread_detach>(3), "
5924 "B<pthread_exit>(3), B<pthread_tryjoin_np>(3), B<pthreads>(7)"
5927 #: build/C/man3/pthread_kill.3:24
5929 msgid "PTHREAD_KILL"
5930 msgstr "PTHREAD_KILL"
5933 #: build/C/man3/pthread_kill.3:24
5939 #: build/C/man3/pthread_kill.3:27
5940 msgid "pthread_kill - send a signal to a thread"
5944 #: build/C/man3/pthread_kill.3:30 build/C/man3/pthread_sigmask.3:30
5946 msgid "B<#include E<lt>signal.hE<gt>>\n"
5947 msgstr "B<#include E<lt>signal.hE<gt>>\n"
5950 #: build/C/man3/pthread_kill.3:32
5952 msgid "B<int pthread_kill(pthread_t >I<thread>B<, int >I<sig>B<);>\n"
5953 msgstr "B<int pthread_kill(pthread_t >I<thread>B<, int >I<sig>B<);>\n"
5956 #: build/C/man3/pthread_kill.3:45
5958 "The B<pthread_kill>() function sends the signal I<sig> to I<thread>, "
5959 "another thread in the same process as the caller. The signal is "
5960 "asynchronously directed to I<thread>."
5964 #: build/C/man3/pthread_kill.3:50
5966 "If I<sig> is 0, then no signal is sent, but error checking is still "
5967 "performed; this can be used to check for the existence of a thread ID."
5971 #: build/C/man3/pthread_kill.3:55
5973 "On success, B<pthread_kill>() returns 0; on error, it returns an error "
5974 "number, and no signal is sent."
5978 #: build/C/man3/pthread_kill.3:59
5979 msgid "An invalid signal was specified."
5983 #: build/C/man3/pthread_kill.3:73
5985 "Signal dispositions are process-wide: if a signal handler is installed, the "
5986 "handler will be invoked in the thread I<thread>, but if the disposition of "
5987 "the signal is \"stop\", \"continue\", or \"terminate\", this action will "
5988 "affect the whole process."
5992 #: build/C/man3/pthread_kill.3:82
5994 "B<kill>(2) B<sigaction>(2), B<sigpending>(2), B<pthread_self>(3), "
5995 "B<pthread_sigmask>(3), B<raise>(3), B<pthreads>(7), B<signal>(7)"
5997 "B<kill>(2) B<sigaction>(2), B<sigpending>(2), B<pthread_self>(3), "
5998 "B<pthread_sigmask>(3), B<raise>(3), B<pthreads>(7), B<signal>(7)"
6001 #: build/C/man3/pthread_kill_other_threads_np.3:24
6003 msgid "PTHREAD_KILL_OTHER_THREADS_NP"
6004 msgstr "PTHREAD_KILL_OTHER_THREADS_NP"
6007 #: build/C/man3/pthread_kill_other_threads_np.3:24
6013 #: build/C/man3/pthread_kill_other_threads_np.3:27
6014 msgid "pthread_kill_other_threads_np - terminate all other threads in process"
6018 #: build/C/man3/pthread_kill_other_threads_np.3:32
6020 msgid "B<void pthread_kill_other_threads_np(void);>\n"
6021 msgstr "B<void pthread_kill_other_threads_np(void);>\n"
6024 #. Available since glibc 2.0
6026 #: build/C/man3/pthread_kill_other_threads_np.3:45
6028 "B<pthread_kill_other_threads_np>() only has an effect in the LinuxThreads "
6029 "threading implementation. On that implementation, calling this function "
6030 "causes the immediate termination of all threads in the application, except "
6031 "the calling thread. The cancellation state and cancellation type of the to-"
6032 "be-terminated threads are ignored, and the cleanup handlers are not called "
6037 #: build/C/man3/pthread_kill_other_threads_np.3:57
6039 "B<pthread_kill_other_threads_np>() is intended to be called just before a "
6040 "thread calls B<execve>(2) or a similar function. This function is designed "
6041 "to address a limitation in the obsolete LinuxThreads implementation whereby "
6042 "the other threads of an application are not automatically terminated (as "
6043 "POSIX.1-2001 requires) during B<execve>(2)."
6047 #: build/C/man3/pthread_kill_other_threads_np.3:64
6049 "In the NPTL threading implementation, B<pthread_kill_other_threads_np>() "
6050 "exists, but does nothing. (Nothing needs to be done, because the "
6051 "implementation does the right thing during an B<execve>(2).)"
6055 #: build/C/man3/pthread_kill_other_threads_np.3:70
6057 "B<execve>(2), B<pthread_cancel>(3), B<pthread_setcancelstate>(3), "
6058 "B<pthread_setcanceltype>(3), B<pthreads>(7)"
6060 "B<execve>(2), B<pthread_cancel>(3), B<pthread_setcancelstate>(3), "
6061 "B<pthread_setcanceltype>(3), B<pthreads>(7)"
6064 #: build/C/man3/pthread_self.3:24
6066 msgid "PTHREAD_SELF"
6067 msgstr "PTHREAD_SELF"
6070 #: build/C/man3/pthread_self.3:27
6071 msgid "pthread_self - obtain ID of the calling thread"
6075 #: build/C/man3/pthread_self.3:32
6077 msgid "B<pthread_t pthread_self(void);>\n"
6078 msgstr "B<pthread_t pthread_self(void);>\n"
6081 #: build/C/man3/pthread_self.3:44
6083 "The B<pthread_self>() function returns the ID of the calling thread. This "
6084 "is the same value that is returned in I<*thread> in the B<pthread_create>"
6085 "(3) call that created this thread."
6089 #: build/C/man3/pthread_self.3:46
6090 msgid "This function always succeeds, returning the calling thread's ID."
6094 #: build/C/man3/pthread_self.3:61
6096 "POSIX.1 allows an implementation wide freedom in choosing the type used to "
6097 "represent a thread ID; for example, representation using either an "
6098 "arithmetic type or a structure is permitted. Therefore, variables of type "
6099 "I<pthread_t> can't portably be compared using the C equality operator "
6100 "(B<==>); use B<pthread_equal>(3) instead."
6104 #: build/C/man3/pthread_self.3:65
6106 "Thread identifiers should be considered opaque: any attempt to use a thread "
6107 "ID other than in pthreads calls is nonportable and can lead to unspecified "
6112 #: build/C/man3/pthread_self.3:69
6114 "Thread IDs are only guaranteed to be unique within a process. A thread ID "
6115 "may be reused after a terminated thread has been joined, or a detached "
6116 "thread has terminated."
6120 #: build/C/man3/pthread_self.3:74
6122 "The thread ID returned by B<pthread_self>() is not the same thing as the "
6123 "kernel thread ID returned by a call to B<gettid>(2)."
6127 #: build/C/man3/pthread_self.3:78
6128 msgid "B<pthread_create>(3), B<pthread_equal>(3), B<pthreads>(7)"
6129 msgstr "B<pthread_create>(3), B<pthread_equal>(3), B<pthreads>(7)"
6132 #: build/C/man3/pthread_setaffinity_np.3:24
6134 msgid "PTHREAD_SETAFFINITY_NP"
6135 msgstr "PTHREAD_SETAFFINITY_NP"
6138 #: build/C/man3/pthread_setaffinity_np.3:28
6140 "pthread_setaffinity_np, pthread_getaffinity_np - set/get CPU affinity of a "
6145 #: build/C/man3/pthread_setaffinity_np.3:37
6148 "B<int pthread_setaffinity_np(pthread_t >I<thread>B<, size_t >I<cpusetsize>B<,>\n"
6149 "B< const cpu_set_t *>I<cpuset>B<);>\n"
6150 "B<int pthread_getaffinity_np(pthread_t >I<thread>B<, size_t >I<cpusetsize>B<,>\n"
6151 "B< cpu_set_t *>I<cpuset>B<);>\n"
6153 "B<int pthread_setaffinity_np(pthread_t >I<thread>B<, size_t >I<cpusetsize>B<,>\n"
6154 "B< const cpu_set_t *>I<cpuset>B<);>\n"
6155 "B<int pthread_getaffinity_np(pthread_t >I<thread>B<, size_t >I<cpusetsize>B<,>\n"
6156 "B< cpu_set_t *>I<cpuset>B<);>\n"
6159 #: build/C/man3/pthread_setaffinity_np.3:52
6161 "The B<pthread_setaffinity_np>() function sets the CPU affinity mask of the "
6162 "thread I<thread> to the CPU set pointed to by I<cpuset>. If the call is "
6163 "successful, and the thread is not currently running on one of the CPUs in "
6164 "I<cpuset>, then it is migrated to one of those CPUs."
6168 #: build/C/man3/pthread_setaffinity_np.3:59
6170 "The B<pthread_getaffinity_np>() function returns the CPU affinity mask of "
6171 "the thread I<thread> in the buffer pointed to by I<cpuset>."
6175 #: build/C/man3/pthread_setaffinity_np.3:75
6177 "The argument I<cpusetsize> is the length (in bytes) of the buffer pointed to "
6178 "by I<cpuset>. Typically, this argument would be specified as I<sizeof"
6179 "(cpu_set_t)>. (It may be some other value, if using the macros described in "
6180 "B<CPU_SET>(3) for dynamically allocating a CPU set.)"
6184 #: build/C/man3/pthread_setaffinity_np.3:79
6190 #: build/C/man3/pthread_setaffinity_np.3:82
6191 msgid "A supplied memory address was invalid."
6195 #: build/C/man3/pthread_setaffinity_np.3:91
6197 "(B<pthread_setaffinity_np>()) The affinity bit mask I<mask> contains no "
6198 "processors that are currently physically on the system and permitted to the "
6199 "thread according to any restrictions that may be imposed by the \"cpuset\" "
6200 "mechanism described in B<cpuset>(7)."
6204 #. Loic Domaigne commented: it seems that in the future the
6205 #. kernel developers want to make cpumask_t dynamic, so
6206 #. CONFIG_NR_CPUS might become obsolete in the future.
6208 #. The raw sched_getaffinity() system call returns the size (in bytes)
6209 #. of the cpumask_t type.
6211 #: build/C/man3/pthread_setaffinity_np.3:107
6213 "(B<pthread_setaffinity_np>()) I<cpuset> specified a CPU that was outside "
6214 "the set supported by the kernel. (The kernel configuration option "
6215 "B<CONFIG_NR_CPUS> defines the range of the set supported by the kernel data "
6216 "type used to represent CPU sets.)"
6220 #: build/C/man3/pthread_setaffinity_np.3:112
6222 "(B<pthread_getaffinity_np>()) I<cpusetsize> is smaller than the size of the "
6223 "affinity mask used by the kernel."
6227 #: build/C/man3/pthread_setaffinity_np.3:135
6229 "After a call to B<pthread_setaffinity_np>(), the set of CPUs on which the "
6230 "thread will actually run is the intersection of the set specified in the "
6231 "I<cpuset> argument and the set of CPUs actually present on the system. The "
6232 "system may further restrict the set of CPUs on which the thread runs if the "
6233 "\"cpuset\" mechanism described in B<cpuset>(7) is being used. These "
6234 "restrictions on the actual set of CPUs on which the thread will run are "
6235 "silently imposed by the kernel."
6239 #: build/C/man3/pthread_setaffinity_np.3:141
6241 "These functions are implemented on top of the B<sched_setaffinity>(2) and "
6242 "B<sched_getaffinity>(2) system calls."
6246 #: build/C/man3/pthread_setaffinity_np.3:152
6248 "A new thread created by B<pthread_create>(3) inherits a copy of its "
6249 "creator's CPU affinity mask."
6253 #: build/C/man3/pthread_setaffinity_np.3:160
6255 "In the following program, the main thread uses B<pthread_setaffinity_np>() "
6256 "to set its CPU affinity mask to include CPUs 0 to 7 (which may not all be "
6257 "available on the system), and then calls B<pthread_getaffinity_np>() to "
6258 "check the resulting CPU affinity mask of the thread."
6262 #: build/C/man3/pthread_setaffinity_np.3:167
6265 "#define _GNU_SOURCE\n"
6266 "#include E<lt>pthread.hE<gt>\n"
6267 "#include E<lt>stdio.hE<gt>\n"
6268 "#include E<lt>stdlib.hE<gt>\n"
6269 "#include E<lt>errno.hE<gt>\n"
6271 "#define _GNU_SOURCE\n"
6272 "#include E<lt>pthread.hE<gt>\n"
6273 "#include E<lt>stdio.hE<gt>\n"
6274 "#include E<lt>stdlib.hE<gt>\n"
6275 "#include E<lt>errno.hE<gt>\n"
6278 #: build/C/man3/pthread_setaffinity_np.3:177
6282 "main(int argc, char *argv[])\n"
6285 " cpu_set_t cpuset;\n"
6286 " pthread_t thread;\n"
6289 "main(int argc, char *argv[])\n"
6292 " cpu_set_t cpuset;\n"
6293 " pthread_t thread;\n"
6296 #: build/C/man3/pthread_setaffinity_np.3:179
6298 msgid " thread = pthread_self();\n"
6299 msgstr " thread = pthread_self();\n"
6302 #: build/C/man3/pthread_setaffinity_np.3:181
6304 msgid " /* Set affinity mask to include CPUs 0 to 7 */\n"
6305 msgstr " /* Set affinity mask to include CPUs 0 to 7 */\n"
6308 #: build/C/man3/pthread_setaffinity_np.3:185
6311 " CPU_ZERO(&cpuset);\n"
6312 " for (j = 0; j E<lt> 8; j++)\n"
6313 " CPU_SET(j, &cpuset);\n"
6315 " CPU_ZERO(&cpuset);\n"
6316 " for (j = 0; j E<lt> 8; j++)\n"
6317 " CPU_SET(j, &cpuset);\n"
6320 #: build/C/man3/pthread_setaffinity_np.3:189
6323 " s = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
6325 " handle_error_en(s, \"pthread_setaffinity_np\");\n"
6327 " s = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
6329 " handle_error_en(s, \"pthread_setaffinity_np\");\n"
6332 #: build/C/man3/pthread_setaffinity_np.3:191
6334 msgid " /* Check the actual affinity mask assigned to the thread */\n"
6335 msgstr " /* Check the actual affinity mask assigned to the thread */\n"
6338 #: build/C/man3/pthread_setaffinity_np.3:195
6341 " s = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
6343 " handle_error_en(s, \"pthread_getaffinity_np\");\n"
6345 " s = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
6347 " handle_error_en(s, \"pthread_getaffinity_np\");\n"
6350 #: build/C/man3/pthread_setaffinity_np.3:200
6353 " printf(\"Set returned by pthread_getaffinity_np() contained:\\en\");\n"
6354 " for (j = 0; j E<lt> CPU_SETSIZE; j++)\n"
6355 " if (CPU_ISSET(j, &cpuset))\n"
6356 " printf(\" CPU %d\\en\", j);\n"
6358 " printf(\"Set returned by pthread_getaffinity_np() contained:\\en\");\n"
6359 " for (j = 0; j E<lt> CPU_SETSIZE; j++)\n"
6360 " if (CPU_ISSET(j, &cpuset))\n"
6361 " printf(\" CPU %d\\en\", j);\n"
6364 #: build/C/man3/pthread_setaffinity_np.3:203
6365 #: build/C/man3/pthread_setschedparam.3:428
6368 " exit(EXIT_SUCCESS);\n"
6371 " exit(EXIT_SUCCESS);\n"
6375 #: build/C/man3/pthread_setaffinity_np.3:212
6377 "B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
6378 "B<pthread_attr_setaffinity_np>(3), B<pthread_self>(3), B<sched_getcpu>(3), "
6379 "B<cpuset>(7), B<pthreads>(7)"
6381 "B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
6382 "B<pthread_attr_setaffinity_np>(3), B<pthread_self>(3), B<sched_getcpu>(3), "
6383 "B<cpuset>(7), B<pthreads>(7)"
6386 #: build/C/man3/pthread_setcancelstate.3:24
6388 msgid "PTHREAD_SETCANCELSTATE"
6389 msgstr "PTHREAD_SETCANCELSTATE"
6392 #: build/C/man3/pthread_setcancelstate.3:28
6394 "pthread_setcancelstate, pthread_setcanceltype - set cancelability state and "
6399 #: build/C/man3/pthread_setcancelstate.3:34
6402 "B<int pthread_setcancelstate(int >I<state>B<, int *>I<oldstate>B<);>\n"
6403 "B<int pthread_setcanceltype(int >I<type>B<, int *>I<oldtype>B<);>\n"
6405 "B<int pthread_setcancelstate(int >I<state>B<, int *>I<oldstate>B<);>\n"
6406 "B<int pthread_setcanceltype(int >I<type>B<, int *>I<oldtype>B<);>\n"
6409 #: build/C/man3/pthread_setcancelstate.3:49
6411 "The B<pthread_setcancelstate>() sets the cancelability state of the calling "
6412 "thread to the value given in I<state>. The previous cancelability state of "
6413 "the thread is returned in the buffer pointed to by I<oldstate>. The "
6414 "I<state> argument must have one of the following values:"
6418 #: build/C/man3/pthread_setcancelstate.3:49
6420 msgid "B<PTHREAD_CANCEL_ENABLE>"
6421 msgstr "B<PTHREAD_CANCEL_ENABLE>"
6424 #: build/C/man3/pthread_setcancelstate.3:56
6426 "The thread is cancelable. This is the default cancelability state in all "
6427 "new threads, including the initial thread. The thread's cancelability type "
6428 "determines when a cancelable thread will respond to a cancellation request."
6432 #: build/C/man3/pthread_setcancelstate.3:56
6434 msgid "B<PTHREAD_CANCEL_DISABLE>"
6435 msgstr "B<PTHREAD_CANCEL_DISABLE>"
6438 #: build/C/man3/pthread_setcancelstate.3:61
6440 "The thread is not cancelable. If a cancellation request is received, it is "
6441 "blocked until cancelability is enabled."
6445 #: build/C/man3/pthread_setcancelstate.3:73
6447 "The B<pthread_setcanceltype>() sets the cancelability type of the calling "
6448 "thread to the value given in I<type>. The previous cancelability type of "
6449 "the thread is returned in the buffer pointed to by I<oldtype>. The I<type> "
6450 "argument must have one of the following values:"
6454 #: build/C/man3/pthread_setcancelstate.3:73
6456 msgid "B<PTHREAD_CANCEL_DEFERRED>"
6457 msgstr "B<PTHREAD_CANCEL_DEFERRED>"
6460 #: build/C/man3/pthread_setcancelstate.3:80
6462 "A cancellation request is deferred until the thread next calls a function "
6463 "that is a cancellation point (see B<pthreads>(7)). This is the default "
6464 "cancelability type in all new threads, including the initial thread."
6468 #: build/C/man3/pthread_setcancelstate.3:80
6470 msgid "B<PTHREAD_CANCEL_ASYNCHRONOUS>"
6471 msgstr "B<PTHREAD_CANCEL_ASYNCHRONOUS>"
6474 #: build/C/man3/pthread_setcancelstate.3:86
6476 "The thread can be canceled at any time. (Typically, it will be canceled "
6477 "immediately upon receiving a cancellation request, but the system doesn't "
6482 #: build/C/man3/pthread_setcancelstate.3:90
6484 "The set-and-get operation performed by each of these functions is atomic "
6485 "with respect to other threads in the process calling the same function."
6489 #: build/C/man3/pthread_setcancelstate.3:97
6490 msgid "The B<pthread_setcancelstate>() can fail with the following error:"
6494 #: build/C/man3/pthread_setcancelstate.3:101
6495 msgid "Invalid value for I<state>."
6499 #: build/C/man3/pthread_setcancelstate.3:105
6500 msgid "The B<pthread_setcanceltype>() can fail with the following error:"
6504 #. Available since glibc 2.0
6506 #: build/C/man3/pthread_setcancelstate.3:111
6507 msgid "Invalid value for I<type>."
6511 #: build/C/man3/pthread_setcancelstate.3:116
6513 "For details of what happens when a thread is canceled, see B<pthread_cancel>"
6518 #: build/C/man3/pthread_setcancelstate.3:123
6520 "Briefly disabling cancelability is useful if a thread performs some critical "
6521 "action that must not be interrupted by a cancellation request. Beware of "
6522 "disabling cancelability for long periods, or around operations that may "
6523 "block for long periods, since that will render the thread unresponsive to "
6524 "cancellation requests."
6528 #: build/C/man3/pthread_setcancelstate.3:154
6530 "Setting the cancelability type to B<PTHREAD_CANCEL_ASYNCHRONOUS> is rarely "
6531 "useful. Since the thread could be canceled at I<any> time, it cannot safely "
6532 "reserve resources (e.g., allocating memory with B<malloc>(3)), acquire "
6533 "mutexes, semaphores, or locks, and so on. Reserving resources is unsafe "
6534 "because the application has no way of knowing what the state of these "
6535 "resources is when the thread is canceled; that is, did cancellation occur "
6536 "before the resources were reserved, while they were reserved, or after they "
6537 "were released? Furthermore, some internal data structures (e.g., the linked "
6538 "list of free blocks managed by the B<malloc>(3) family of functions) may be "
6539 "left in an inconsistent state if cancellation occurs in the middle of the "
6540 "function call. Consequently, clean-up handlers cease to be useful. "
6541 "Functions that can be safely asynchronously canceled are called I<async-"
6542 "cancel-safe functions>. POSIX.1-2001 only requires that B<pthread_cancel>"
6543 "(3), B<pthread_setcancelstate>(), and B<pthread_setcanceltype>() be async-"
6544 "cancel-safe. In general, other library functions can't be safely called "
6545 "from an asynchronously cancelable thread. One of the few circumstances in "
6546 "which asynchronous cancelability is useful is for cancellation of a thread "
6547 "that is in a pure compute-bound loop."
6550 #. It looks like at least Solaris, FreeBSD and Tru64 support this.
6552 #: build/C/man3/pthread_setcancelstate.3:172
6554 "The Linux threading implementations permit the I<oldstate> argument of "
6555 "B<pthread_setcancelstate>() to be NULL, in which case the information about "
6556 "the previous cancelability state is not returned to the caller. Many other "
6557 "implementations also permit a NULL I<oldstat> argument, but POSIX.1-2001 "
6558 "does not specify this point, so portable applications should always specify "
6559 "a non-NULL value in I<oldstate>. A precisely analogous set of statements "
6560 "applies for the I<oldtype> argument of B<pthread_setcanceltype>()."
6564 #: build/C/man3/pthread_setcancelstate.3:175
6565 msgid "See B<pthread_cancel>(3)."
6569 #: build/C/man3/pthread_setcancelstate.3:180
6571 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_testcancel>(3), "
6574 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_testcancel>(3), "
6578 #: build/C/man3/pthread_setconcurrency.3:23
6580 msgid "PTHREAD_SETCONCURRENCY"
6581 msgstr "PTHREAD_SETCONCURRENCY"
6584 #: build/C/man3/pthread_setconcurrency.3:23 build/C/man3/pthread_yield.3:23
6590 #: build/C/man3/pthread_setconcurrency.3:27
6592 "pthread_setconcurrency, pthread_getconcurrency - set/get the concurrency "
6597 #: build/C/man3/pthread_setconcurrency.3:33
6600 "B<int pthread_setconcurrency(int >I<new_level>B<);>\n"
6601 "B<int pthread_getconcurrency(void);>\n"
6603 "B<int pthread_setconcurrency(int >I<new_level>B<);>\n"
6604 "B<int pthread_getconcurrency(void);>\n"
6607 #: build/C/man3/pthread_setconcurrency.3:46
6609 "The B<pthread_setconcurrency>() function informs the implementation of the "
6610 "application's desired concurrency level, specified in I<new_level>. The "
6611 "implementation only takes this as a hint: POSIX.1 does not specify the level "
6612 "of concurrency that should be provided as a result of calling "
6613 "B<pthread_setconcurrency>()."
6617 #: build/C/man3/pthread_setconcurrency.3:51
6619 "Specifying I<new_level> as 0 instructs the implementation to manage the "
6620 "concurrency level as it deems appropriate."
6624 #: build/C/man3/pthread_setconcurrency.3:54
6626 "B<pthread_getconcurrency>() returns the current value of the concurrency "
6627 "level for this process."
6631 #: build/C/man3/pthread_setconcurrency.3:59
6633 "On success, B<pthread_setconcurrency>() returns 0; on error, it returns a "
6634 "nonzero error number."
6638 #: build/C/man3/pthread_setconcurrency.3:66
6640 "B<pthread_getconcurrency>() always succeeds, returning the concurrency "
6641 "level set by a previous call to B<pthread_setconcurrency>(), or 0, if "
6642 "B<pthread_setconcurrency>() has not previously been called."
6646 #: build/C/man3/pthread_setconcurrency.3:69
6647 msgid "B<pthread_setconcurrency>() can fail with the following error:"
6651 #: build/C/man3/pthread_setconcurrency.3:73
6652 msgid "I<new_level> is negative."
6656 #: build/C/man3/pthread_setconcurrency.3:79
6658 "POSIX.1-2001 also documents an B<EAGAIN> error (\"the value specified by "
6659 "I<new_level> would cause a system resource to be exceeded\")."
6663 #: build/C/man3/pthread_setconcurrency.3:81
6664 msgid "These functions are available in glibc since version 2.1."
6668 #: build/C/man3/pthread_setconcurrency.3:85
6669 msgid "The default concurrency level is 0."
6673 #: build/C/man3/pthread_setconcurrency.3:92
6675 "Concurrency levels are only meaningful for M:N threading implementations, "
6676 "where at any moment a subset of a process's set of user-level threads may be "
6677 "bound to a smaller number of kernel-scheduling entities. Setting the "
6678 "concurrency level allows the application to give the system a hint as to the "
6679 "number of kernel-scheduling entities that should be provided for efficient "
6680 "execution of the application."
6684 #: build/C/man3/pthread_setconcurrency.3:98
6686 "Both LinuxThreads and NPTL are 1:1 threading implementations, so setting the "
6687 "concurrency level has no meaning. In other words, on Linux these functions "
6688 "merely exist for compatibility with other systems, and they have no effect "
6689 "on the execution of a program."
6693 #: build/C/man3/pthread_setconcurrency.3:101
6694 msgid "B<pthread_attr_setscope>(3), B<pthreads>(7)"
6695 msgstr "B<pthread_attr_setscope>(3), B<pthreads>(7)"
6698 #: build/C/man3/pthread_setschedparam.3:24
6700 msgid "PTHREAD_SETSCHEDPARAM"
6701 msgstr "PTHREAD_SETSCHEDPARAM"
6704 #: build/C/man3/pthread_setschedparam.3:28
6706 "pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and "
6707 "parameters of a thread"
6711 #: build/C/man3/pthread_setschedparam.3:36
6714 "B<pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
6715 "B< const struct sched_param *>I<param>B<);>\n"
6716 "B<pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n"
6717 "B< struct sched_param *>I<param>B<);>\n"
6719 "B<pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
6720 "B< const struct sched_param *>I<param>B<);>\n"
6721 "B<pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n"
6722 "B< struct sched_param *>I<param>B<);>\n"
6725 #: build/C/man3/pthread_setschedparam.3:44
6727 "The B<pthread_setschedparam>() function sets the scheduling policy and "
6728 "parameters of the thread I<thread>."
6731 #. FIXME . pthread_setschedparam() places no restriction on the policy,
6732 #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
6733 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013
6735 #: build/C/man3/pthread_setschedparam.3:55
6737 "I<policy> specifies the new scheduling policy for I<thread>. The supported "
6738 "values for I<policy>, and their semantics, are described in "
6739 "B<sched_setscheduler>(2)."
6743 #: build/C/man3/pthread_setschedparam.3:61
6745 "The structure pointed to by I<param> specifies the new scheduling parameters "
6746 "for I<thread>. Scheduling parameters are maintained in the following "
6750 #. FIXME . nptl/pthread_setschedparam.c has the following
6751 #. /* If the thread should have higher priority because of some
6752 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
6753 #. Eventually (perhaps after writing the mutexattr pages), we
6754 #. may want to add something on the topic to this page.
6756 #: build/C/man3/pthread_setschedparam.3:102
6758 "The B<pthread_getschedparam>() function returns the scheduling policy and "
6759 "parameters of the thread I<thread>, in the buffers pointed to by I<policy> "
6760 "and I<param>, respectively. The returned priority value is that set by the "
6761 "most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or "
6762 "B<pthread_create>(3) call that affected I<thread>. The returned priority "
6763 "does not reflect any temporary priority adjustments as a result of calls to "
6764 "any priority inheritance or priority ceiling functions (see, for example, "
6765 "B<pthread_mutexattr_setprioceiling>(3) and B<pthread_mutexattr_setprotocol>"
6770 #: build/C/man3/pthread_setschedparam.3:110
6772 "On success, these functions return 0; on error, they return a nonzero error "
6773 "number. If B<pthread_setschedparam>() fails, the scheduling policy and "
6774 "parameters of I<thread> are not changed."
6778 #: build/C/man3/pthread_setschedparam.3:112
6779 msgid "Both of these functions can fail with the following error:"
6783 #: build/C/man3/pthread_setschedparam.3:120
6785 "B<pthread_setschedparam>() may additionally fail with the following errors:"
6789 #: build/C/man3/pthread_setschedparam.3:127
6791 "I<policy> is not a recognized policy, or I<param> does not make sense for "
6796 #: build/C/man3/pthread_setschedparam.3:131
6798 "The caller does not have appropriate privileges to set the specified "
6799 "scheduling policy and parameters."
6803 #. Available since glibc 2.0
6805 #: build/C/man3/pthread_setschedparam.3:139
6807 "POSIX.1-2001 also documents an B<ENOTSUP> (\"attempt was made to set the "
6808 "policy or scheduling parameters to an unsupported value\") error for "
6809 "B<pthread_setschedparam>()."
6813 #: build/C/man3/pthread_setschedparam.3:147
6815 "For a description of the permissions required to, and the effect of, "
6816 "changing a thread's scheduling policy and priority, and details of the "
6817 "permitted ranges for priorities in each scheduling policy, see "
6818 "B<sched_setscheduler>(2)."
6822 #: build/C/man3/pthread_setschedparam.3:154
6824 "The program below demonstrates the use of B<pthread_setschedparam>() and "
6825 "B<pthread_getschedparam>(), as well as the use of a number of other "
6826 "scheduling-related pthreads functions."
6830 #: build/C/man3/pthread_setschedparam.3:170
6832 "In the following run, the main thread sets its scheduling policy to "
6833 "B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes "
6834 "object with a scheduling policy attribute of B<SCHED_RR> and a scheduling "
6835 "priority attribute of 20. The program then sets (using "
6836 "B<pthread_attr_setinheritsched>(3)) the inherit scheduler attribute of the "
6837 "thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, meaning that threads "
6838 "created using this attributes object should take their scheduling attributes "
6839 "from the thread attributes object. The program then creates a thread using "
6840 "the thread attributes object, and that thread displays its scheduling policy "
6845 #: build/C/man3/pthread_setschedparam.3:178
6848 "$ B<su> # Need privilege to set real-time scheduling policies\n"
6850 "# B<./a.out -mf10 -ar20 -i e>\n"
6851 "Scheduler settings of main thread\n"
6852 " policy=SCHED_FIFO, priority=10\n"
6854 "$ B<su> # Need privilege to set real-time scheduling policies\n"
6856 "# B<./a.out -mf10 -ar20 -i e>\n"
6857 "Scheduler settings of main thread\n"
6858 " policy=SCHED_FIFO, priority=10\n"
6861 #: build/C/man3/pthread_setschedparam.3:182
6864 "Scheduler settings in \\(aqattr\\(aq\n"
6865 " policy=SCHED_RR, priority=20\n"
6866 " inheritsched is EXPLICIT\n"
6868 "Scheduler settings in \\(aqattr\\(aq\n"
6869 " policy=SCHED_RR, priority=20\n"
6870 " inheritsched is EXPLICIT\n"
6873 #: build/C/man3/pthread_setschedparam.3:185
6876 "Scheduler attributes of new thread\n"
6877 " policy=SCHED_RR, priority=20\n"
6879 "Scheduler attributes of new thread\n"
6880 " policy=SCHED_RR, priority=20\n"
6883 #: build/C/man3/pthread_setschedparam.3:190
6885 "In the above output, one can see that the scheduling policy and priority "
6886 "were taken from the values specified in the thread attributes object."
6890 #: build/C/man3/pthread_setschedparam.3:197
6892 "The next run is the same as the previous, except that the inherit scheduler "
6893 "attribute is set to B<PTHREAD_INHERIT_SCHED>, meaning that threads created "
6894 "using the thread attributes object should ignore the scheduling attributes "
6895 "specified in the attributes object and instead take their scheduling "
6896 "attributes from the creating thread."
6900 #: build/C/man3/pthread_setschedparam.3:203
6903 "# B<./a.out -mf10 -ar20 -i i>\n"
6904 "Scheduler settings of main thread\n"
6905 " policy=SCHED_FIFO, priority=10\n"
6907 "# B<./a.out -mf10 -ar20 -i i>\n"
6908 "Scheduler settings of main thread\n"
6909 " policy=SCHED_FIFO, priority=10\n"
6912 #: build/C/man3/pthread_setschedparam.3:207
6915 "Scheduler settings in \\(aqattr\\(aq\n"
6916 " policy=SCHED_RR, priority=20\n"
6917 " inheritsched is INHERIT\n"
6919 "Scheduler settings in \\(aqattr\\(aq\n"
6920 " policy=SCHED_RR, priority=20\n"
6921 " inheritsched is INHERIT\n"
6924 #: build/C/man3/pthread_setschedparam.3:210
6927 "Scheduler attributes of new thread\n"
6928 " policy=SCHED_FIFO, priority=10\n"
6930 "Scheduler attributes of new thread\n"
6931 " policy=SCHED_FIFO, priority=10\n"
6934 #: build/C/man3/pthread_setschedparam.3:216
6936 "In the above output, one can see that the scheduling policy and priority "
6937 "were taken from the creating thread, rather than the thread attributes "
6942 #: build/C/man3/pthread_setschedparam.3:222
6944 "Note that if we had omitted the I<-i\\ i> option, the output would have been "
6945 "the same, since B<PTHREAD_INHERIT_SCHED> is the default for the inherit "
6946 "scheduler attribute."
6950 #: build/C/man3/pthread_setschedparam.3:226
6952 msgid "/* pthreads_sched_test.c */\n"
6953 msgstr "/* pthreads_sched_test.c */\n"
6956 #: build/C/man3/pthread_setschedparam.3:232
6959 "#include E<lt>pthread.hE<gt>\n"
6960 "#include E<lt>stdio.hE<gt>\n"
6961 "#include E<lt>stdlib.hE<gt>\n"
6962 "#include E<lt>unistd.hE<gt>\n"
6963 "#include E<lt>errno.hE<gt>\n"
6965 "#include E<lt>pthread.hE<gt>\n"
6966 "#include E<lt>stdio.hE<gt>\n"
6967 "#include E<lt>stdlib.hE<gt>\n"
6968 "#include E<lt>unistd.hE<gt>\n"
6969 "#include E<lt>errno.hE<gt>\n"
6972 #: build/C/man3/pthread_setschedparam.3:241
6976 "usage(char *prog_name, char *msg)\n"
6978 " if (msg != NULL)\n"
6979 " fputs(msg, stderr);\n"
6982 "usage(char *prog_name, char *msg)\n"
6984 " if (msg != NULL)\n"
6985 " fputs(msg, stderr);\n"
6988 #: build/C/man3/pthread_setschedparam.3:258
6991 " fprintf(stderr, \"Usage: %s [options]\\en\", prog_name);\n"
6992 " fprintf(stderr, \"Options are:\\en\");\n"
6993 "#define fpe(msg) fprintf(stderr, \"\\et%s\", msg); /* Shorter */\n"
6994 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n"
6995 " fpe(\" thread attributes object\\en\");\n"
6996 " fpe(\" E<lt>policyE<gt> can be\\en\");\n"
6997 " fpe(\" f SCHED_FIFO\\en\");\n"
6998 " fpe(\" r SCHED_RR\\en\");\n"
6999 " fpe(\" o SCHED_OTHER\\en\");\n"
7000 " fpe(\"-A Use default thread attributes object\\en\");\n"
7001 " fpe(\"-i {e|s} Set inherit scheduler attribute to\\en\");\n"
7002 " fpe(\" \\(aqexplicit\\(aq or \\(aqinherit\\(aq\\en\");\n"
7003 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n"
7004 " fpe(\" main thread before pthread_create() call\\en\");\n"
7005 " exit(EXIT_FAILURE);\n"
7008 " fprintf(stderr, \"Usage: %s [options]\\en\", prog_name);\n"
7009 " fprintf(stderr, \"Options are:\\en\");\n"
7010 "#define fpe(msg) fprintf(stderr, \"\\et%s\", msg); /* Shorter */\n"
7011 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n"
7012 " fpe(\" thread attributes object\\en\");\n"
7013 " fpe(\" E<lt>policyE<gt> can be\\en\");\n"
7014 " fpe(\" f SCHED_FIFO\\en\");\n"
7015 " fpe(\" r SCHED_RR\\en\");\n"
7016 " fpe(\" o SCHED_OTHER\\en\");\n"
7017 " fpe(\"-A Use default thread attributes object\\en\");\n"
7018 " fpe(\"-i {e|s} Set inherit scheduler attribute to\\en\");\n"
7019 " fpe(\" \\(aqexplicit\\(aq or \\(aqinherit\\(aq\\en\");\n"
7020 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n"
7021 " fpe(\" main thread before pthread_create() call\\en\");\n"
7022 " exit(EXIT_FAILURE);\n"
7026 #: build/C/man3/pthread_setschedparam.3:269
7030 "get_policy(char p, int *policy)\n"
7033 " case \\(aqf\\(aq: *policy = SCHED_FIFO; return 1;\n"
7034 " case \\(aqr\\(aq: *policy = SCHED_RR; return 1;\n"
7035 " case \\(aqo\\(aq: *policy = SCHED_OTHER; return 1;\n"
7036 " default: return 0;\n"
7041 "get_policy(char p, int *policy)\n"
7044 " case \\(aqf\\(aq: *policy = SCHED_FIFO; return 1;\n"
7045 " case \\(aqr\\(aq: *policy = SCHED_RR; return 1;\n"
7046 " case \\(aqo\\(aq: *policy = SCHED_OTHER; return 1;\n"
7047 " default: return 0;\n"
7052 #: build/C/man3/pthread_setschedparam.3:280
7056 "display_sched_attr(int policy, struct sched_param *param)\n"
7058 " printf(\" policy=%s, priority=%d\\en\",\n"
7059 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
7060 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
7061 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
7063 " param-E<gt>sched_priority);\n"
7067 "display_sched_attr(int policy, struct sched_param *param)\n"
7069 " printf(\" policy=%s, priority=%d\\en\",\n"
7070 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
7071 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
7072 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
7074 " param-E<gt>sched_priority);\n"
7078 #: build/C/man3/pthread_setschedparam.3:286
7082 "display_thread_sched_attr(char *msg)\n"
7085 " struct sched_param param;\n"
7088 "display_thread_sched_attr(char *msg)\n"
7091 " struct sched_param param;\n"
7094 #: build/C/man3/pthread_setschedparam.3:290
7097 " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n"
7099 " handle_error_en(s, \"pthread_getschedparam\");\n"
7101 " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n"
7103 " handle_error_en(s, \"pthread_getschedparam\");\n"
7106 #: build/C/man3/pthread_setschedparam.3:294
7109 " printf(\"%s\\en\", msg);\n"
7110 " display_sched_attr(policy, ¶m);\n"
7113 " printf(\"%s\\en\", msg);\n"
7114 " display_sched_attr(policy, ¶m);\n"
7118 #: build/C/man3/pthread_setschedparam.3:299
7122 "thread_start(void *arg)\n"
7124 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
7127 "thread_start(void *arg)\n"
7129 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
7132 #: build/C/man3/pthread_setschedparam.3:302
7142 #: build/C/man3/pthread_setschedparam.3:312
7146 "main(int argc, char *argv[])\n"
7148 " int s, opt, inheritsched, use_null_attrib, policy;\n"
7149 " pthread_t thread;\n"
7150 " pthread_attr_t attr;\n"
7151 " pthread_attr_t *attrp;\n"
7152 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
7153 " struct sched_param param;\n"
7156 "main(int argc, char *argv[])\n"
7158 " int s, opt, inheritsched, use_null_attrib, policy;\n"
7159 " pthread_t thread;\n"
7160 " pthread_attr_t attr;\n"
7161 " pthread_attr_t *attrp;\n"
7162 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
7163 " struct sched_param param;\n"
7166 #: build/C/man3/pthread_setschedparam.3:314
7168 msgid " /* Process command-line options */\n"
7169 msgstr " /* Process command-line options */\n"
7172 #: build/C/man3/pthread_setschedparam.3:319
7175 " use_null_attrib = 0;\n"
7176 " attr_sched_str = NULL;\n"
7177 " main_sched_str = NULL;\n"
7178 " inheritsched_str = NULL;\n"
7180 " use_null_attrib = 0;\n"
7181 " attr_sched_str = NULL;\n"
7182 " main_sched_str = NULL;\n"
7183 " inheritsched_str = NULL;\n"
7186 #: build/C/man3/pthread_setschedparam.3:329
7189 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
7191 " case \\(aqa\\(aq: attr_sched_str = optarg; break;\n"
7192 " case \\(aqA\\(aq: use_null_attrib = 1; break;\n"
7193 " case \\(aqi\\(aq: inheritsched_str = optarg; break;\n"
7194 " case \\(aqm\\(aq: main_sched_str = optarg; break;\n"
7195 " default: usage(argv[0], \"Unrecognized option\\en\");\n"
7199 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
7201 " case \\(aqa\\(aq: attr_sched_str = optarg; break;\n"
7202 " case \\(aqA\\(aq: use_null_attrib = 1; break;\n"
7203 " case \\(aqi\\(aq: inheritsched_str = optarg; break;\n"
7204 " case \\(aqm\\(aq: main_sched_str = optarg; break;\n"
7205 " default: usage(argv[0], \"Unrecognized option\\en\");\n"
7210 #: build/C/man3/pthread_setschedparam.3:333
7213 " if (use_null_attrib &&\n"
7214 " (inheritsched_str != NULL || attr_sched_str != NULL))\n"
7215 " usage(argv[0], \"Can\\(aqt specify -A with -i or -a\\en\");\n"
7217 " if (use_null_attrib &&\n"
7218 " (inheritsched_str != NULL || attr_sched_str != NULL))\n"
7219 " usage(argv[0], \"Can\\(aqt specify -A with -i or -a\\en\");\n"
7222 #: build/C/man3/pthread_setschedparam.3:336
7225 " /* Optionally set scheduling attributes of main thread,\n"
7226 " and display the attributes */\n"
7228 " /* Optionally set scheduling attributes of main thread,\n"
7229 " and display the attributes */\n"
7232 #: build/C/man3/pthread_setschedparam.3:341
7235 " if (main_sched_str != NULL) {\n"
7236 " if (!get_policy(main_sched_str[0], &policy))\n"
7237 " usage(argv[0], \"Bad policy for main thread (-s)\\en\");\n"
7238 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
7240 " if (main_sched_str != NULL) {\n"
7241 " if (!get_policy(main_sched_str[0], &policy))\n"
7242 " usage(argv[0], \"Bad policy for main thread (-s)\\en\");\n"
7243 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
7246 #: build/C/man3/pthread_setschedparam.3:346
7249 " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n"
7251 " handle_error_en(s, \"pthread_setschedparam\");\n"
7254 " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n"
7256 " handle_error_en(s, \"pthread_setschedparam\");\n"
7260 #: build/C/man3/pthread_setschedparam.3:349
7263 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
7264 " printf(\"\\en\");\n"
7266 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
7267 " printf(\"\\en\");\n"
7270 #: build/C/man3/pthread_setschedparam.3:351
7272 msgid " /* Initialize thread attributes object according to options */\n"
7273 msgstr " /* Initialize thread attributes object according to options */\n"
7276 #: build/C/man3/pthread_setschedparam.3:360
7279 " if (!use_null_attrib) {\n"
7280 " s = pthread_attr_init(&attr);\n"
7282 " handle_error_en(s, \"pthread_attr_init\");\n"
7286 " if (!use_null_attrib) {\n"
7287 " s = pthread_attr_init(&attr);\n"
7289 " handle_error_en(s, \"pthread_attr_init\");\n"
7294 #: build/C/man3/pthread_setschedparam.3:368
7297 " if (inheritsched_str != NULL) {\n"
7298 " if (inheritsched_str[0] == \\(aqe\\(aq)\n"
7299 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
7300 " else if (inheritsched_str[0] == \\(aqi\\(aq)\n"
7301 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
7303 " usage(argv[0], \"Value for -i must be \\(aqe\\(aq or \\(aqi\\(aq\\en\");\n"
7305 " if (inheritsched_str != NULL) {\n"
7306 " if (inheritsched_str[0] == \\(aqe\\(aq)\n"
7307 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
7308 " else if (inheritsched_str[0] == \\(aqi\\(aq)\n"
7309 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
7311 " usage(argv[0], \"Value for -i must be \\(aqe\\(aq or \\(aqi\\(aq\\en\");\n"
7314 #: build/C/man3/pthread_setschedparam.3:373
7317 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
7319 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
7322 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
7324 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
7328 #: build/C/man3/pthread_setschedparam.3:379
7331 " if (attr_sched_str != NULL) {\n"
7332 " if (!get_policy(attr_sched_str[0], &policy))\n"
7334 " \"Bad policy for \\(aqattr\\(aq (-a)\\en\");\n"
7335 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
7337 " if (attr_sched_str != NULL) {\n"
7338 " if (!get_policy(attr_sched_str[0], &policy))\n"
7340 " \"Bad policy for \\(aqattr\\(aq (-a)\\en\");\n"
7341 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
7344 #: build/C/man3/pthread_setschedparam.3:387
7347 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
7349 " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
7350 " s = pthread_attr_setschedparam(&attr, ¶m);\n"
7352 " handle_error_en(s, \"pthread_attr_setschedparam\");\n"
7355 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
7357 " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
7358 " s = pthread_attr_setschedparam(&attr, ¶m);\n"
7360 " handle_error_en(s, \"pthread_attr_setschedparam\");\n"
7364 #: build/C/man3/pthread_setschedparam.3:390
7367 " /* If we initialized a thread attributes object, display\n"
7368 " the scheduling attributes that were set in the object */\n"
7370 " /* If we initialized a thread attributes object, display\n"
7371 " the scheduling attributes that were set in the object */\n"
7374 #: build/C/man3/pthread_setschedparam.3:398
7377 " if (attrp != NULL) {\n"
7378 " s = pthread_attr_getschedparam(&attr, ¶m);\n"
7380 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
7381 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
7383 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
7385 " if (attrp != NULL) {\n"
7386 " s = pthread_attr_getschedparam(&attr, ¶m);\n"
7388 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
7389 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
7391 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
7394 #: build/C/man3/pthread_setschedparam.3:401
7397 " printf(\"Scheduler settings in \\(aqattr\\(aq\\en\");\n"
7398 " display_sched_attr(policy, ¶m);\n"
7400 " printf(\"Scheduler settings in \\(aqattr\\(aq\\en\");\n"
7401 " display_sched_attr(policy, ¶m);\n"
7404 #: build/C/man3/pthread_setschedparam.3:409
7407 " s = pthread_attr_getinheritsched(&attr, &inheritsched);\n"
7408 " printf(\" inheritsched is %s\\en\",\n"
7409 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
7410 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
7412 " printf(\"\\en\");\n"
7415 " s = pthread_attr_getinheritsched(&attr, &inheritsched);\n"
7416 " printf(\" inheritsched is %s\\en\",\n"
7417 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
7418 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
7420 " printf(\"\\en\");\n"
7424 #: build/C/man3/pthread_setschedparam.3:411
7426 msgid " /* Create a thread that will display its scheduling attributes */\n"
7427 msgstr " /* Create a thread that will display its scheduling attributes */\n"
7430 #: build/C/man3/pthread_setschedparam.3:415
7433 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
7435 " handle_error_en(s, \"pthread_create\");\n"
7437 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
7439 " handle_error_en(s, \"pthread_create\");\n"
7442 #: build/C/man3/pthread_setschedparam.3:417
7444 msgid " /* Destroy unneeded thread attributes object */\n"
7445 msgstr " /* Destroy unneeded thread attributes object */\n"
7448 #: build/C/man3/pthread_setschedparam.3:425
7451 " s = pthread_join(thread, NULL);\n"
7453 " handle_error_en(s, \"pthread_join\");\n"
7455 " s = pthread_join(thread, NULL);\n"
7457 " handle_error_en(s, \"pthread_join\");\n"
7460 #: build/C/man3/pthread_setschedparam.3:441
7462 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<sched_setscheduler>(2), "
7463 "B<pthread_attr_init>(3), B<pthread_attr_setinheritsched>(3), "
7464 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
7465 "B<pthread_create>(3), B<pthread_self>(3), B<pthread_setschedprio>(3), "
7468 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<sched_setscheduler>(2), "
7469 "B<pthread_attr_init>(3), B<pthread_attr_setinheritsched>(3), "
7470 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
7471 "B<pthread_create>(3), B<pthread_self>(3), B<pthread_setschedprio>(3), "
7475 #: build/C/man3/pthread_setschedprio.3:24
7477 msgid "PTHREAD_SETSCHEDPRIO"
7478 msgstr "PTHREAD_SETSCHEDPRIO"
7481 #: build/C/man3/pthread_setschedprio.3:24
7487 #: build/C/man3/pthread_setschedprio.3:27
7488 msgid "pthread_setschedprio - set scheduling priority of a thread"
7492 #: build/C/man3/pthread_setschedprio.3:32
7494 msgid "B<pthread_setschedprio(pthread_t >I<thread>B<, int >I<prio>B<);>\n"
7495 msgstr "B<pthread_setschedprio(pthread_t >I<thread>B<, int >I<prio>B<);>\n"
7497 #. FIXME . nptl/pthread_setschedprio.c has the following
7498 #. /* If the thread should have higher priority because of some
7499 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
7500 #. Eventually (perhaps after writing the mutexattr pages), we
7501 #. may want to add something on the topic to this page.
7502 #. nptl/pthread_setschedparam.c has a similar case.
7504 #: build/C/man3/pthread_setschedprio.3:51
7506 "The B<pthread_setschedprio>() function sets the scheduling priority of the "
7507 "thread I<thread> to the value specified in I<prio>. (By contrast "
7508 "B<pthread_setschedparam>(3) changes both the scheduling policy and priority "
7513 #: build/C/man3/pthread_setschedprio.3:59
7515 "On success, this function returns 0; on error, it returns a nonzero error "
7516 "number. If B<pthread_setschedprio>() fails, the scheduling priority of "
7517 "I<thread> is not changed."
7521 #: build/C/man3/pthread_setschedprio.3:64
7522 msgid "I<prio> is not valid for the scheduling policy of the specified thread."
7526 #: build/C/man3/pthread_setschedprio.3:68
7528 "The caller does not have appropriate privileges to set the specified "
7533 #: build/C/man3/pthread_setschedprio.3:79
7535 "POSIX.1-2001 also documents an B<ENOTSUP> (\"attempt was made to set the "
7536 "priority to an unsupported value\") error for B<pthread_setschedparam>(3)."
7540 #: build/C/man3/pthread_setschedprio.3:81
7541 msgid "This function is available in glibc since version 2.3.4."
7545 #: build/C/man3/pthread_setschedprio.3:89
7547 "For a description of the permissions required to, and the effect of, "
7548 "changing a thread's scheduling priority, and details of the permitted ranges "
7549 "for priorities in each scheduling policy, see B<sched_setscheduler>(2)."
7553 #: build/C/man3/pthread_setschedprio.3:101
7555 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<sched_setscheduler>(2), "
7556 "B<pthread_attr_init>(3), B<pthread_attr_setinheritsched>(3), "
7557 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
7558 "B<pthread_create>(3), B<pthread_self>(3), B<pthread_setschedparam>(3), "
7561 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<sched_setscheduler>(2), "
7562 "B<pthread_attr_init>(3), B<pthread_attr_setinheritsched>(3), "
7563 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
7564 "B<pthread_create>(3), B<pthread_self>(3), B<pthread_setschedparam>(3), "
7568 #: build/C/man3/pthread_sigmask.3:24
7570 msgid "PTHREAD_SIGMASK"
7571 msgstr "PTHREAD_SIGMASK"
7574 #: build/C/man3/pthread_sigmask.3:24
7580 #: build/C/man3/pthread_sigmask.3:27
7581 msgid "pthread_sigmask - examine and change mask of blocked signals"
7585 #: build/C/man3/pthread_sigmask.3:33
7587 msgid "B<int pthread_sigmask(int >I<how>B<, const sigset_t *>I<set>B<, sigset_t *>I<oldset>B<);>\n"
7588 msgstr "B<int pthread_sigmask(int >I<how>B<, const sigset_t *>I<set>B<, sigset_t *>I<oldset>B<);>\n"
7591 #: build/C/man3/pthread_sigmask.3:44
7593 "The B<pthread_sigmask>() function is just like B<sigprocmask>(2), with the "
7594 "difference that its use in multithreaded programs is explicitly specified by "
7595 "POSIX.1-2001. Other differences are noted in this page."
7599 #: build/C/man3/pthread_sigmask.3:47
7601 "For a description of the arguments and operation of this function, see "
7602 "B<sigprocmask>(2)."
7606 #: build/C/man3/pthread_sigmask.3:52
7608 "On success, B<pthread_sigmask>() returns 0; on error, it returns an error "
7613 #: build/C/man3/pthread_sigmask.3:55
7614 msgid "See B<sigprocmask>(2)."
7618 #: build/C/man3/pthread_sigmask.3:59
7619 msgid "A new thread inherits a copy of its creator's signal mask."
7623 #: build/C/man3/pthread_sigmask.3:64
7625 "The program below blocks some signals in the main thread, and then creates a "
7626 "dedicated thread to fetch those signals via B<sigwait>(3). The following "
7627 "shell session demonstrates its use:"
7631 #: build/C/man3/pthread_sigmask.3:75
7636 "$B< kill -QUIT %1>\n"
7637 "Signal handling thread got signal 3\n"
7638 "$B< kill -USR1 %1>\n"
7639 "Signal handling thread got signal 10\n"
7640 "$B< kill -TERM %1>\n"
7641 "[1]+ Terminated ./a.out\n"
7645 "$B< kill -QUIT %1>\n"
7646 "Signal handling thread got signal 3\n"
7647 "$B< kill -USR1 %1>\n"
7648 "Signal handling thread got signal 10\n"
7649 "$B< kill -TERM %1>\n"
7650 "[1]+ Terminated ./a.out\n"
7653 #: build/C/man3/pthread_sigmask.3:86
7656 "#include E<lt>pthread.hE<gt>\n"
7657 "#include E<lt>stdio.hE<gt>\n"
7658 "#include E<lt>stdlib.hE<gt>\n"
7659 "#include E<lt>unistd.hE<gt>\n"
7660 "#include E<lt>signal.hE<gt>\n"
7661 "#include E<lt>errno.hE<gt>\n"
7663 "#include E<lt>pthread.hE<gt>\n"
7664 "#include E<lt>stdio.hE<gt>\n"
7665 "#include E<lt>stdlib.hE<gt>\n"
7666 "#include E<lt>unistd.hE<gt>\n"
7667 "#include E<lt>signal.hE<gt>\n"
7668 "#include E<lt>errno.hE<gt>\n"
7671 #: build/C/man3/pthread_sigmask.3:88
7673 msgid "/* Simple error handling functions */\n"
7674 msgstr "/* Simple error handling functions */\n"
7677 #: build/C/man3/pthread_sigmask.3:97
7681 "sig_thread(void *arg)\n"
7683 " sigset_t *set = (sigset_t *) arg;\n"
7687 "sig_thread(void *arg)\n"
7689 " sigset_t *set = (sigset_t *) arg;\n"
7693 #: build/C/man3/pthread_sigmask.3:105
7697 " s = sigwait(set, &sig);\n"
7699 " handle_error_en(s, \"sigwait\");\n"
7700 " printf(\"Signal handling thread got signal %d\\en\", sig);\n"
7705 " s = sigwait(set, &sig);\n"
7707 " handle_error_en(s, \"sigwait\");\n"
7708 " printf(\"Signal handling thread got signal %d\\en\", sig);\n"
7713 #: build/C/man3/pthread_sigmask.3:112
7717 "main(int argc, char *argv[])\n"
7719 " pthread_t thread;\n"
7724 "main(int argc, char *argv[])\n"
7726 " pthread_t thread;\n"
7731 #: build/C/man3/pthread_sigmask.3:115
7734 " /* Block SIGQUIT and SIGUSR1; other threads created by main()\n"
7735 " will inherit a copy of the signal mask. */\n"
7737 " /* Block SIGQUIT and SIGUSR1; other threads created by main()\n"
7738 " will inherit a copy of the signal mask. */\n"
7741 #: build/C/man3/pthread_sigmask.3:122
7744 " sigemptyset(&set);\n"
7745 " sigaddset(&set, SIGQUIT);\n"
7746 " sigaddset(&set, SIGUSR1);\n"
7747 " s = pthread_sigmask(SIG_BLOCK, &set, NULL);\n"
7749 " handle_error_en(s, \"pthread_sigmask\");\n"
7751 " sigemptyset(&set);\n"
7752 " sigaddset(&set, SIGQUIT);\n"
7753 " sigaddset(&set, SIGUSR1);\n"
7754 " s = pthread_sigmask(SIG_BLOCK, &set, NULL);\n"
7756 " handle_error_en(s, \"pthread_sigmask\");\n"
7759 #: build/C/man3/pthread_sigmask.3:126
7762 " s = pthread_create(&thread, NULL, &sig_thread, (void *) &set);\n"
7764 " handle_error_en(s, \"pthread_create\");\n"
7766 " s = pthread_create(&thread, NULL, &sig_thread, (void *) &set);\n"
7768 " handle_error_en(s, \"pthread_create\");\n"
7771 #: build/C/man3/pthread_sigmask.3:129
7774 " /* Main thread carries on to create other threads and/or do\n"
7777 " /* Main thread carries on to create other threads and/or do\n"
7781 #: build/C/man3/pthread_sigmask.3:132
7784 " pause(); /* Dummy pause so we can test program */\n"
7787 " pause(); /* Dummy pause so we can test program */\n"
7791 #: build/C/man3/pthread_sigmask.3:142
7793 "B<sigaction>(2), B<sigpending>(2), B<sigprocmask>(2) B<pthread_create>(3), "
7794 "B<pthread_kill>(3), B<sigsetops>(3), B<pthreads>(7), B<signal>(7)"
7796 "B<sigaction>(2), B<sigpending>(2), B<sigprocmask>(2) B<pthread_create>(3), "
7797 "B<pthread_kill>(3), B<sigsetops>(3), B<pthreads>(7), B<signal>(7)"
7800 #: build/C/man3/pthread_sigqueue.3:23
7802 msgid "PTHREAD_SIGQUEUE"
7803 msgstr "PTHREAD_SIGQUEUE"
7806 #: build/C/man3/pthread_sigqueue.3:23
7812 #: build/C/man3/pthread_sigqueue.3:26
7813 msgid "pthread_sigqueue - queue a signal and data to a thread"
7817 #: build/C/man3/pthread_sigqueue.3:32
7820 "B<int pthread_sigqueue(pthread_t *>I<thread>B<, int >I<sig>B<,>\n"
7821 "B< const union sigval >I<value>B<);>\n"
7823 "B<int pthread_sigqueue(pthread_t *>I<thread>B<, int >I<sig>B<,>\n"
7824 "B< const union sigval >I<value>B<);>\n"
7827 #: build/C/man3/pthread_sigqueue.3:43
7828 msgid "B<pthread_sigqueue>(): _GNU_SOURCE"
7829 msgstr "B<pthread_sigqueue>(): _GNU_SOURCE"
7832 #: build/C/man3/pthread_sigqueue.3:51
7834 "The B<pthread_sigqueue>() function performs a similar task to B<sigqueue>"
7835 "(3), but, rather than sending a signal to another process, it sends a signal "
7836 "to another thread in the same process as the calling thread."
7840 #: build/C/man3/pthread_sigqueue.3:63
7842 "The I<thread> argument is the ID of another thread in the same process as "
7843 "the caller. The I<sig> argument specifies the signal to be sent. The "
7844 "I<value> argument specifies data to accompany the signal; see B<sigqueue>"
7849 #: build/C/man3/pthread_sigqueue.3:68
7851 "On success, B<pthread_sigqueue>() returns 0; on error, it returns an error "
7856 #: build/C/man3/pthread_sigqueue.3:75
7858 "The limit of signals which may be queued has been reached. (See B<signal>"
7859 "(7) for further information.)"
7863 #: build/C/man3/pthread_sigqueue.3:79
7864 msgid "I<sig> was invalid."
7868 #: build/C/man3/pthread_sigqueue.3:79
7874 #: build/C/man3/pthread_sigqueue.3:83
7875 msgid "B<pthread_sigqueue>() is not supported on this system."
7879 #: build/C/man3/pthread_sigqueue.3:87
7880 msgid "I<thread> is not valid."
7884 #: build/C/man3/pthread_sigqueue.3:91
7885 msgid "The B<pthread_sigqueue>() function first appeared in glibc 2.11."
7889 #: build/C/man3/pthread_sigqueue.3:93
7890 msgid "This function is a GNU extension."
7894 #: build/C/man3/pthread_sigqueue.3:101
7896 "B<rt_tgsigqueueinfo>(2), B<sigaction>(2), B<pthread_sigmask>(3), B<sigqueue>"
7897 "(3), B<sigwait>(3), B<pthreads>(7), B<signal>(7)"
7899 "B<rt_tgsigqueueinfo>(2), B<sigaction>(2), B<pthread_sigmask>(3), \n"
7900 "B<sigqueue>(3), B<sigwait>(3), B<pthreads>(7), B<signal>(7)"
7903 #: build/C/man3/pthread_testcancel.3:24
7905 msgid "PTHREAD_TESTCANCEL"
7906 msgstr "PTHREAD_TESTCANCEL"
7909 #: build/C/man3/pthread_testcancel.3:27
7911 "pthread_testcancel - request delivery of any pending cancellation request"
7915 #: build/C/man3/pthread_testcancel.3:32
7917 msgid "B<void pthread_testcancel(void);>\n"
7918 msgstr "B<void pthread_testcancel(void);>\n"
7921 #: build/C/man3/pthread_testcancel.3:41
7923 "Calling B<pthread_testcancel>() creates a cancellation point within the "
7924 "calling thread, so that a thread that is otherwise executing code that "
7925 "contains no cancellation points will respond to a cancellation request."
7929 #: build/C/man3/pthread_testcancel.3:48
7931 "If cancelability is disabled (using B<pthread_setcancelstate>(3)), or no "
7932 "cancellation request is pending, then a call to B<pthread_cancel>(3) has no "
7937 #: build/C/man3/pthread_testcancel.3:52
7939 "This function does not return a value. If the calling thread is canceled as "
7940 "a consequence of a call to this function, then the function does not return."
7944 #: build/C/man3/pthread_testcancel.3:61
7945 msgid "See B<pthread_cleanup_push>(3)."
7949 #: build/C/man3/pthread_testcancel.3:66
7951 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_setcancelstate>"
7952 "(3), B<pthreads>(7)"
7954 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_setcancelstate>"
7955 "(3), B<pthreads>(7)"
7958 #: build/C/man3/pthread_tryjoin_np.3:24
7960 msgid "PTHREAD_TRYJOIN_NP"
7961 msgstr "PTHREAD_TRYJOIN_NP"
7964 #: build/C/man3/pthread_tryjoin_np.3:28
7966 "pthread_tryjoin_np, pthread_timedjoin_np - try to join with a terminated "
7971 #: build/C/man3/pthread_tryjoin_np.3:34
7973 msgid "B<int pthread_tryjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
7974 msgstr "B<int pthread_tryjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
7977 #: build/C/man3/pthread_tryjoin_np.3:37
7980 "B<int pthread_timedjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<,>\n"
7981 "B< const struct timespec *>I<abstime>B<);>\n"
7983 "B<int pthread_timedjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<,>\n"
7984 "B< const struct timespec *>I<abstime>B<);>\n"
7987 #: build/C/man3/pthread_tryjoin_np.3:44
7989 "These functions operate in the same way as B<pthread_join>(3), except for "
7990 "the differences described on this page."
7994 #: build/C/man3/pthread_tryjoin_np.3:56
7996 "The B<pthread_tryjoin_np>() function performs a nonblocking join with the "
7997 "thread I<thread>, returning the exit status of the thread in I<*retval>. If "
7998 "I<thread> has not yet terminated, then instead of blocking, as is done by "
7999 "B<pthread_join>(3), the call returns an error."
8003 #: build/C/man3/pthread_tryjoin_np.3:74
8005 "The B<pthread_timedjoin_np>() function performs a join-with-timeout. If "
8006 "I<thread> has not yet terminated, then the call blocks until a maximum time, "
8007 "specified in I<abstime>. If the timeout expires before I<thread> "
8008 "terminates, the call returns an error. The I<abstime> argument is a "
8009 "structure of the following form, specifying an absolute time measured since "
8010 "the Epoch (see B<time>(2)):"
8014 #: build/C/man3/pthread_tryjoin_np.3:81
8017 "struct timespec {\n"
8018 " time_t tv_sec; /* seconds */\n"
8019 " long tv_nsec; /* nanoseconds */\n"
8022 "struct timespec {\n"
8023 " time_t tv_sec; /* seconds */\n"
8024 " long tv_nsec; /* nanoseconds */\n"
8028 #: build/C/man3/pthread_tryjoin_np.3:87
8030 "On success, these functions return 0; on error, they return an error number."
8034 #: build/C/man3/pthread_tryjoin_np.3:92
8036 "These functions can fail with the same errors as B<pthread_join>(3). "
8037 "B<pthread_tryjoin_np>() can in addition fail with the following error:"
8041 #: build/C/man3/pthread_tryjoin_np.3:92
8047 #: build/C/man3/pthread_tryjoin_np.3:96
8048 msgid "I<thread> had not yet terminated at the time of the call."
8052 #: build/C/man3/pthread_tryjoin_np.3:99
8054 "B<pthread_timedjoin_np>() can in addition fail with the following error:"
8058 #: build/C/man3/pthread_tryjoin_np.3:99
8060 msgid "B<ETIMEDOUT>"
8061 msgstr "B<ETIMEDOUT>"
8064 #: build/C/man3/pthread_tryjoin_np.3:104
8065 msgid "The call timed out before I<thread> terminated."
8069 #: build/C/man3/pthread_tryjoin_np.3:108
8070 msgid "B<pthread_timedjoin_np>() never returns the error B<EINTR>."
8074 #: build/C/man3/pthread_tryjoin_np.3:110
8075 msgid "These functions first appeared in glibc in version 2.3.3."
8079 #: build/C/man3/pthread_tryjoin_np.3:115
8080 msgid "The following code waits to join for up to 5 seconds:"
8084 #: build/C/man3/pthread_tryjoin_np.3:119
8087 " struct timespec ts;\n"
8090 " struct timespec ts;\n"
8094 #: build/C/man3/pthread_tryjoin_np.3:121
8100 #: build/C/man3/pthread_tryjoin_np.3:125
8103 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {\n"
8104 "\t/* Handle error */\n"
8107 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {\n"
8108 "\t/* Handle error */\n"
8112 #: build/C/man3/pthread_tryjoin_np.3:127
8114 msgid " ts.tv_sec += 5;\n"
8115 msgstr " ts.tv_sec += 5;\n"
8118 #: build/C/man3/pthread_tryjoin_np.3:132
8121 " s = pthread_timedjoin_np(thread, NULL, &ts);\n"
8123 " /* Handle error */\n"
8126 " s = pthread_timedjoin_np(thread, NULL, &ts);\n"
8128 " /* Handle error */\n"
8132 #: build/C/man3/pthread_tryjoin_np.3:138
8134 "B<clock_gettime>(2), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
8136 "B<clock_gettime>(2), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
8139 #: build/C/man3/pthread_yield.3:23
8141 msgid "PTHREAD_YIELD"
8142 msgstr "PTHREAD_YIELD"
8145 #: build/C/man3/pthread_yield.3:26
8146 msgid "pthread_yield - yield the processor"
8150 #: build/C/man3/pthread_yield.3:31
8152 msgid "B<int pthread_yield(void);>\n"
8153 msgstr "B<int pthread_yield(void);>\n"
8156 #: build/C/man3/pthread_yield.3:41
8158 "B<pthread_yield>() causes the calling thread to relinquish the CPU. The "
8159 "thread is placed at the end of the run queue for its static priority and "
8160 "another thread is scheduled to run. For further details, see B<sched_yield>"
8165 #: build/C/man3/pthread_yield.3:46
8167 "On success, B<pthread_yield>() returns 0; on error, it returns an error "
8172 #: build/C/man3/pthread_yield.3:50
8174 "On Linux, this call always succeeds (but portable and future-proof "
8175 "applications should nevertheless handle a possible error return)."
8178 #. e.g., the BSDs, Tru64, AIX, and Irix.
8180 #: build/C/man3/pthread_yield.3:56
8182 "This call is nonstandard, but present on several other systems. Use the "
8183 "standardized B<sched_yield>(2) instead."
8187 #: build/C/man3/pthread_yield.3:59
8188 msgid "On Linux, this function is implemented as a call to B<sched_yield>(2)."
8192 #: build/C/man3/pthread_yield.3:63
8193 msgid "B<sched_setscheduler>(2), B<sched_yield>(2) B<pthreads>(7)"
8194 msgstr "B<sched_setscheduler>(2), B<sched_yield>(2) B<pthreads>(7)"
8197 #: build/C/man7/pthreads.7:24
8203 #: build/C/man7/pthreads.7:24
8209 #: build/C/man7/pthreads.7:27
8210 msgid "pthreads - POSIX threads"
8211 msgstr "pthreads - POSIX スレッド"
8214 #: build/C/man7/pthreads.7:34
8216 "POSIX.1 specifies a set of interfaces (functions, header files) for threaded "
8217 "programming commonly known as POSIX threads, or Pthreads. A single process "
8218 "can contain multiple threads, all of which are executing the same program. "
8219 "These threads share the same global memory (data and heap segments), but "
8220 "each thread has its own stack (automatic variables)."
8222 "POSIX.1 は、一般に POSIX スレッドや Pthreads として知られる スレッド・プログ"
8223 "ラミングのインタフェース群 (関数、ヘッダファイル) を規定している。一つのプロ"
8224 "セスは複数のスレッドを持つことができ、 全てのスレッドは同じプログラムを実行す"
8225 "る。 これらのスレッドは同じ大域メモリ (データとヒープ領域) を共有するが、 各"
8226 "スレッドは自分専用のスタック (自動変数) を持つ。"
8229 #: build/C/man7/pthreads.7:37
8231 "POSIX.1 also requires that threads share a range of other attributes (i.e., "
8232 "these attributes are process-wide rather than per-thread):"
8234 "POSIX.1 はスレッド間でどのような属性を共有するかについても定めている (つま"
8235 "り、これらの属性はスレッド単位ではなくプロセス全体で共通である):"
8238 #: build/C/man7/pthreads.7:37 build/C/man7/pthreads.7:39
8239 #: build/C/man7/pthreads.7:41 build/C/man7/pthreads.7:43
8240 #: build/C/man7/pthreads.7:45 build/C/man7/pthreads.7:47
8241 #: build/C/man7/pthreads.7:49 build/C/man7/pthreads.7:52
8242 #: build/C/man7/pthreads.7:54 build/C/man7/pthreads.7:57
8243 #: build/C/man7/pthreads.7:63 build/C/man7/pthreads.7:68
8244 #: build/C/man7/pthreads.7:71 build/C/man7/pthreads.7:74
8245 #: build/C/man7/pthreads.7:82 build/C/man7/pthreads.7:86
8246 #: build/C/man7/pthreads.7:89 build/C/man7/pthreads.7:93
8247 #: build/C/man7/pthreads.7:96 build/C/man7/pthreads.7:103
8248 #: build/C/man7/pthreads.7:106 build/C/man7/pthreads.7:683
8249 #: build/C/man7/pthreads.7:690 build/C/man7/pthreads.7:702
8250 #: build/C/man7/pthreads.7:712 build/C/man7/pthreads.7:716
8251 #: build/C/man7/pthreads.7:725 build/C/man7/pthreads.7:735
8252 #: build/C/man7/pthreads.7:742 build/C/man7/pthreads.7:749
8253 #: build/C/man7/pthreads.7:751 build/C/man7/pthreads.7:754
8254 #: build/C/man7/pthreads.7:760 build/C/man7/pthreads.7:763
8255 #: build/C/man7/pthreads.7:765 build/C/man7/pthreads.7:767
8256 #: build/C/man7/pthreads.7:777 build/C/man7/pthreads.7:797
8257 #: build/C/man7/pthreads.7:806 build/C/man7/pthreads.7:812
8258 #: build/C/man7/pthreads.7:814 build/C/man7/pthreads.7:816
8259 #: build/C/man7/pthreads.7:820 build/C/man7/pthreads.7:825
8260 #: build/C/man7/pthreads.7:833
8266 #: build/C/man7/pthreads.7:39
8271 #: build/C/man7/pthreads.7:41
8272 msgid "parent process ID"
8276 #: build/C/man7/pthreads.7:43
8277 msgid "process group ID and session ID"
8278 msgstr "プロセスグループ ID とセッション ID"
8281 #: build/C/man7/pthreads.7:45
8282 msgid "controlling terminal"
8286 #: build/C/man7/pthreads.7:47
8287 msgid "user and group IDs"
8288 msgstr "ユーザ ID とグループ ID"
8291 #: build/C/man7/pthreads.7:49
8292 msgid "open file descriptors"
8293 msgstr "オープンするファイルディスクリプタ"
8296 #: build/C/man7/pthreads.7:52
8297 msgid "record locks (see B<fcntl>(2))"
8298 msgstr "レコードのロック (B<fcntl>(3) 参照)"
8301 #: build/C/man7/pthreads.7:54
8302 msgid "signal dispositions"
8306 #: build/C/man7/pthreads.7:57
8307 msgid "file mode creation mask (B<umask>(2))"
8308 msgstr "ファイルモード作成マスク (B<umask>(2))"
8311 #: build/C/man7/pthreads.7:63
8312 msgid "current directory (B<chdir>(2)) and root directory (B<chroot>(2))"
8314 "カレント・ディレクトリ (B<chdir>(2)) とルート・ディレクトリ (B<chroot>(2))"
8317 #: build/C/man7/pthreads.7:68
8319 "interval timers (B<setitimer>(2)) and POSIX timers (B<timer_create>(2))"
8321 "インターバル・タイマ (B<setitimer>(2)) と POSIX タイマ (B<timer_create>(2))"
8324 #: build/C/man7/pthreads.7:71
8325 msgid "nice value (B<setpriority>(2))"
8326 msgstr "nice 値 (B<setpriority>(2))"
8329 #: build/C/man7/pthreads.7:74
8330 msgid "resource limits (B<setrlimit>(2))"
8331 msgstr "リソース制限 (B<setrlimit>(2))"
8334 #: build/C/man7/pthreads.7:79
8336 "measurements of the consumption of CPU time (B<times>(2)) and resources "
8338 msgstr "CPU 時間 (B<times>(2)) とリソース (B<getrusage>(2)) の消費状況の計測"
8341 #: build/C/man7/pthreads.7:82
8343 "As well as the stack, POSIX.1 specifies that various other attributes are "
8344 "distinct for each thread, including:"
8346 "スタックについても、POSIX.1 はどのような属性が 個々のスレッドで独立に管理され"
8350 #: build/C/man7/pthreads.7:86
8351 msgid "thread ID (the I<pthread_t> data type)"
8352 msgstr "スレッド ID (B<pthread_t> データ型)"
8355 #: build/C/man7/pthreads.7:89
8356 msgid "signal mask (B<pthread_sigmask>(3))"
8357 msgstr "シグナルマスク (B<pthread_sigmask>(3))"
8360 #: build/C/man7/pthreads.7:93
8361 msgid "the I<errno> variable"
8362 msgstr "I<errno> 変数"
8365 #: build/C/man7/pthreads.7:96
8366 msgid "alternate signal stack (B<sigaltstack>(2))"
8367 msgstr "代替シグナルスタック (B<sigaltstack>(2))"
8370 #: build/C/man7/pthreads.7:101
8372 "real-time scheduling policy and priority (B<sched_setscheduler>(2) and "
8373 "B<sched_setparam>(2))"
8375 "リアルタイム・スケジューリングのポリシーと優先度 (B<sched_setscheduler>(2) "
8376 "と B<sched_setparam>(2))"
8379 #: build/C/man7/pthreads.7:103
8380 msgid "The following Linux-specific features are also per-thread:"
8381 msgstr "以下の Linux 特有の機能もスレッド単位である:"
8384 #: build/C/man7/pthreads.7:106
8385 msgid "capabilities (see B<capabilities>(7))"
8386 msgstr "ケーパビリティ (B<capabilities>(7) 参照)"
8389 #: build/C/man7/pthreads.7:109
8390 msgid "CPU affinity (B<sched_setaffinity>(2))"
8391 msgstr "CPU affinity (親和度) (B<sched_setaffinity>(2))"
8394 #: build/C/man7/pthreads.7:109
8396 msgid "Pthreads function return values"
8397 msgstr "pthreads 関数の返り値"
8400 #: build/C/man7/pthreads.7:116
8402 "Most pthreads functions return 0 on success, and an error number of "
8403 "failure. Note that the pthreads functions do not set I<errno>. For each of "
8404 "the pthreads functions that can return an error, POSIX.1-2001 specifies that "
8405 "the function can never fail with the error B<EINTR>."
8407 "ほとんどの pthreads 関数は成功すると 0 を返し、 失敗した場合エラー番号を返"
8408 "す。 pthreads 関数は I<errno> をセットしない点に注意すること。 POSIX.1-2001 "
8409 "では、 エラーを返す可能性のある pthreads 関数がエラー B<EINTR> で失敗すること"
8413 #: build/C/man7/pthreads.7:116
8419 #: build/C/man7/pthreads.7:130
8421 "Each of the threads in a process has a unique thread identifier (stored in "
8422 "the type I<pthread_t>). This identifier is returned to the caller of "
8423 "B<pthread_create>(3), and a thread can obtain its own thread identifier "
8424 "using B<pthread_self>(3). Thread IDs are only guaranteed to be unique "
8425 "within a process. A thread ID may be reused after a terminated thread has "
8426 "been joined, or a detached thread has terminated. In all pthreads functions "
8427 "that accept a thread ID as an argument, that ID by definition refers to a "
8428 "thread in the same process as the caller."
8430 "あるプロセス内の各スレッドは (I<pthread_t> 型の) 一意なスレッド識別子を持"
8431 "つ。 この識別子は、 B<pthread_create>(3) の呼び出し元に返される。また、ス"
8432 "レッドは自身のスレッド識別子を B<pthread_self>(3) を使って取得できる。 ス"
8433 "レッド ID の一意性が保証されるのは、一つのプロセス内においてのみである。 終了"
8434 "したスレッドが join された後では、スレッド ID は再利用される可能性がある。 ス"
8435 "レッド ID を引き数に取る全てのスレッド関数において、 その ID は呼び出し元と同"
8436 "じプロセス内の一つのスレッドを参照する。"
8439 #: build/C/man7/pthreads.7:130
8441 msgid "Thread-safe functions"
8445 #: build/C/man7/pthreads.7:134
8447 "A thread-safe function is one that can be safely (i.e., it will deliver the "
8448 "same results regardless of whether it is) called from multiple threads at "
8451 "スレッドセーフな関数は、複数のスレッドから同時に呼び出しても安全な (すなわ"
8452 "ち、同時に呼び出されたかに関わらず、同じ結果を返す) 関数のことである。"
8455 #: build/C/man7/pthreads.7:138
8457 "POSIX.1-2001 and POSIX.1-2008 require that all functions specified in the "
8458 "standard shall be thread-safe, except for the following functions:"
8460 "POSIX.1-2001 と POSIX.1-2008では、一部の例外を除き、 標準で規定されている全て"
8461 "の関数がスレッドセーフであることを要求している。 以下の関数が例外である。"
8464 #: build/C/man7/pthreads.7:232
8471 "ctermid() if passed a non-NULL argument\n"
8485 "ecvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8490 "fcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8492 "gcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8494 "getchar_unlocked()\n"
8500 "gethostbyaddr() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8501 "gethostbyname() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8508 "getprotobyname()\n"
8509 "getprotobynumber()\n"
8537 "putchar_unlocked()\n"
8548 "strsignal() [Added in POSIX.1-2008]\n"
8550 "system() [Added in POSIX.1-2008]\n"
8551 "tmpnam() if passed a non-NULL argument\n"
8554 "wcrtomb() if its final argument is NULL\n"
8555 "wcsrtombs() if its final argument is NULL\n"
8563 "ctermid() (NULL でない引き数を渡された場合)\n"
8577 "ecvt() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8582 "fcvt() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8584 "gcvt() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8586 "getchar_unlocked()\n"
8592 "gethostbyaddr() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8593 "gethostbyname() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8600 "getprotobyname()\n"
8601 "getprotobynumber()\n"
8629 "putchar_unlocked()\n"
8640 "strsignal() [POSIX.1-2008 で追加された]\n"
8642 "system() [POSIX.1-2008 で追加された]\n"
8643 "tmpnam() (NULL でない引き数を渡された場合)\n"
8646 "wcrtomb() (最後の引き数が NULL の場合)\n"
8647 "wcsrtombs() (最後の引き数が NULL の場合)\n"
8652 #: build/C/man7/pthreads.7:234
8654 msgid "Async-cancel-safe functions"
8655 msgstr "async-cancel-safe 関数"
8658 #: build/C/man7/pthreads.7:238
8660 "An async-cancel-safe function is one that can be safely called in an "
8661 "application where asynchronous cancelability is enabled (see "
8662 "B<pthread_setcancelstate>(3))."
8664 "async-cancel-safe 関数は、\n"
8665 "非同期キャンセル機能が有効になっているアプリケーションで\n"
8666 "安全に呼び出すことができる関数のことである\n"
8667 "(B<pthread_setcancelstate>(3) を参照)。"
8670 #: build/C/man7/pthreads.7:241
8672 "Only the following functions are required to be async-cancel-safe by "
8673 "POSIX.1-2001 and POSIX.1-2008:"
8675 "以下の関数だけが、POSIX.1-2001 と POSIX.1-2008 で async-cancel-safe で\n"
8679 #: build/C/man7/pthreads.7:247
8682 "pthread_cancel()\n"
8683 "pthread_setcancelstate()\n"
8684 "pthread_setcanceltype()\n"
8686 "pthread_cancel()\n"
8687 "pthread_setcancelstate()\n"
8688 "pthread_setcanceltype()\n"
8691 #: build/C/man7/pthreads.7:249
8693 msgid "Cancellation Points"
8694 msgstr "取り消しポイント (cancellation points)"
8697 #: build/C/man7/pthreads.7:256
8699 "POSIX.1 specifies that certain functions must, and certain other functions "
8700 "may, be cancellation points. If a thread is cancelable, its cancelability "
8701 "type is deferred, and a cancellation request is pending for the thread, then "
8702 "the thread is canceled when it calls a function that is a cancellation point."
8704 "POSIX.1 の規定では、特定の関数は取り消しポイントでなければならず、 他の特定の"
8705 "関数は取り消しポイントであってもよいとされている。 あるスレッドが取り消し可能"
8706 "で、その取り消し種別 (cancelability type) が延期 (deferred) で、そのスレッド"
8707 "に対する取り消し要求が処理待ちの場合、 取り消しポイントである関数を呼び出した"
8708 "時点で、そのスレッドのキャンセルが 行われる。"
8711 #: build/C/man7/pthreads.7:259
8713 "The following functions are required to be cancellation points by "
8714 "POSIX.1-2001 and/or POSIX.1-2008:"
8716 "POSIX.1-2001 と POSIX.1-2008 の両方、もしくはいずれか一方では、 以下の関数"
8717 "は、取り消しポイント (cancellation points) で あることが必須となっている。"
8720 #: build/C/man7/pthreads.7:322
8725 "clock_nanosleep()\n"
8729 "fcntl() F_SETLKW\n"
8737 "mq_timedreceive()\n"
8744 "openat() [Added in POSIX.1-2008]\n"
8749 "pthread_cond_timedwait()\n"
8750 "pthread_cond_wait()\n"
8752 "pthread_testcancel()\n"
8767 "sigpause() [POSIX.1-2001 only (moves to \"may\" list in POSIX.1-2008)]\n"
8775 "usleep() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
8784 "clock_nanosleep()\n"
8788 "fcntl() F_SETLKW\n"
8796 "mq_timedreceive()\n"
8803 "openat() [POSIX.1-2008 で追加された]\n"
8808 "pthread_cond_timedwait()\n"
8809 "pthread_cond_wait()\n"
8811 "pthread_testcancel()\n"
8826 "sigpause() [POSIX.1-2001 only (moves to \"may\" list in POSIX.1-2008)]\n"
8834 "usleep() [POSIX.1-2001 のみ (POSIX.1-2008 で削除された)]\n"
8842 #: build/C/man7/pthreads.7:327
8844 "The following functions may be cancellation points according to POSIX.1-2001 "
8845 "and/or POSIX.1-2008:"
8847 "POSIX.1-2001 と POSIX.1-2008 の両方、もしくはいずれか一方では、 以下の関数"
8848 "は、取り消しポイント (cancellation points) で あってもよいことになっている。"
8851 #: build/C/man7/pthreads.7:555
8860 "chmod() [Added in POSIX.1-2008]\n"
8861 "chown() [Added in POSIX.1-2008]\n"
8875 "dprintf() [Added in POSIX.1-2008]\n"
8883 "faccessat() [Added in POSIX.1-2008]\n"
8884 "fchmod() [Added in POSIX.1-2008]\n"
8885 "fchmodat() [Added in POSIX.1-2008]\n"
8886 "fchown() [Added in POSIX.1-2008]\n"
8887 "fchownat() [Added in POSIX.1-2008]\n"
8889 "fcntl() (for any value of cmd argument)\n"
8911 "fstatat() [Added in POSIX.1-2008]\n"
8915 "futimens() [Added in POSIX.1-2008]\n"
8923 "getchar_unlocked()\n"
8926 "getdelim() [Added in POSIX.1-2008]\n"
8932 "gethostbyaddr() [SUSv3 only (function removed in POSIX.1-2008)]\n"
8933 "gethostbyname() [SUSv3 only (function removed in POSIX.1-2008)]\n"
8937 "getline() [Added in POSIX.1-2008]\n"
8944 "getopt() (if opterr is nonzero)\n"
8945 "getprotobyname()\n"
8946 "getprotobynumber()\n"
8962 "getwd() [SUSv3 only (function removed in POSIX.1-2008)]\n"
8968 "linkat() [Added in POSIX.1-2008]\n"
8969 "lio_listio() [Added in POSIX.1-2008]\n"
8972 "lockf() [Added in POSIX.1-2008]\n"
8975 "mkdir() [Added in POSIX.1-2008]\n"
8976 "mkdirat() [Added in POSIX.1-2008]\n"
8977 "mkdtemp() [Added in POSIX.1-2008]\n"
8978 "mkfifo() [Added in POSIX.1-2008]\n"
8979 "mkfifoat() [Added in POSIX.1-2008]\n"
8980 "mknod() [Added in POSIX.1-2008]\n"
8981 "mknodat() [Added in POSIX.1-2008]\n"
8992 "posix_fallocate()\n"
8997 "posix_trace_clear()\n"
8998 "posix_trace_close()\n"
8999 "posix_trace_create()\n"
9000 "posix_trace_create_withlog()\n"
9001 "posix_trace_eventtypelist_getnext_id()\n"
9002 "posix_trace_eventtypelist_rewind()\n"
9003 "posix_trace_flush()\n"
9004 "posix_trace_get_attr()\n"
9005 "posix_trace_get_filter()\n"
9006 "posix_trace_get_status()\n"
9007 "posix_trace_getnext_event()\n"
9008 "posix_trace_open()\n"
9009 "posix_trace_rewind()\n"
9010 "posix_trace_set_filter()\n"
9011 "posix_trace_shutdown()\n"
9012 "posix_trace_timedgetnext_event()\n"
9013 "posix_typed_mem_open()\n"
9015 "psiginfo() [Added in POSIX.1-2008]\n"
9016 "psignal() [Added in POSIX.1-2008]\n"
9017 "pthread_rwlock_rdlock()\n"
9018 "pthread_rwlock_timedrdlock()\n"
9019 "pthread_rwlock_timedwrlock()\n"
9020 "pthread_rwlock_wrlock()\n"
9024 "putchar_unlocked()\n"
9031 "readlink() [Added in POSIX.1-2008]\n"
9032 "readlinkat() [Added in POSIX.1-2008]\n"
9035 "renameat() [Added in POSIX.1-2008]\n"
9038 "scandir() [Added in POSIX.1-2008]\n"
9049 "sigpause() [Added in POSIX.1-2008]\n"
9055 "symlinkat() [Added in POSIX.1-2008]\n"
9066 "unlinkat() [Added in POSIX.1-2008]\n"
9067 "utime() [Added in POSIX.1-2008]\n"
9068 "utimensat() [Added in POSIX.1-2008]\n"
9069 "utimes() [Added in POSIX.1-2008]\n"
9070 "vdprintf() [Added in POSIX.1-2008]\n"
9086 "chmod() [POSIX.1-2008 で追加された]\n"
9087 "chown() [POSIX.1-2008 で追加された]\n"
9101 "dprintf() [POSIX.1-2008 で追加された]\n"
9109 "faccessat() [POSIX.1-2008 で追加された]\n"
9110 "fchmod() [POSIX.1-2008 で追加された]\n"
9111 "fchmodat() [POSIX.1-2008 で追加された]\n"
9112 "fchown() [POSIX.1-2008 で追加された]\n"
9113 "fchownat() [POSIX.1-2008 で追加された]\n"
9115 "fcntl() (cmd 引き数が何であっても)\n"
9137 "fstatat() [POSIX.1-2008 で追加された]\n"
9141 "futimens() [POSIX.1-2008 で追加された]\n"
9149 "getchar_unlocked()\n"
9152 "getdelim() [POSIX.1-2008 で追加された]\n"
9158 "gethostbyaddr() [SUSv3 のみ (この関数は POSIX.1-2008 で削除されている)]\n"
9159 "gethostbyname() [SUSv3 のみ (この関数は POSIX.1-2008 で削除されている)]\n"
9163 "getline() [POSIX.1-2008 で追加された]\n"
9170 "getopt() (opterr が 0 以外の場合)\n"
9171 "getprotobyname()\n"
9172 "getprotobynumber()\n"
9188 "getwd() [SUSv3 のみ (この関数は POSIX.1-2008 で削除されている)]\n"
9194 "linkat() [POSIX.1-2008 で追加された]\n"
9195 "lio_listio() [POSIX.1-2008 で追加された]\n"
9198 "lockf() [POSIX.1-2008 で追加された]\n"
9201 "mkdir() [POSIX.1-2008 で追加された]\n"
9202 "mkdirat() [POSIX.1-2008 で追加された]\n"
9203 "mkdtemp() [POSIX.1-2008 で追加された]\n"
9204 "mkfifo() [POSIX.1-2008 で追加された]\n"
9205 "mkfifoat() [POSIX.1-2008 で追加された]\n"
9206 "mknod() [POSIX.1-2008 で追加された]\n"
9207 "mknodat() [POSIX.1-2008 で追加された]\n"
9218 "posix_fallocate()\n"
9223 "posix_trace_clear()\n"
9224 "posix_trace_close()\n"
9225 "posix_trace_create()\n"
9226 "posix_trace_create_withlog()\n"
9227 "posix_trace_eventtypelist_getnext_id()\n"
9228 "posix_trace_eventtypelist_rewind()\n"
9229 "posix_trace_flush()\n"
9230 "posix_trace_get_attr()\n"
9231 "posix_trace_get_filter()\n"
9232 "posix_trace_get_status()\n"
9233 "posix_trace_getnext_event()\n"
9234 "posix_trace_open()\n"
9235 "posix_trace_rewind()\n"
9236 "posix_trace_set_filter()\n"
9237 "posix_trace_shutdown()\n"
9238 "posix_trace_timedgetnext_event()\n"
9239 "posix_typed_mem_open()\n"
9241 "psiginfo() [POSIX.1-2008 で追加された]\n"
9242 "psignal() [POSIX.1-2008 で追加された]\n"
9243 "pthread_rwlock_rdlock()\n"
9244 "pthread_rwlock_timedrdlock()\n"
9245 "pthread_rwlock_timedwrlock()\n"
9246 "pthread_rwlock_wrlock()\n"
9250 "putchar_unlocked()\n"
9257 "readlink() [POSIX.1-2008 で追加された]\n"
9258 "readlinkat() [POSIX.1-2008 で追加された]\n"
9261 "renameat() [POSIX.1-2008 で追加された]\n"
9264 "scandir() [POSIX.1-2008 で追加された]\n"
9275 "sigpause() [POSIX.1-2008 で追加された]\n"
9281 "symlinkat() [POSIX.1-2008 で追加された]\n"
9292 "unlinkat() [POSIX.1-2008 で追加された]\n"
9293 "utime() [POSIX.1-2008 で追加された]\n"
9294 "utimensat() [POSIX.1-2008 で追加された]\n"
9295 "utimes() [POSIX.1-2008 で追加された]\n"
9296 "vdprintf() [POSIX.1-2008 で追加された]\n"
9306 #. So, scanning "cancellation point" comments in the glibc 2.8 header
9307 #. files, it looks as though at least the following nonstandard
9308 #. functions are cancellation points:
9348 #. getprotobynumber_r
9363 #. getwchar_unlocked
9370 #. pthread_timedjoin_np
9376 #. putwchar_unlocked
9397 #: build/C/man7/pthreads.7:653
9399 "An implementation may also mark other functions not specified in the "
9400 "standard as cancellation points. In particular, an implementation is likely "
9401 "to mark any nonstandard function that may block as a cancellation point. "
9402 "(This includes most functions that can touch files.)"
9404 "実装時に、標準規格で規定されていないその他の関数を取り消しポイント とすること"
9405 "も認められている。 特に、停止 (block) する可能性がある非標準の関数を取り消し"
9406 "ポイントと する実装はあり得ることだろう (ファイルを扱う可能性のあるほとんどの"
9410 #: build/C/man7/pthreads.7:653
9412 msgid "Compiling on Linux"
9413 msgstr "Linux でのコンパイル"
9416 #: build/C/man7/pthreads.7:656
9418 "On Linux, programs that use the Pthreads API should be compiled using I<cc -"
9421 "Linux では、Pthreads API を用いたプログラムは I<cc -pthread> でコンパイルすべ"
9425 #: build/C/man7/pthreads.7:656
9427 msgid "Linux Implementations of POSIX Threads"
9428 msgstr "POSIX スレッドの Linux での実装"
9431 #: build/C/man7/pthreads.7:659
9433 "Over time, two threading implementations have been provided by the GNU C "
9436 "これまで、2つのスレッドの実装が Linux の GNU C ライブラリにより 提供されてき"
9440 #: build/C/man7/pthreads.7:659
9442 msgid "B<LinuxThreads>"
9443 msgstr "B<LinuxThreads>"
9446 #: build/C/man7/pthreads.7:663
9448 "This is the original Pthreads implementation. Since glibc 2.4, this "
9449 "implementation is no longer supported."
9451 "最初の Pthreads の実装。 glibc 2.4 以降は、この実装はもはやサポートされていな"
9455 #: build/C/man7/pthreads.7:663
9457 msgid "B<NPTL> (Native POSIX Threads Library)"
9458 msgstr "B<NPTL> (Native POSIX Threads Library)"
9461 #: build/C/man7/pthreads.7:671
9463 "This is the modern Pthreads implementation. By comparison with "
9464 "LinuxThreads, NPTL provides closer conformance to the requirements of the "
9465 "POSIX.1 specification and better performance when creating large numbers of "
9466 "threads. NPTL is available since glibc 2.3.2, and requires features that "
9467 "are present in the Linux 2.6 kernel."
9469 "新しい Pthreads の実装。LinuxThreads と比べると、 NPTL は POSIX.1 の要求仕様"
9470 "への準拠の度合いが高く、 多数のスレッドを作成した際の性能も高い。 NPTL は "
9471 "glibc 2.3.2 以降で利用可能である。 NPTL を利用するには Linux 2.6 カーネルに実"
9475 #: build/C/man7/pthreads.7:681
9477 "Both of these are so-called 1:1 implementations, meaning that each thread "
9478 "maps to a kernel scheduling entity. Both threading implementations employ "
9479 "the Linux B<clone>(2) system call. In NPTL, thread synchronization "
9480 "primitives (mutexes, thread joining, etc.) are implemented using the Linux "
9481 "B<futex>(2) system call."
9483 "どちらの実装もいわゆる 1:1 実装、すなわち個々のスレッドが カーネルのスケ"
9484 "ジューリング実体にマッピングされる。 どちらのスレッドの実装も Linux の "
9485 "B<clone>(2) システムコールを利用している。 NPTL では、スレッド同期の基本機"
9486 "構 (mutex や スレッドの join 等) は Linux の B<futex>(2) システムコールを"
9490 #: build/C/man7/pthreads.7:681
9492 msgid "LinuxThreads"
9493 msgstr "LinuxThreads"
9496 #: build/C/man7/pthreads.7:683
9497 msgid "The notable features of this implementation are the following:"
9498 msgstr "この実装の大きな特徴は以下の通りである:"
9501 #: build/C/man7/pthreads.7:690
9503 "In addition to the main (initial) thread, and the threads that the program "
9504 "creates using B<pthread_create>(3), the implementation creates a \"manager\" "
9505 "thread. This thread handles thread creation and termination. (Problems can "
9506 "result if this thread is inadvertently killed.)"
9508 "メインスレッド (最初のスレッド) とプログラムが B<pthread_create>(3) を使って"
9509 "作成したスレッドに加え、 この実装では「管理 (manager)」スレッドが作成され"
9510 "る。 管理スレッドはスレッドの作成と終了を取り扱う (このスレッドがうっかり "
9511 "kill されると、問題が起こることがある)。"
9514 #: build/C/man7/pthreads.7:702
9516 "Signals are used internally by the implementation. On Linux 2.2 and later, "
9517 "the first three real-time signals are used (see also B<signal>(7)). On "
9518 "older Linux kernels, B<SIGUSR1> and B<SIGUSR2> are used. Applications must "
9519 "avoid the use of whichever set of signals is employed by the implementation."
9521 "この実装では内部でシグナルを使用している。 Linux 2.2 以降では、リアルタイムシ"
9522 "グナルのうち最初の 3つが使われる (B<signal>(7) 参照)。 それ以前のカーネルで"
9523 "は B<SIGUSR1> と B<SIGUSR2> が使われる。 アプリケーションは、スレッド実装で利"
9524 "用されているシグナルを どれも使わないようにしなければならない。"
9527 #: build/C/man7/pthreads.7:709
9529 "Threads do not share process IDs. (In effect, LinuxThreads threads are "
9530 "implemented as processes which share more information than usual, but which "
9531 "do not share a common process ID.) LinuxThreads threads (including the "
9532 "manager thread) are visible as separate processes using B<ps>(1)."
9534 "スレッド間でプロセス ID を共有しない (実際には LinuxThreads のスレッドは通常"
9535 "よりは情報を共有するプロセスとして 実装されているが、一つの共通のプロセス ID "
9536 "を共有してはいない)。 (管理スレッドを含む) LinuxThreads スレッドは B<ps>(1) "
9537 "を使うと別のプロセスのように見える。"
9540 #: build/C/man7/pthreads.7:712
9542 "The LinuxThreads implementation deviates from the POSIX.1 specification in a "
9543 "number of ways, including the following:"
9545 "LinuxThreads の実装では POSIX.1 仕様から逸脱している点が いくつかある。以下に"
9549 #: build/C/man7/pthreads.7:716
9550 msgid "Calls to B<getpid>(2) return a different value in each thread."
9551 msgstr "B<getpid>(2) を呼び出したときに、スレッド毎に異なる値が返される。"
9554 #: build/C/man7/pthreads.7:725
9556 "Calls to B<getppid>(2) in threads other than the main thread return the "
9557 "process ID of the manager thread; instead B<getppid>(2) in these threads "
9558 "should return the same value as B<getppid>(2) in the main thread."
9560 "メインスレッド以外のスレッドで B<getppid>(2) を呼び出すと、管理スレッドのプ"
9561 "ロセス ID が返される。 本当は、これらのスレッドで B<getppid>(2) を呼んだ場合"
9562 "にはメインスレッドでの B<getppid>(2) と同じ値が返るべきである。"
9565 #: build/C/man7/pthreads.7:735
9567 "When one thread creates a new child process using B<fork>(2), any thread "
9568 "should be able to B<wait>(2) on the child. However, the implementation "
9569 "only allows the thread that created the child to B<wait>(2) on it."
9571 "あるスレッドが B<fork>(2) を使って新しい子プロセスを作成した場合、 どのス"
9572 "レッドでもこの子プロセスを B<wait>(2) できるべきである。しかしながら、この実"
9573 "装では子プロセスを作成した スレッドだけがこの子プロセスを B<wait>(2) でき"
9577 #: build/C/man7/pthreads.7:742
9579 "When a thread calls B<execve>(2), all other threads are terminated (as "
9580 "required by POSIX.1). However, the resulting process has the same PID as "
9581 "the thread that called B<execve>(2): it should have the same PID as the main "
9584 "あるスレッドが B<execve>(2) を呼び出した場合、他のスレッドは全て終了される "
9585 "(POSIX.1 の仕様通り)。 しかしながら、新しいプロセスは B<execve>(2) を呼んだ"
9586 "スレッドと同じ PID を持つ。正しくは メインスレッドと同じ PID を持つべきであ"
9590 #: build/C/man7/pthreads.7:749
9592 "Threads do not share user and group IDs. This can cause complications with "
9593 "set-user-ID programs and can cause failures in Pthreads functions if an "
9594 "application changes its credentials using B<seteuid>(2) or similar."
9596 "スレッド間でユーザ ID とグループ ID が共有されない このことは、set-user-ID プ"
9597 "ログラムで面倒な事態を招いたり、 アプリケーションが B<seteuid>(2) などを使っ"
9598 "て信用情報 (credentials) を変更した場合に Pthreads 関数が失敗する原因となる。"
9601 #: build/C/man7/pthreads.7:751
9602 msgid "Threads do not share a common session ID and process group ID."
9603 msgstr "スレッド間で共通のセッション ID やプロセスグループ ID を共有しない。"
9606 #: build/C/man7/pthreads.7:754
9607 msgid "Threads do not share record locks created using B<fcntl>(2)."
9609 "スレッド間で B<fcntl>(2) を使って作成されるレコード・ロックを共有しない。"
9612 #: build/C/man7/pthreads.7:760
9614 "The information returned by B<times>(2) and B<getrusage>(2) is per-thread "
9615 "rather than process-wide."
9617 "B<times>(2) と B<getrusage>(2) が返す情報がプロセス全体の情報でなくスレッド"
9621 #: build/C/man7/pthreads.7:763
9622 msgid "Threads do not share semaphore undo values (see B<semop>(2))."
9623 msgstr "スレッド間でセマフォのアンドゥ値 (B<semop>(2) 参照) を共有しない。"
9626 #: build/C/man7/pthreads.7:765
9627 msgid "Threads do not share interval timers."
9628 msgstr "スレッド間でインターバル・タイマを共有しない。"
9630 #. FIXME . bug report filed for NPTL nice nonconformance
9631 #. http://bugzilla.kernel.org/show_bug.cgi?id=6258
9632 #. Sep 08: there is a patch by Denys Vlasenko to address this
9633 #. "make setpriority POSIX compliant; introduce PRIO_THREAD extension"
9634 #. Monitor this to see if it makes it into mainline.
9636 #: build/C/man7/pthreads.7:767 build/C/man7/pthreads.7:804
9637 msgid "Threads do not share a common nice value."
9638 msgstr "スレッドは共通の nice 値を共有しない。"
9641 #: build/C/man7/pthreads.7:777
9643 "POSIX.1 distinguishes the notions of signals that are directed to the "
9644 "process as a whole and signals that are directed to individual threads. "
9645 "According to POSIX.1, a process-directed signal (sent using B<kill>(2), for "
9646 "example) should be handled by a single, arbitrarily selected thread within "
9647 "the process. LinuxThreads does not support the notion of process-directed "
9648 "signals: signals may only be sent to specific threads."
9650 "POSXI.1 では、全体としてのプロセスに送られるシグナルと、 個別のスレッドに送ら"
9651 "れるシグナルを区別して考えている。 POSIX.1 によると、プロセスに送られたシグナ"
9652 "ル (例えば B<kill>(2) を使って送る) は、そのプロセスに属すスレッドのうち 勝"
9653 "手に (arbitrarily) に選択された一つのスレッドにより処理される ことになってい"
9654 "る。LinuxThreads はプロセスに送られるシグナルの 概念に対応しておらず、シグナ"
9655 "ルは特定のスレッドにだけ送ることができる。"
9658 #: build/C/man7/pthreads.7:786
9660 "Threads have distinct alternate signal stack settings. However, a new "
9661 "thread's alternate signal stack settings are copied from the thread that "
9662 "created it, so that the threads initially share an alternate signal stack. "
9663 "(A new thread should start with no alternate signal stack defined. If two "
9664 "threads handle signals on their shared alternate signal stack at the same "
9665 "time, unpredictable program failures are likely to occur.)"
9667 "スレッドはそれぞれの独自の代替シグナルスタックの設定を持つ。 しかし、新しいス"
9668 "レッドの代替シグナルスタックの設定は そのスレッドを作成したスレッドからコピー"
9669 "され、そのため スレッドは最初は一つの代替シグナルスタックを共有する。 (仕様で"
9670 "は、新しいスレッドは代替シグナルスタックが定義されていない状態 で開始されるべ"
9671 "きとされている。 2つのスレッドが共有されている代替シグナルスタック上で同時に "
9672 "シグナルの処理を行った場合、予測不可能なプログラムのエラーが 起こり得る。)"
9675 #: build/C/man7/pthreads.7:786
9681 #: build/C/man7/pthreads.7:795
9683 "With NPTL, all of the threads in a process are placed in the same thread "
9684 "group; all members of a thread group share the same PID. NPTL does not "
9685 "employ a manager thread. NPTL makes internal use of the first two real-time "
9686 "signals (see also B<signal>(7)); these signals cannot be used in "
9689 "NPTL では、一つのプロセスの全てのスレッドは同じスレッド・グループ に属する; "
9690 "スレッド・グループの全メンバーは同じ PID を共有する。 NPTL は管理スレッド "
9691 "(manager thread) を利用しない。 NPTL は内部でリアルタイムシグナルのうち最初"
9692 "の 2つの番号を使用しており (B<signal>(7) 参照)、これらのシグナルはアプリケー"
9696 #: build/C/man7/pthreads.7:797
9697 msgid "NPTL still has at least one nonconformance with POSIX.1:"
9698 msgstr "NPTL にも POSIX.1 に準拠していない点が少なくとも一つある:"
9701 #: build/C/man7/pthreads.7:806
9702 msgid "Some NPTL nonconformances only occur with older kernels:"
9703 msgstr "NPTL の標準非準拠な点のうちいくつかは以前のカーネルでのみ発生する:"
9706 #: build/C/man7/pthreads.7:812
9708 "The information returned by B<times>(2) and B<getrusage>(2) is per-thread "
9709 "rather than process-wide (fixed in kernel 2.6.9)."
9711 "B<times>(2) と B<getrusage>(2) が返す情報がプロセス全体の情報でなくスレッド"
9712 "単位の情報である (カーネル 2.6.9 で修正された)。"
9715 #: build/C/man7/pthreads.7:814
9716 msgid "Threads do not share resource limits (fixed in kernel 2.6.10)."
9717 msgstr "スレッド間でリソース制限を共有しない (カーネル 2.6.10 で修正された)。"
9720 #: build/C/man7/pthreads.7:816
9721 msgid "Threads do not share interval timers (fixed in kernel 2.6.12)."
9723 "スレッド間でインターバル・タイマを共有しない (カーネル 2.6.12 で修正された)。"
9726 #: build/C/man7/pthreads.7:820
9728 "Only the main thread is permitted to start a new session using B<setsid>(2) "
9729 "(fixed in kernel 2.6.16)."
9731 "メインスレッドだけが B<setsid>(2) を使って新しいセッションを開始することがで"
9732 "きる (カーネル 2.6.16 で修正された)。"
9735 #: build/C/man7/pthreads.7:825
9737 "Only the main thread is permitted to make the process into a process group "
9738 "leader using B<setpgid>(2) (fixed in kernel 2.6.16)."
9740 "メインスレッドだけが B<setpgid>(2) を使ってそのプロセスをプロセス・グルー"
9741 "プ・リーダーにすることができる (カーネル 2.6.16 で修正された)。"
9744 #: build/C/man7/pthreads.7:831
9746 "Threads have distinct alternate signal stack settings. However, a new "
9747 "thread's alternate signal stack settings are copied from the thread that "
9748 "created it, so that the threads initially share an alternate signal stack "
9749 "(fixed in kernel 2.6.16)."
9751 "スレッドはそれぞれの独自の代替シグナルスタックの設定を持つ。 しかし、新しいス"
9752 "レッドの代替シグナルスタックの設定は そのスレッドを作成したスレッドからコピー"
9753 "され、そのため スレッドは最初は一つの代替シグナルスタックを共有する (カーネ"
9757 #: build/C/man7/pthreads.7:833
9758 msgid "Note the following further points about the NPTL implementation:"
9759 msgstr "NPTL の実装では以下の点についても注意すること:"
9762 #: build/C/man7/pthreads.7:847
9764 "If the stack size soft resource limit (see the description of "
9765 "B<RLIMIT_STACK> in B<setrlimit>(2)) is set to a value other than "
9766 "I<unlimited>, then this value defines the default stack size for new "
9767 "threads. To be effective, this limit must be set before the program is "
9768 "executed, perhaps using the I<ulimit -s> shell built-in command (I<limit "
9769 "stacksize> in the C shell)."
9771 "スタックサイズのリソースのソフト・リミット (B<setrlimit>(2) の "
9772 "B<RLIMIT_STACK> の説明を参照) が I<unlimited> 以外の値に設定されている場合、"
9773 "ソフト・リミットの値が 新しいスレッドのデフォルトのスタックサイズとなる。 設"
9774 "定を有効にするためには、プログラムを実行する前にリミット値を 設定しておかなけ"
9775 "ればならない。たいていは、シェルの組み込みコマンドの I<ulimit -s> (C シェルで"
9776 "は I<limit stacksize>) を使って設定する。"
9779 #: build/C/man7/pthreads.7:847
9781 msgid "Determining the Threading Implementation"
9785 #: build/C/man7/pthreads.7:852
9787 "Since glibc 2.3.2, the B<getconf>(1) command can be used to determine the "
9788 "system's threading implementation, for example:"
9790 "glibc 2.3.2 以降では、 B<getconf>(1) コマンドを使って、 システムのスレッド実"
9791 "装を判定することができる。 以下に例を示す:"
9794 #: build/C/man7/pthreads.7:857
9797 "bash$ getconf GNU_LIBPTHREAD_VERSION\n"
9800 "bash$ getconf GNU_LIBPTHREAD_VERSION\n"
9804 #: build/C/man7/pthreads.7:862
9806 "With older glibc versions, a command such as the following should be "
9807 "sufficient to determine the default threading implementation:"
9809 "ぞれ以前の glibc のバージョンでは、以下のようなコマンドで デフォルトのスレッ"
9813 #: build/C/man7/pthreads.7:868
9816 "bash$ $( ldd /bin/ls | grep libc.so | awk \\(aq{print $3}\\(aq ) | \\e\n"
9817 " egrep -i \\(aqthreads|nptl\\(aq\n"
9818 " Native POSIX Threads Library by Ulrich Drepper et al\n"
9820 "bash$ $( ldd /bin/ls | grep libc.so | awk \\(aq{print $3}\\(aq ) | \\e\n"
9821 " egrep -i \\(aqthreads|ntpl\\(aq\n"
9822 " Native POSIX Threads Library by Ulrich Drepper et al\n"
9825 #: build/C/man7/pthreads.7:870
9827 msgid "Selecting the Threading Implementation: LD_ASSUME_KERNEL"
9828 msgstr "スレッドの実装の選択: LD_ASSUME_KERNEL"
9831 #: build/C/man7/pthreads.7:885
9833 "On systems with a glibc that supports both LinuxThreads and NPTL (i.e., "
9834 "glibc 2.3.I<x>), the B<LD_ASSUME_KERNEL> environment variable can be used to "
9835 "override the dynamic linker's default choice of threading implementation. "
9836 "This variable tells the dynamic linker to assume that it is running on top "
9837 "of a particular kernel version. By specifying a kernel version that does "
9838 "not provide the support required by NPTL, we can force the use of "
9839 "LinuxThreads. (The most likely reason for doing this is to run a (broken) "
9840 "application that depends on some nonconformant behavior in LinuxThreads.) "
9843 "LinuxThreads と NPTL の両方をサポートしている glibc (glibc 2.3.I<x>) があるシ"
9844 "ステムでは、 B<LD_ASSUME_KERNEL> 環境変数を使うことで、動的リンカがデフォルト"
9845 "で 選択するスレッド実装を上書きすることができる。 この変数により、動的リンカ"
9846 "が特定のバージョンのカーネル上で 動作していると仮定するように指定する。 NPTL "
9847 "が必要とするサポート機能を提供していないカーネルバージョンを 指定することで、"
9848 "強制的に LinuxThreads を使うことができる (このようなことをする最もありそうな"
9849 "場面は、 LinuxThreads の標準非準拠な振舞いに依存する (壊れた) アプリケーショ"
9850 "ン を動作させる場合だろう)。 以下に例を示す:"
9853 #: build/C/man7/pthreads.7:891
9856 "bash$ $( LD_ASSUME_KERNEL=2.2.5 ldd /bin/ls | grep libc.so | \\e\n"
9857 " awk \\(aq{print $3}\\(aq ) | egrep -i \\(aqthreads|ntpl\\(aq\n"
9858 " linuxthreads-0.10 by Xavier Leroy\n"
9860 "bash$ $( LD_ASSUME_KERNEL=2.2.5 ldd /bin/ls | grep libc.so | \\e\n"
9861 " awk \\(aq{print $3}\\(aq ) | egrep -i \\(aqthreads|ntpl\\(aq\n"
9862 " linuxthreads-0.10 by Xavier Leroy\n"
9865 #: build/C/man7/pthreads.7:903
9867 "B<clone>(2), B<futex>(2), B<gettid>(2), B<proc>(5), B<futex>(7), B<sigevent>"
9868 "(7), B<signal>(7),"
9870 "B<clone>(2), B<futex>(2), B<gettid>(2), B<futex>(7), B<sigevent>(7), "
9874 #: build/C/man7/pthreads.7:927
9876 "and various Pthreads manual pages, for example: B<pthread_attr_init>(3), "
9877 "B<pthread_atfork>(3), B<pthread_cancel>(3), B<pthread_cleanup_push>(3), "
9878 "B<pthread_cond_signal>(3), B<pthread_cond_wait>(3), B<pthread_create>(3), "
9879 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), "
9880 "B<pthread_key_create>(3), B<pthread_kill>(3), B<pthread_mutex_lock>(3), "
9881 "B<pthread_mutex_unlock>(3), B<pthread_once>(3), B<pthread_setcancelstate>"
9882 "(3), B<pthread_setcanceltype>(3), B<pthread_setspecific>(3), "
9883 "B<pthread_sigmask>(3), B<pthread_sigqueue>(3), and B<pthread_testcancel>(3)"
9885 "および Pthreads の各種マニュアルページ、例えば: B<pthread_attr_init>(3),\n"
9886 "B<pthread_atfork>(3), B<pthread_cancel>(3), B<pthread_cleanup_push>(3),\n"
9887 "B<pthread_cond_signal>(3), B<pthread_cond_wait>(3), B<pthread_create>(3),\n"
9888 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3),\n"
9889 "B<pthread_key_create>(3), B<pthread_kill>(3), B<pthread_mutex_lock>(3),\n"
9890 "B<pthread_mutex_unlock>(3), B<pthread_once>(3),\n"
9891 "B<pthread_setcancelstate>(3), B<pthread_setcanceltype>(3),\n"
9892 "B<pthread_setspecific>(3), B<pthread_sigmask>(3), B<pthread_sigqueue>(3),\n"
9893 "and B<pthread_testcancel>(3)"
9895 #~ msgid "2008-11-10"
9896 #~ msgstr "2008-11-10"
9898 #~ msgid "2008-11-05"
9899 #~ msgstr "2008-11-05"
9901 #~ msgid "2008-11-18"
9902 #~ msgstr "2008-11-18"