Debian Codegraph @

po/fr/man3/pthread_attr_init.3.po

raw
1 # French translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Christophe Blaess <https://www.blaess.fr/christophe/>, 1996-2003.
5 # Stéphan Rafin <[email protected]>, 2002.
6 # Thierry Vignaud <[email protected]>, 1999, 2002.
7 # François Micaux, 2002.
8 # Alain Portal <[email protected]>, 2003-2008.
9 # Jean-Philippe Guérard <[email protected]>, 2005-2006.
10 # Jean-Luc Coulon (f5ibh) <[email protected]>, 2006-2007.
11 # Julien Cristau <[email protected]>, 2006-2007.
12 # Thomas Huriaux <[email protected]>, 2006-2008.
13 # Nicolas François <[email protected]>, 2006-2008.
14 # Florentin Duneau <[email protected]>, 2006-2010.
15 # Simon Paillard <[email protected]>, 2006.
16 # Denis Barbier <[email protected]>, 2006, 2010.
17 # David Prévot <[email protected]>, 2010, 2012.
18 # Frédéric Hantrais <[email protected]>, 2013, 2014.
19 # Jean-Pierre Giraud <[email protected]>, 2023-2025.
20 msgid ""
21 msgstr ""
22 "Project-Id-Version: manpages-l10n 4.22.0\n"
23 "POT-Creation-Date: 2026-06-05 06:38+0200\n"
24 "PO-Revision-Date: 2025-05-28 23:38+0200\n"
25 "Last-Translator: Jean-Pierre Giraud <[email protected]>\n"
26 "Language-Team: French <[email protected]>\n"
27 "Language: fr\n"
28 "MIME-Version: 1.0\n"
29 "Content-Type: text/plain; charset=UTF-8\n"
30 "Content-Transfer-Encoding: 8bit\n"
31 "Plural-Forms: nplurals=2; plural=n > 1;\n"
32 "X-Generator: Lokalize 22.12.3\n"
33
34 #. type: TH
35 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
36 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
37 #, no-wrap
38 msgid "pthread_attr_init"
39 msgstr "pthread_attr_init"
40
41 #. type: TH
42 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
43 #: opensuse-tumbleweed
44 #, no-wrap
45 msgid "2025-09-21"
46 msgstr "21 septembre 2025"
47
48 #. type: TH
49 #: archlinux debian-unstable
50 #, no-wrap
51 msgid "Linux man-pages 6.18"
52 msgstr "Pages du manuel de Linux 6.18"
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "NAME"
59 msgstr "NOM"
60
61 #. type: Plain text
62 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
63 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
64 msgid ""
65 "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread "
66 "attributes object"
67 msgstr ""
68 "pthread_attr_init, pthread_attr_destroy — Initialiser et détruire un objet "
69 "d'attributs de thread"
70
71 #. type: SH
72 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
73 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
74 #, no-wrap
75 msgid "LIBRARY"
76 msgstr "BIBLIOTHÈQUE"
77
78 #. type: Plain text
79 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
80 #: opensuse-leap-16-1 opensuse-tumbleweed
81 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
82 msgstr "Bibliothèque de threads POSIX (I<libpthread>,\\ I<-lpthread>)"
83
84 #. type: SH
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 #, no-wrap
88 msgid "SYNOPSIS"
89 msgstr "SYNOPSIS"
90
91 #. type: Plain text
92 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
93 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
94 #, no-wrap
95 msgid "B<#include E<lt>pthread.hE<gt>>\n"
96 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
97
98 #. type: Plain text
99 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
100 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
101 #, no-wrap
102 msgid ""
103 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
104 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
105 msgstr ""
106 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
107 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
108
109 #. type: SH
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 #, no-wrap
113 msgid "DESCRIPTION"
114 msgstr "DESCRIPTION"
115
116 #. type: Plain text
117 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
118 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
119 msgid ""
120 "The B<pthread_attr_init>() function initializes the thread attributes "
121 "object pointed to by I<attr> with default attribute values. After this "
122 "call, individual attributes of the object can be set using various related "
123 "functions (listed under SEE ALSO), and then the object can be used in one or "
124 "more B<pthread_create>(3) calls that create threads."
125 msgstr ""
126 "La fonction B<pthread_attr_init>() initialise l'objet d'attributs de thread "
127 "pointé par I<attr> avec des valeurs d'attributs par défaut. Après cet appel, "
128 "les attributs individuels de cet objet peuvent être modifiés en utilisant "
129 "diverses fonctions (listées dans la section VOIR AUSSI), et l'objet peut "
130 "alors être utilisé dans un ou plusieurs appels de B<pthread_create>(3) pour "
131 "créer des threads."
132
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "Calling B<pthread_attr_init>() on a thread attributes object that has "
138 "already been initialized results in undefined behavior."
139 msgstr ""
140 "Appeler B<pthread_attr_init>() sur un objet d'attributs de thread qui a déjà "
141 "été initialisé résulte en un comportement indéfini."
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid ""
147 "When a thread attributes object is no longer required, it should be "
148 "destroyed using the B<pthread_attr_destroy>() function. Destroying a "
149 "thread attributes object has no effect on threads that were created using "
150 "that object."
151 msgstr ""
152 "Quand un objet d'attributs de thread n'est plus nécessaire, il devrait être "
153 "détruit en appelant la fonction B<pthread_attr_destroy>(). Détruire un objet "
154 "d'attributs de thread n'a aucun effet sur les threads qui ont été créés en "
155 "utilisant cet objet."
156
157 #. type: Plain text
158 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
159 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
160 msgid ""
161 "Once a thread attributes object has been destroyed, it can be reinitialized "
162 "using B<pthread_attr_init>(). Any other use of a destroyed thread "
163 "attributes object has undefined results."
164 msgstr ""
165 "Dès qu'un objet d'attributs de thread a été détruit, il peut être "
166 "réinitialisé en appelant B<pthread_attr_init>(). Toute autre utilisation "
167 "d'un objet d'attributs de thread entraîne des résultats indéfinis."
168
169 #. type: SH
170 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
171 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
172 #, no-wrap
173 msgid "RETURN VALUE"
174 msgstr "VALEUR RENVOYÉE"
175
176 #. type: Plain text
177 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
178 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
179 msgid ""
180 "On success, these functions return 0; on error, they return a nonzero error "
181 "number."
182 msgstr ""
183 "En cas de succès, ces fonctions renvoient B<0> ; en cas d'erreur, elles "
184 "renvoient un code d'erreur non nul."
185
186 #. type: SH
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 #, no-wrap
190 msgid "ERRORS"
191 msgstr "ERREURS"
192
193 #. type: Plain text
194 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
195 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
196 msgid ""
197 "POSIX.1 documents an B<ENOMEM> error for B<pthread_attr_init>(); on Linux "
198 "these functions always succeed (but portable and future-proof applications "
199 "should nevertheless handle a possible error return)."
200 msgstr ""
201 "POSIX.1 documente une erreur B<ENOMEM> pour B<pthread_attr_init>(). Sous "
202 "Linux, ces fonctions réussissent toujours (mais les applications portables "
203 "et à l'épreuve du temps devraient néanmoins prendre en charge une possible "
204 "valeur de retour)."
205
206 #. type: SH
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 #, no-wrap
210 msgid "ATTRIBUTES"
211 msgstr "ATTRIBUTS"
212
213 #. type: Plain text
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 msgid ""
217 "For an explanation of the terms used in this section, see B<attributes>(7)."
218 msgstr ""
219 "Pour une explication des termes utilisés dans cette section, consulter "
220 "B<attributes>(7)."
221
222 #. type: tbl table
223 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
224 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
225 #, no-wrap
226 msgid "Interface"
227 msgstr "Interface"
228
229 #. type: tbl table
230 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
231 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
232 #, no-wrap
233 msgid "Attribute"
234 msgstr "Attribut"
235
236 #. type: tbl table
237 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
238 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
239 #, no-wrap
240 msgid "Value"
241 msgstr "Valeur"
242
243 #. type: tbl table
244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
246 #, no-wrap
247 msgid ".na\n"
248 msgstr ".na\n"
249
250 #. type: tbl table
251 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
252 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
253 #, no-wrap
254 msgid ".nh\n"
255 msgstr ".nh\n"
256
257 #. type: tbl table
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 #, no-wrap
261 msgid ""
262 "B<pthread_attr_init>(),\n"
263 "B<pthread_attr_destroy>()"
264 msgstr ""
265 "B<pthread_attr_init>(),\n"
266 "B<pthread_attr_destroy>()"
267
268 #. type: tbl table
269 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
270 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
271 #, no-wrap
272 msgid "Thread safety"
273 msgstr "Sécurité des threads"
274
275 #. type: tbl table
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 #, no-wrap
279 msgid "MT-Safe"
280 msgstr "MT-Safe"
281
282 #. type: SH
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 #, no-wrap
286 msgid "STANDARDS"
287 msgstr "NORMES"
288
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 msgid "POSIX.1-2008."
293 msgstr "POSIX.1-2008."
294
295 #. type: SH
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 #, no-wrap
299 msgid "HISTORY"
300 msgstr "HISTORIQUE"
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid "POSIX.1-2001."
306 msgstr "POSIX.1-2001."
307
308 #. type: SH
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 #, no-wrap
312 msgid "NOTES"
313 msgstr "NOTES"
314
315 #. type: Plain text
316 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
317 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
318 msgid ""
319 "The I<pthread_attr_t> type should be treated as opaque: any access to the "
320 "object other than via pthreads functions is nonportable and produces "
321 "undefined results."
322 msgstr ""
323 "Le type I<pthread_attr_t> doit être traité comme opaque\\ ; tout accès à "
324 "l'objet en dehors des fonctions pthreads n'est pas portable et peut produire "
325 "des résultats indéfinis."
326
327 #. type: SH
328 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
329 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
330 #, no-wrap
331 msgid "EXAMPLES"
332 msgstr "EXEMPLES"
333
334 #. type: Plain text
335 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
336 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
337 msgid ""
338 "The program below optionally makes use of B<pthread_attr_init>() and "
339 "various related functions to initialize a thread attributes object that is "
340 "used to create a single thread. Once created, the thread uses the "
341 "B<pthread_getattr_np>(3) function (a nonstandard GNU extension) to retrieve "
342 "the thread's attributes, and then displays those attributes."
343 msgstr ""
344 "Le programme ci-dessous fait un appel optionnel à B<pthread_attr_init>() et "
345 "à d'autres fonctions similaires pour initialiser un objet d'attributs de "
346 "thread afin de l'utiliser pour créer un thread unique. Une fois créé, le "
347 "thread utilise la fonction B<pthread_getattr_np>(3) (une extension GNU non "
348 "standard) pour récupérer les attributs de thread et les afficher."
349
350 #. type: Plain text
351 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
352 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
353 msgid ""
354 "If the program is run with no command-line argument, then it passes NULL as "
355 "the I<attr> argument of B<pthread_create>(3), so that the thread is created "
356 "with default attributes. Running the program on Linux/x86-32 with the NPTL "
357 "threading implementation, we see the following:"
358 msgstr ""
359 "Si le programme est exécuté sans argument sur la ligne de commande, alors il "
360 "passe NULL comme valeur de l'argument I<attr> de B<pthread_create>(3), si "
361 "bien que le thread est créé avec les attributs par défaut. En exécutant ce "
362 "programme sur Linux/x86-32 avec l'implémentation NPTL, l'affichage sera\\ :"
363
364 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
365 #. type: Plain text
366 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
367 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
368 #, no-wrap
369 msgid ""
370 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
371 "unlimited\n"
372 "$B< ./a.out>\n"
373 "Thread attributes:\n"
374 " Detach state = PTHREAD_CREATE_JOINABLE\n"
375 " Scope = PTHREAD_SCOPE_SYSTEM\n"
376 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
377 " Scheduling policy = SCHED_OTHER\n"
378 " Scheduling priority = 0\n"
379 " Guard size = 4096 bytes\n"
380 " Stack address = 0x40196000\n"
381 " Stack size = 0x201000 bytes\n"
382 msgstr ""
383 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
384 "unlimited\n"
385 "$B< ./a.out>\n"
386 "Thread attributes:\n"
387 " Detach state = PTHREAD_CREATE_JOINABLE\n"
388 " Scope = PTHREAD_SCOPE_SYSTEM\n"
389 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
390 " Scheduling policy = SCHED_OTHER\n"
391 " Scheduling priority = 0\n"
392 " Guard size = 4096 bytes\n"
393 " Stack address = 0x40196000\n"
394 " Stack size = 0x201000 bytes\n"
395
396 #. type: Plain text
397 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
398 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
399 msgid ""
400 "When we supply a stack size as a command-line argument, the program "
401 "initializes a thread attributes object, sets various attributes in that "
402 "object, and passes a pointer to the object in the call to "
403 "B<pthread_create>(3). Running the program on Linux/x86-32 with the NPTL "
404 "threading implementation, we see the following:"
405 msgstr ""
406 "Quand une taille de pile est passée sur la ligne de commande, le programme "
407 "initialise un objet d'attributs de thread, modifie divers attributs de cet "
408 "objet, et passe un pointeur sur cet objet dans l'appel à "
409 "B<pthread_create>(3). En exécutant ce programme sur Linux/x86-32 avec "
410 "l'implémentation NPTL, l'affichage sera\\ :"
411
412 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
413 #. type: Plain text
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 #, no-wrap
417 msgid ""
418 "$B< ./a.out 0x3000000>\n"
419 "posix_memalign() allocated at 0x40197000\n"
420 "Thread attributes:\n"
421 " Detach state = PTHREAD_CREATE_DETACHED\n"
422 " Scope = PTHREAD_SCOPE_SYSTEM\n"
423 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
424 " Scheduling policy = SCHED_OTHER\n"
425 " Scheduling priority = 0\n"
426 " Guard size = 0 bytes\n"
427 " Stack address = 0x40197000\n"
428 " Stack size = 0x3000000 bytes\n"
429 msgstr ""
430 "$B< ./a.out 0x3000000>\n"
431 "posix_memalign() allocated at 0x40197000\n"
432 "Thread attributes:\n"
433 " Detach state = PTHREAD_CREATE_DETACHED\n"
434 " Scope = PTHREAD_SCOPE_SYSTEM\n"
435 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
436 " Scheduling policy = SCHED_OTHER\n"
437 " Scheduling priority = 0\n"
438 " Guard size = 0 bytes\n"
439 " Stack address = 0x40197000\n"
440 " Stack size = 0x3000000 bytes\n"
441
442 #. type: SS
443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
445 #, no-wrap
446 msgid "Program source"
447 msgstr "Source du programme"
448
449 #. type: Plain text
450 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
451 #: opensuse-tumbleweed
452 #, fuzzy, no-wrap
453 #| msgid ""
454 #| "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
455 #| "#include E<lt>err.hE<gt>\n"
456 #| "#include E<lt>errno.hE<gt>\n"
457 #| "#include E<lt>pthread.hE<gt>\n"
458 #| "#include E<lt>stdio.hE<gt>\n"
459 #| "#include E<lt>stdlib.hE<gt>\n"
460 #| "#include E<lt>unistd.hE<gt>\n"
461 #| "\\&\n"
462 #| "static void\n"
463 #| "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
464 #| "{\n"
465 #| " int s, i;\n"
466 #| " size_t v;\n"
467 #| " void *stkaddr;\n"
468 #| " struct sched_param sp;\n"
469 #| "\\&\n"
470 #| " s = pthread_attr_getdetachstate(attr, &i);\n"
471 #| " if (s != 0)\n"
472 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
473 #| " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
474 #| " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
475 #| " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
476 #| " \"???\");\n"
477 #| "\\&\n"
478 #| " s = pthread_attr_getscope(attr, &i);\n"
479 #| " if (s != 0)\n"
480 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
481 #| " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
482 #| " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
483 #| " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
484 #| " \"???\");\n"
485 #| "\\&\n"
486 #| " s = pthread_attr_getinheritsched(attr, &i);\n"
487 #| " if (s != 0)\n"
488 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
489 #| " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
490 #| " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
491 #| " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
492 #| " \"???\");\n"
493 #| "\\&\n"
494 #| " s = pthread_attr_getschedpolicy(attr, &i);\n"
495 #| " if (s != 0)\n"
496 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
497 #| " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
498 #| " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
499 #| " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
500 #| " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
501 #| " \"???\");\n"
502 #| "\\&\n"
503 #| " s = pthread_attr_getschedparam(attr, &sp);\n"
504 #| " if (s != 0)\n"
505 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
506 #| " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
507 #| "\\&\n"
508 #| " s = pthread_attr_getguardsize(attr, &v);\n"
509 #| " if (s != 0)\n"
510 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
511 #| " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
512 #| "\\&\n"
513 #| " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
514 #| " if (s != 0)\n"
515 #| " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
516 #| " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
517 #| " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
518 #| "}\n"
519 #| "\\&\n"
520 #| "static void *\n"
521 #| "thread_start(void *arg)\n"
522 #| "{\n"
523 #| " int s;\n"
524 #| " pthread_attr_t gattr;\n"
525 #| "\\&\n"
526 #| " /* pthread_getattr_np() is a non-standard GNU extension that\n"
527 #| " retrieves the attributes of the thread specified in its\n"
528 #| " first argument. */\n"
529 #| "\\&\n"
530 #| " s = pthread_getattr_np(pthread_self(), &gattr);\n"
531 #| " if (s != 0)\n"
532 #| " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
533 #| "\\&\n"
534 #| " printf(\"Thread attributes:\\[rs]n\");\n"
535 #| " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
536 #| "\\&\n"
537 #| " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
538 #| "}\n"
539 #| "\\&\n"
540 #| "int\n"
541 #| "main(int argc, char *argv[])\n"
542 #| "{\n"
543 #| " pthread_t thr;\n"
544 #| " pthread_attr_t attr;\n"
545 #| " pthread_attr_t *attrp; /* NULL or &attr */\n"
546 #| " int s;\n"
547 #| "\\&\n"
548 #| " attrp = NULL;\n"
549 #| "\\&\n"
550 #| " /* If a command-line argument was supplied, use it to set the\n"
551 #| " stack-size attribute and set a few other thread attributes,\n"
552 #| " and set attrp pointing to thread attributes object. */\n"
553 #| "\\&\n"
554 #| " if (argc E<gt> 1) {\n"
555 #| " size_t stack_size;\n"
556 #| " void *sp;\n"
557 #| "\\&\n"
558 #| " attrp = &attr;\n"
559 #| "\\&\n"
560 #| " s = pthread_attr_init(&attr);\n"
561 #| " if (s != 0)\n"
562 #| " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
563 #| "\\&\n"
564 #| " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
565 #| " if (s != 0)\n"
566 #| " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
567 #| "\\&\n"
568 #| " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
569 #| " if (s != 0)\n"
570 #| " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
571 #| "\\&\n"
572 #| " stack_size = strtoul(argv[1], NULL, 0);\n"
573 #| "\\&\n"
574 #| " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
575 #| " if (s != 0)\n"
576 #| " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
577 #| "\\&\n"
578 #| " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
579 #| "\\&\n"
580 #| " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
581 #| " if (s != 0)\n"
582 #| " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
583 #| " }\n"
584 #| "\\&\n"
585 #| " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
586 #| " if (s != 0)\n"
587 #| " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
588 #| "\\&\n"
589 #| " if (attrp != NULL) {\n"
590 #| " s = pthread_attr_destroy(attrp);\n"
591 #| " if (s != 0)\n"
592 #| " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
593 #| " }\n"
594 #| "\\&\n"
595 #| " pause(); /* Terminates when other thread calls exit() */\n"
596 #| "}\n"
597 msgid ""
598 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
599 "#include E<lt>err.hE<gt>\n"
600 "#include E<lt>errno.hE<gt>\n"
601 "#include E<lt>pthread.hE<gt>\n"
602 "#include E<lt>stdio.hE<gt>\n"
603 "#include E<lt>stdlib.hE<gt>\n"
604 "#include E<lt>unistd.hE<gt>\n"
605 "\\&\n"
606 "static void\n"
607 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
608 "{\n"
609 " int s, i;\n"
610 " size_t v;\n"
611 " void *stkaddr;\n"
612 " struct sched_param sp;\n"
613 "\\&\n"
614 " s = pthread_attr_getdetachstate(attr, &i);\n"
615 " if (s != 0)\n"
616 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
617 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
618 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
619 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
620 " \"???\");\n"
621 "\\&\n"
622 " s = pthread_attr_getscope(attr, &i);\n"
623 " if (s != 0)\n"
624 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
625 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
626 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
627 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
628 " \"???\");\n"
629 "\\&\n"
630 " s = pthread_attr_getinheritsched(attr, &i);\n"
631 " if (s != 0)\n"
632 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
633 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
634 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
635 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
636 " \"???\");\n"
637 "\\&\n"
638 " s = pthread_attr_getschedpolicy(attr, &i);\n"
639 " if (s != 0)\n"
640 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
641 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
642 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
643 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
644 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
645 " \"???\");\n"
646 "\\&\n"
647 " s = pthread_attr_getschedparam(attr, &sp);\n"
648 " if (s != 0)\n"
649 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
650 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
651 "\\&\n"
652 " s = pthread_attr_getguardsize(attr, &v);\n"
653 " if (s != 0)\n"
654 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
655 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
656 "\\&\n"
657 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
658 " if (s != 0)\n"
659 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
660 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
661 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
662 "}\n"
663 "\\&\n"
664 "static void *\n"
665 "thread_start(void *arg)\n"
666 "{\n"
667 " int s;\n"
668 " pthread_attr_t gattr;\n"
669 "\\&\n"
670 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
671 " retrieves the attributes of the thread specified in its\n"
672 " first argument. */\n"
673 "\\&\n"
674 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
675 " if (s != 0)\n"
676 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
677 "\\&\n"
678 " printf(\"Thread attributes:\\[rs]n\");\n"
679 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
680 "\\&\n"
681 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
682 "}\n"
683 "\\&\n"
684 "int\n"
685 "main(int argc, char *argv[])\n"
686 "{\n"
687 " pthread_t thr;\n"
688 " pthread_attr_t attr;\n"
689 " pthread_attr_t *attrp; /* NULL or &attr */\n"
690 " int s;\n"
691 "\\&\n"
692 " attrp = NULL;\n"
693 "\\&\n"
694 " /* If a command-line argument was supplied, use it to set the\n"
695 " stack-size attribute and set a few other thread attributes,\n"
696 " and set attrp pointing to thread attributes object. */\n"
697 "\\&\n"
698 " if (argc E<gt> 1) {\n"
699 " size_t stack_size;\n"
700 " void *sp;\n"
701 "\\&\n"
702 " attrp = &attr;\n"
703 "\\&\n"
704 " s = pthread_attr_init(&attr);\n"
705 " if (s != 0)\n"
706 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
707 "\\&\n"
708 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
709 " if (s != 0)\n"
710 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
711 "\\&\n"
712 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
713 " if (s != 0)\n"
714 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
715 "\\&\n"
716 " stack_size = strtoul(argv[1], NULL, 0);\n"
717 "\\&\n"
718 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
719 " if (s != 0)\n"
720 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
721 "\\&\n"
722 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
723 "\\&\n"
724 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
725 " if (s != 0)\n"
726 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
727 " }\n"
728 "\\&\n"
729 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
730 " if (s != 0)\n"
731 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
732 "\\&\n"
733 " if (attrp != NULL) {\n"
734 " s = pthread_attr_destroy(attrp);\n"
735 " if (s != 0)\n"
736 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
737 " }\n"
738 "\\&\n"
739 " pause(); /* Terminates when other thread calls exit() */\n"
740 "}\n"
741 msgstr ""
742 "#define _GNU_SOURCE /* Pour obtenir la déclaration de pthread_getattr_np() */\n"
743 "#include E<lt>err.hE<gt>\n"
744 "#include E<lt>errno.hE<gt>\n"
745 "#include E<lt>pthread.hE<gt>\n"
746 "#include E<lt>stdio.hE<gt>\n"
747 "#include E<lt>stdlib.hE<gt>\n"
748 "#include E<lt>unistd.hE<gt>\n"
749 "\\&\n"
750 "static void\n"
751 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
752 "{\n"
753 " int s, i;\n"
754 " size_t v;\n"
755 " void *stkaddr;\n"
756 " struct sched_param sp;\n"
757 "\\&\n"
758 " s = pthread_attr_getdetachstate(attr, &i);\n"
759 " if (s != 0)\n"
760 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
761 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
762 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
763 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
764 " \"???\");\n"
765 "\\&\n"
766 " s = pthread_attr_getscope(attr, &i);\n"
767 " if (s != 0)\n"
768 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
769 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
770 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
771 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
772 " \"???\");\n"
773 "\\&\n"
774 " s = pthread_attr_getinheritsched(attr, &i);\n"
775 " if (s != 0)\n"
776 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
777 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
778 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
779 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
780 " \"???\");\n"
781 "\\&\n"
782 " s = pthread_attr_getschedpolicy(attr, &i);\n"
783 " if (s != 0)\n"
784 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
785 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
786 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
787 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
788 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
789 " \"???\");\n"
790 "\\&\n"
791 " s = pthread_attr_getschedparam(attr, &sp);\n"
792 " if (s != 0)\n"
793 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
794 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
795 "\\&\n"
796 " s = pthread_attr_getguardsize(attr, &v);\n"
797 " if (s != 0)\n"
798 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
799 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
800 "\\&\n"
801 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
802 " if (s != 0)\n"
803 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
804 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
805 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
806 "}\n"
807 "\\&\n"
808 "static void *\n"
809 "thread_start(void *arg)\n"
810 "{\n"
811 " int s;\n"
812 " pthread_attr_t gattr;\n"
813 "\\&\n"
814 " /* pthread_getattr_np() est une extension GNU non standard qui\n"
815 " extrait les attributs du thread spécifié dans son premier\n"
816 " argument. */\n"
817 "\\&\n"
818 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
819 " if (s != 0)\n"
820 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
821 "\\&\n"
822 " printf(\"Thread attributes:\\[rs]n\");\n"
823 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
824 "\\&\n"
825 " exit(EXIT_SUCCESS); /* Terminer tous les threads */\n"
826 "}\n"
827 "\\&\n"
828 "int\n"
829 "main(int argc, char *argv[])\n"
830 "{\n"
831 " pthread_t thr;\n"
832 " pthread_attr_t attr;\n"
833 " pthread_attr_t *attrp; /* NULL or &attr */\n"
834 " int s;\n"
835 "\\&\n"
836 " attrp = NULL;\n"
837 "\\&\n"
838 " /* Si un argument en ligne de commande a été fourni, utilisez le\n"
839 " pour définir l'attribut de taille de la pile et quelques autres\n"
840 " attributs du thread ainsi que l'attribut attrp pointant sur\n"
841 " l'objet d'attributs de thread. */\n"
842 "\\&\n"
843 " if (argc E<gt> 1) {\n"
844 " size_t stack_size;\n"
845 " void *sp;\n"
846 "\\&\n"
847 " attrp = &attr;\n"
848 "\\&\n"
849 " s = pthread_attr_init(&attr);\n"
850 " if (s != 0)\n"
851 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
852 "\\&\n"
853 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
854 " if (s != 0)\n"
855 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
856 "\\&\n"
857 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
858 " if (s != 0)\n"
859 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
860 "\\&\n"
861 " stack_size = strtoul(argv[1], NULL, 0);\n"
862 "\\&\n"
863 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
864 " if (s != 0)\n"
865 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
866 "\\&\n"
867 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
868 "\\&\n"
869 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
870 " if (s != 0)\n"
871 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
872 " }\n"
873 "\\&\n"
874 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
875 " if (s != 0)\n"
876 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
877 "\\&\n"
878 " if (attrp != NULL) {\n"
879 " s = pthread_attr_destroy(attrp);\n"
880 " if (s != 0)\n"
881 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
882 " }\n"
883 "\\&\n"
884 " pause(); /* Termine quand un autre thread appelle exit() */\n"
885 "}\n"
886
887 #. SRC END
888 #. type: SH
889 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
890 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
891 #, no-wrap
892 msgid "SEE ALSO"
893 msgstr "VOIR AUSSI"
894
895 #. type: Plain text
896 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
897 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
898 msgid ""
899 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
900 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
901 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
902 "B<pthread_attr_setscope>(3), B<pthread_attr_setsigmask_np>(3), "
903 "B<pthread_attr_setstack>(3), B<pthread_attr_setstackaddr>(3), "
904 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), "
905 "B<pthread_getattr_np>(3), B<pthread_setattr_default_np>(3), B<pthreads>(7)"
906 msgstr ""
907 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
908 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
909 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
910 "B<pthread_attr_setscope>(3), B<pthread_attr_setsigmask_np>(3), "
911 "B<pthread_attr_setstack>(3), B<pthread_attr_setstackaddr>(3), "
912 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), "
913 "B<pthread_getattr_np>(3), B<pthread_setattr_default_np>(3), B<pthreads>(7)"
914
915 #. type: TH
916 #: debian-trixie
917 #, no-wrap
918 msgid "2024-06-15"
919 msgstr "15 juin 2024"
920
921 #. type: TH
922 #: debian-trixie
923 #, no-wrap
924 msgid "Linux man-pages 6.9.1"
925 msgstr "Pages du manuel de Linux 6.9.1"
926
927 #. type: Plain text
928 #: debian-trixie
929 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
930 msgstr "Bibliothèque de threads POSIX (I<libpthread>, I<-lpthread>)"
931
932 #. type: Plain text
933 #: debian-trixie fedora-44 fedora-rawhide
934 #, no-wrap
935 msgid ""
936 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
937 "#include E<lt>err.hE<gt>\n"
938 "#include E<lt>errno.hE<gt>\n"
939 "#include E<lt>pthread.hE<gt>\n"
940 "#include E<lt>stdio.hE<gt>\n"
941 "#include E<lt>stdlib.hE<gt>\n"
942 "#include E<lt>unistd.hE<gt>\n"
943 "\\&\n"
944 "static void\n"
945 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
946 "{\n"
947 " int s, i;\n"
948 " size_t v;\n"
949 " void *stkaddr;\n"
950 " struct sched_param sp;\n"
951 "\\&\n"
952 " s = pthread_attr_getdetachstate(attr, &i);\n"
953 " if (s != 0)\n"
954 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
955 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
956 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
957 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
958 " \"???\");\n"
959 "\\&\n"
960 " s = pthread_attr_getscope(attr, &i);\n"
961 " if (s != 0)\n"
962 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
963 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
964 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
965 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
966 " \"???\");\n"
967 "\\&\n"
968 " s = pthread_attr_getinheritsched(attr, &i);\n"
969 " if (s != 0)\n"
970 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
971 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
972 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
973 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
974 " \"???\");\n"
975 "\\&\n"
976 " s = pthread_attr_getschedpolicy(attr, &i);\n"
977 " if (s != 0)\n"
978 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
979 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
980 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
981 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
982 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
983 " \"???\");\n"
984 "\\&\n"
985 " s = pthread_attr_getschedparam(attr, &sp);\n"
986 " if (s != 0)\n"
987 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
988 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
989 "\\&\n"
990 " s = pthread_attr_getguardsize(attr, &v);\n"
991 " if (s != 0)\n"
992 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
993 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
994 "\\&\n"
995 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
996 " if (s != 0)\n"
997 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
998 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
999 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
1000 "}\n"
1001 "\\&\n"
1002 "static void *\n"
1003 "thread_start(void *arg)\n"
1004 "{\n"
1005 " int s;\n"
1006 " pthread_attr_t gattr;\n"
1007 "\\&\n"
1008 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
1009 " retrieves the attributes of the thread specified in its\n"
1010 " first argument. */\n"
1011 "\\&\n"
1012 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
1013 " if (s != 0)\n"
1014 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
1015 "\\&\n"
1016 " printf(\"Thread attributes:\\[rs]n\");\n"
1017 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
1018 "\\&\n"
1019 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
1020 "}\n"
1021 "\\&\n"
1022 "int\n"
1023 "main(int argc, char *argv[])\n"
1024 "{\n"
1025 " pthread_t thr;\n"
1026 " pthread_attr_t attr;\n"
1027 " pthread_attr_t *attrp; /* NULL or &attr */\n"
1028 " int s;\n"
1029 "\\&\n"
1030 " attrp = NULL;\n"
1031 "\\&\n"
1032 " /* If a command-line argument was supplied, use it to set the\n"
1033 " stack-size attribute and set a few other thread attributes,\n"
1034 " and set attrp pointing to thread attributes object. */\n"
1035 "\\&\n"
1036 " if (argc E<gt> 1) {\n"
1037 " size_t stack_size;\n"
1038 " void *sp;\n"
1039 "\\&\n"
1040 " attrp = &attr;\n"
1041 "\\&\n"
1042 " s = pthread_attr_init(&attr);\n"
1043 " if (s != 0)\n"
1044 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
1045 "\\&\n"
1046 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
1047 " if (s != 0)\n"
1048 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
1049 "\\&\n"
1050 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
1051 " if (s != 0)\n"
1052 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
1053 "\\&\n"
1054 " stack_size = strtoul(argv[1], NULL, 0);\n"
1055 "\\&\n"
1056 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
1057 " if (s != 0)\n"
1058 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
1059 "\\&\n"
1060 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
1061 "\\&\n"
1062 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
1063 " if (s != 0)\n"
1064 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
1065 " }\n"
1066 "\\&\n"
1067 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
1068 " if (s != 0)\n"
1069 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
1070 "\\&\n"
1071 " if (attrp != NULL) {\n"
1072 " s = pthread_attr_destroy(attrp);\n"
1073 " if (s != 0)\n"
1074 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
1075 " }\n"
1076 "\\&\n"
1077 " pause(); /* Terminates when other thread calls exit() */\n"
1078 "}\n"
1079 msgstr ""
1080 "#define _GNU_SOURCE /* Pour obtenir la déclaration de pthread_getattr_np() */\n"
1081 "#include E<lt>err.hE<gt>\n"
1082 "#include E<lt>errno.hE<gt>\n"
1083 "#include E<lt>pthread.hE<gt>\n"
1084 "#include E<lt>stdio.hE<gt>\n"
1085 "#include E<lt>stdlib.hE<gt>\n"
1086 "#include E<lt>unistd.hE<gt>\n"
1087 "\\&\n"
1088 "static void\n"
1089 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
1090 "{\n"
1091 " int s, i;\n"
1092 " size_t v;\n"
1093 " void *stkaddr;\n"
1094 " struct sched_param sp;\n"
1095 "\\&\n"
1096 " s = pthread_attr_getdetachstate(attr, &i);\n"
1097 " if (s != 0)\n"
1098 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
1099 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
1100 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
1101 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
1102 " \"???\");\n"
1103 "\\&\n"
1104 " s = pthread_attr_getscope(attr, &i);\n"
1105 " if (s != 0)\n"
1106 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
1107 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
1108 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
1109 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
1110 " \"???\");\n"
1111 "\\&\n"
1112 " s = pthread_attr_getinheritsched(attr, &i);\n"
1113 " if (s != 0)\n"
1114 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
1115 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
1116 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
1117 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
1118 " \"???\");\n"
1119 "\\&\n"
1120 " s = pthread_attr_getschedpolicy(attr, &i);\n"
1121 " if (s != 0)\n"
1122 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
1123 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
1124 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
1125 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
1126 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
1127 " \"???\");\n"
1128 "\\&\n"
1129 " s = pthread_attr_getschedparam(attr, &sp);\n"
1130 " if (s != 0)\n"
1131 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
1132 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
1133 "\\&\n"
1134 " s = pthread_attr_getguardsize(attr, &v);\n"
1135 " if (s != 0)\n"
1136 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
1137 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
1138 "\\&\n"
1139 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
1140 " if (s != 0)\n"
1141 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
1142 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
1143 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
1144 "}\n"
1145 "\\&\n"
1146 "static void *\n"
1147 "thread_start(void *arg)\n"
1148 "{\n"
1149 " int s;\n"
1150 " pthread_attr_t gattr;\n"
1151 "\\&\n"
1152 " /* pthread_getattr_np() est une extension GNU non standard qui\n"
1153 " extrait les attributs du thread spécifié dans son premier\n"
1154 " argument. */\n"
1155 "\\&\n"
1156 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
1157 " if (s != 0)\n"
1158 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
1159 "\\&\n"
1160 " printf(\"Thread attributes:\\[rs]n\");\n"
1161 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
1162 "\\&\n"
1163 " exit(EXIT_SUCCESS); /* Terminer tous les threads */\n"
1164 "}\n"
1165 "\\&\n"
1166 "int\n"
1167 "main(int argc, char *argv[])\n"
1168 "{\n"
1169 " pthread_t thr;\n"
1170 " pthread_attr_t attr;\n"
1171 " pthread_attr_t *attrp; /* NULL or &attr */\n"
1172 " int s;\n"
1173 "\\&\n"
1174 " attrp = NULL;\n"
1175 "\\&\n"
1176 " /* Si un argument en ligne de commande a été fourni, utilisez le\n"
1177 " pour définir l'attribut de taille de la pile et quelques autres\n"
1178 " attributs du thread ainsi que l'attribut attrp pointant sur\n"
1179 " l'objet d'attributs de thread. */\n"
1180 "\\&\n"
1181 " if (argc E<gt> 1) {\n"
1182 " size_t stack_size;\n"
1183 " void *sp;\n"
1184 "\\&\n"
1185 " attrp = &attr;\n"
1186 "\\&\n"
1187 " s = pthread_attr_init(&attr);\n"
1188 " if (s != 0)\n"
1189 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
1190 "\\&\n"
1191 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
1192 " if (s != 0)\n"
1193 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
1194 "\\&\n"
1195 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
1196 " if (s != 0)\n"
1197 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
1198 "\\&\n"
1199 " stack_size = strtoul(argv[1], NULL, 0);\n"
1200 "\\&\n"
1201 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
1202 " if (s != 0)\n"
1203 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
1204 "\\&\n"
1205 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
1206 "\\&\n"
1207 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
1208 " if (s != 0)\n"
1209 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
1210 " }\n"
1211 "\\&\n"
1212 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
1213 " if (s != 0)\n"
1214 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
1215 "\\&\n"
1216 " if (attrp != NULL) {\n"
1217 " s = pthread_attr_destroy(attrp);\n"
1218 " if (s != 0)\n"
1219 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
1220 " }\n"
1221 "\\&\n"
1222 " pause(); /* Termine quand un autre thread appelle exit() */\n"
1223 "}\n"
1224
1225 #. type: TH
1226 #: fedora-44 fedora-rawhide
1227 #, no-wrap
1228 msgid "2024-07-23"
1229 msgstr "23 juillet 2024"
1230
1231 #. type: TH
1232 #: fedora-44 fedora-rawhide
1233 #, no-wrap
1234 msgid "Linux man-pages 6.13"
1235 msgstr "Pages du manuel de Linux 6.13"
1236
1237 #. type: TH
1238 #: mageia-cauldron
1239 #, no-wrap
1240 msgid "Linux man-pages 6.17"
1241 msgstr "Pages du manuel de Linux 6.17"
1242
1243 #. type: TH
1244 #: opensuse-leap-16-1 opensuse-tumbleweed
1245 #, no-wrap
1246 msgid "Linux man-pages (unreleased)"
1247 msgstr "Pages du manuel de Linux (non publiées)"