| 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. |
| 5 |
# |
| 6 |
#, fuzzy |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: PACKAGE VERSION\n" |
| 10 |
"POT-Creation-Date: 2026-06-05 06:38+0200\n" |
| 11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
| 12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
| 13 |
"Language-Team: LANGUAGE <[email protected]>\n" |
| 14 |
"Language: \n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
|
| 19 |
#. type: TH |
| 20 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 21 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 22 |
#, no-wrap |
| 23 |
msgid "pthread_setschedparam" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 28 |
#: opensuse-tumbleweed |
| 29 |
#, no-wrap |
| 30 |
msgid "2025-09-21" |
| 31 |
msgstr "" |
| 32 |
|
| 33 |
#. type: TH |
| 34 |
#: archlinux debian-unstable |
| 35 |
#, no-wrap |
| 36 |
msgid "Linux man-pages 6.18" |
| 37 |
msgstr "" |
| 38 |
|
| 39 |
#. type: SH |
| 40 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 41 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 42 |
#, no-wrap |
| 43 |
msgid "NAME" |
| 44 |
msgstr "" |
| 45 |
|
| 46 |
#. type: Plain text |
| 47 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 48 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 49 |
msgid "" |
| 50 |
"pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and " |
| 51 |
"parameters of a thread" |
| 52 |
msgstr "" |
| 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 "LIBRARY" |
| 59 |
msgstr "" |
| 60 |
|
| 61 |
#. type: Plain text |
| 62 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 63 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 64 |
msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)" |
| 65 |
msgstr "" |
| 66 |
|
| 67 |
#. type: SH |
| 68 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 69 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 70 |
#, no-wrap |
| 71 |
msgid "SYNOPSIS" |
| 72 |
msgstr "" |
| 73 |
|
| 74 |
#. type: Plain text |
| 75 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 76 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 77 |
#, no-wrap |
| 78 |
msgid "B<#include E<lt>pthread.hE<gt>>\n" |
| 79 |
msgstr "" |
| 80 |
|
| 81 |
#. type: Plain text |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, no-wrap |
| 85 |
msgid "" |
| 86 |
"B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n" |
| 87 |
"B< const struct sched_param *>I<param>B<);>\n" |
| 88 |
"B<int pthread_getschedparam(pthread_t >I<thread>B<, int *restrict >I<policy>B<,>\n" |
| 89 |
"B< struct sched_param *restrict >I<param>B<);>\n" |
| 90 |
msgstr "" |
| 91 |
|
| 92 |
#. type: SH |
| 93 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 94 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 95 |
#, no-wrap |
| 96 |
msgid "DESCRIPTION" |
| 97 |
msgstr "" |
| 98 |
|
| 99 |
#. type: Plain text |
| 100 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 101 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 102 |
msgid "" |
| 103 |
"The B<pthread_setschedparam>() function sets the scheduling policy and " |
| 104 |
"parameters of the thread I<thread>." |
| 105 |
msgstr "" |
| 106 |
|
| 107 |
#. FIXME . pthread_setschedparam() places no restriction on the policy, |
| 108 |
#. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER |
| 109 |
#. http://sourceware.org/bugzilla/show_bug.cgi?id=7013 |
| 110 |
#. type: Plain text |
| 111 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 112 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 113 |
msgid "" |
| 114 |
"I<policy> specifies the new scheduling policy for I<thread>. The supported " |
| 115 |
"values for I<policy>, and their semantics, are described in B<sched>(7)." |
| 116 |
msgstr "" |
| 117 |
|
| 118 |
#. type: Plain text |
| 119 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 120 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 121 |
msgid "" |
| 122 |
"The structure pointed to by I<param> specifies the new scheduling parameters " |
| 123 |
"for I<thread>. Scheduling parameters are maintained in the following " |
| 124 |
"structure:" |
| 125 |
msgstr "" |
| 126 |
|
| 127 |
#. type: Plain text |
| 128 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 129 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 130 |
#, no-wrap |
| 131 |
msgid "" |
| 132 |
"struct sched_param {\n" |
| 133 |
" int sched_priority; /* Scheduling priority */\n" |
| 134 |
"};\n" |
| 135 |
msgstr "" |
| 136 |
|
| 137 |
#. type: Plain text |
| 138 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 139 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 140 |
msgid "" |
| 141 |
"As can be seen, only one scheduling parameter is supported. For details of " |
| 142 |
"the permitted ranges for scheduling priorities in each scheduling policy, " |
| 143 |
"see B<sched>(7)." |
| 144 |
msgstr "" |
| 145 |
|
| 146 |
#. #-#-#-#-# archlinux: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 147 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 148 |
#. /* If the thread should have higher priority because of some |
| 149 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 150 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 151 |
#. may want to add something on the topic to this page. |
| 152 |
#. type: Plain text |
| 153 |
#. #-#-#-#-# debian-trixie: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 154 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 155 |
#. /* If the thread should have higher priority because of some |
| 156 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 157 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 158 |
#. may want to add something on the topic to this page. |
| 159 |
#. type: Plain text |
| 160 |
#. #-#-#-#-# debian-unstable: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 161 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 162 |
#. /* If the thread should have higher priority because of some |
| 163 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 164 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 165 |
#. may want to add something on the topic to this page. |
| 166 |
#. type: Plain text |
| 167 |
#. #-#-#-#-# fedora-44: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 168 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 169 |
#. /* If the thread should have higher priority because of some |
| 170 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 171 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 172 |
#. may want to add something on the topic to this page. |
| 173 |
#. type: Plain text |
| 174 |
#. #-#-#-#-# fedora-rawhide: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 175 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 176 |
#. /* If the thread should have higher priority because of some |
| 177 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 178 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 179 |
#. may want to add something on the topic to this page. |
| 180 |
#. type: Plain text |
| 181 |
#. #-#-#-#-# mageia-cauldron: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 182 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 183 |
#. /* If the thread should have higher priority because of some |
| 184 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 185 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 186 |
#. may want to add something on the topic to this page. |
| 187 |
#. type: Plain text |
| 188 |
#. #-#-#-#-# opensuse-leap-16-1: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 189 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 190 |
#. /* If the thread should have higher priority because of some |
| 191 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 192 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 193 |
#. may want to add something on the topic to this page. |
| 194 |
#. type: Plain text |
| 195 |
#. #-#-#-#-# opensuse-tumbleweed: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# |
| 196 |
#. FIXME . nptl/pthread_setschedparam.c has the following |
| 197 |
#. /* If the thread should have higher priority because of some |
| 198 |
#. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ |
| 199 |
#. Eventually (perhaps after writing the mutexattr pages), we |
| 200 |
#. may want to add something on the topic to this page. |
| 201 |
#. type: Plain text |
| 202 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 203 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 204 |
msgid "" |
| 205 |
"The B<pthread_getschedparam>() function returns the scheduling policy and " |
| 206 |
"parameters of the thread I<thread>, in the buffers pointed to by I<policy> " |
| 207 |
"and I<param>, respectively. The returned priority value is that set by the " |
| 208 |
"most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or " |
| 209 |
"B<pthread_create>(3) call that affected I<thread>. The returned priority " |
| 210 |
"does not reflect any temporary priority adjustments as a result of calls to " |
| 211 |
"any priority inheritance or priority ceiling functions (see, for example, " |
| 212 |
"B<pthread_mutexattr_setprioceiling>(3) and " |
| 213 |
"B<pthread_mutexattr_setprotocol>(3))." |
| 214 |
msgstr "" |
| 215 |
|
| 216 |
#. type: SH |
| 217 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 218 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 219 |
#, no-wrap |
| 220 |
msgid "RETURN VALUE" |
| 221 |
msgstr "" |
| 222 |
|
| 223 |
#. type: Plain text |
| 224 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 225 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 226 |
msgid "" |
| 227 |
"On success, these functions return 0; on error, they return a nonzero error " |
| 228 |
"number. If B<pthread_setschedparam>() fails, the scheduling policy and " |
| 229 |
"parameters of I<thread> are not changed." |
| 230 |
msgstr "" |
| 231 |
|
| 232 |
#. type: SH |
| 233 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 234 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 235 |
#, no-wrap |
| 236 |
msgid "ERRORS" |
| 237 |
msgstr "" |
| 238 |
|
| 239 |
#. type: Plain text |
| 240 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 241 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 242 |
msgid "Both of these functions can fail with the following error:" |
| 243 |
msgstr "" |
| 244 |
|
| 245 |
#. type: TP |
| 246 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 247 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 248 |
#, no-wrap |
| 249 |
msgid "B<ESRCH>" |
| 250 |
msgstr "" |
| 251 |
|
| 252 |
#. type: Plain text |
| 253 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 254 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 255 |
msgid "No thread with the ID I<thread> could be found." |
| 256 |
msgstr "" |
| 257 |
|
| 258 |
#. type: Plain text |
| 259 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 260 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 261 |
msgid "" |
| 262 |
"B<pthread_setschedparam>() may additionally fail with the following errors:" |
| 263 |
msgstr "" |
| 264 |
|
| 265 |
#. type: TP |
| 266 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 267 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 268 |
#, no-wrap |
| 269 |
msgid "B<EINVAL>" |
| 270 |
msgstr "" |
| 271 |
|
| 272 |
#. type: Plain text |
| 273 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 274 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 275 |
msgid "" |
| 276 |
"I<policy> is not a recognized policy, or I<param> does not make sense for " |
| 277 |
"the I<policy>." |
| 278 |
msgstr "" |
| 279 |
|
| 280 |
#. type: TP |
| 281 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 282 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 283 |
#, no-wrap |
| 284 |
msgid "B<EPERM>" |
| 285 |
msgstr "" |
| 286 |
|
| 287 |
#. type: Plain text |
| 288 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 289 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 290 |
msgid "" |
| 291 |
"The caller does not have appropriate privileges to set the specified " |
| 292 |
"scheduling policy and parameters." |
| 293 |
msgstr "" |
| 294 |
|
| 295 |
#. type: Plain text |
| 296 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 297 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 298 |
msgid "" |
| 299 |
"POSIX.1 also documents an B<ENOTSUP> (\"attempt was made to set the policy " |
| 300 |
"or scheduling parameters to an unsupported value\") error for " |
| 301 |
"B<pthread_setschedparam>()." |
| 302 |
msgstr "" |
| 303 |
|
| 304 |
#. type: SH |
| 305 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 306 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 307 |
#, no-wrap |
| 308 |
msgid "ATTRIBUTES" |
| 309 |
msgstr "" |
| 310 |
|
| 311 |
#. type: Plain text |
| 312 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 313 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 314 |
msgid "" |
| 315 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 316 |
msgstr "" |
| 317 |
|
| 318 |
#. type: tbl table |
| 319 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 320 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 321 |
#, no-wrap |
| 322 |
msgid "Interface" |
| 323 |
msgstr "" |
| 324 |
|
| 325 |
#. type: tbl table |
| 326 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 327 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 328 |
#, no-wrap |
| 329 |
msgid "Attribute" |
| 330 |
msgstr "" |
| 331 |
|
| 332 |
#. type: tbl table |
| 333 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 334 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 335 |
#, no-wrap |
| 336 |
msgid "Value" |
| 337 |
msgstr "" |
| 338 |
|
| 339 |
#. type: tbl table |
| 340 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 341 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 342 |
#, no-wrap |
| 343 |
msgid ".na\n" |
| 344 |
msgstr "" |
| 345 |
|
| 346 |
#. type: tbl table |
| 347 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 348 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 349 |
#, no-wrap |
| 350 |
msgid ".nh\n" |
| 351 |
msgstr "" |
| 352 |
|
| 353 |
#. type: tbl table |
| 354 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 355 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 356 |
#, no-wrap |
| 357 |
msgid "" |
| 358 |
"B<pthread_setschedparam>(),\n" |
| 359 |
"B<pthread_getschedparam>()" |
| 360 |
msgstr "" |
| 361 |
|
| 362 |
#. type: tbl table |
| 363 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 364 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 365 |
#, no-wrap |
| 366 |
msgid "Thread safety" |
| 367 |
msgstr "" |
| 368 |
|
| 369 |
#. type: tbl table |
| 370 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 371 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 372 |
#, no-wrap |
| 373 |
msgid "MT-Safe" |
| 374 |
msgstr "" |
| 375 |
|
| 376 |
#. type: SH |
| 377 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 378 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 379 |
#, no-wrap |
| 380 |
msgid "STANDARDS" |
| 381 |
msgstr "" |
| 382 |
|
| 383 |
#. type: Plain text |
| 384 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 385 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 386 |
msgid "POSIX.1-2008." |
| 387 |
msgstr "" |
| 388 |
|
| 389 |
#. type: SH |
| 390 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 391 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 392 |
#, no-wrap |
| 393 |
msgid "HISTORY" |
| 394 |
msgstr "" |
| 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 "glibc 2.0 POSIX.1-2001." |
| 400 |
msgstr "" |
| 401 |
|
| 402 |
#. type: SH |
| 403 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 404 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 405 |
#, no-wrap |
| 406 |
msgid "NOTES" |
| 407 |
msgstr "" |
| 408 |
|
| 409 |
#. type: Plain text |
| 410 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 411 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 412 |
msgid "" |
| 413 |
"For a description of the permissions required to, and the effect of, " |
| 414 |
"changing a thread's scheduling policy and priority, and details of the " |
| 415 |
"permitted ranges for priorities in each scheduling policy, see B<sched>(7)." |
| 416 |
msgstr "" |
| 417 |
|
| 418 |
#. type: SH |
| 419 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 420 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 421 |
#, no-wrap |
| 422 |
msgid "EXAMPLES" |
| 423 |
msgstr "" |
| 424 |
|
| 425 |
#. type: Plain text |
| 426 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 427 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 428 |
msgid "" |
| 429 |
"The program below demonstrates the use of B<pthread_setschedparam>() and " |
| 430 |
"B<pthread_getschedparam>(), as well as the use of a number of other " |
| 431 |
"scheduling-related pthreads functions." |
| 432 |
msgstr "" |
| 433 |
|
| 434 |
#. type: Plain text |
| 435 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 436 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 437 |
msgid "" |
| 438 |
"In the following run, the main thread sets its scheduling policy to " |
| 439 |
"B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes " |
| 440 |
"object with a scheduling policy attribute of B<SCHED_RR> and a scheduling " |
| 441 |
"priority attribute of 20. The program then sets (using " |
| 442 |
"B<pthread_attr_setinheritsched>(3)) the inherit scheduler attribute of the " |
| 443 |
"thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, meaning that threads " |
| 444 |
"created using this attributes object should take their scheduling attributes " |
| 445 |
"from the thread attributes object. The program then creates a thread using " |
| 446 |
"the thread attributes object, and that thread displays its scheduling policy " |
| 447 |
"and priority." |
| 448 |
msgstr "" |
| 449 |
|
| 450 |
#. type: Plain text |
| 451 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 452 |
#: opensuse-tumbleweed |
| 453 |
#, no-wrap |
| 454 |
msgid "" |
| 455 |
"$B< su>; # Need privilege to set real-time scheduling policies\n" |
| 456 |
"Password:\n" |
| 457 |
"#B< ./a.out -mf10 -ar20 -i e>;\n" |
| 458 |
"Scheduler settings of main thread\n" |
| 459 |
" policy=SCHED_FIFO, priority=10\n" |
| 460 |
"\\&\n" |
| 461 |
"Scheduler settings in \\[aq]attr\\[aq]\n" |
| 462 |
" policy=SCHED_RR, priority=20\n" |
| 463 |
" inheritsched is EXPLICIT\n" |
| 464 |
"\\&\n" |
| 465 |
"Scheduler attributes of new thread\n" |
| 466 |
" policy=SCHED_RR, priority=20\n" |
| 467 |
msgstr "" |
| 468 |
|
| 469 |
#. type: Plain text |
| 470 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 471 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 472 |
msgid "" |
| 473 |
"In the above output, one can see that the scheduling policy and priority " |
| 474 |
"were taken from the values specified in the thread attributes object." |
| 475 |
msgstr "" |
| 476 |
|
| 477 |
#. type: Plain text |
| 478 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 479 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 480 |
msgid "" |
| 481 |
"The next run is the same as the previous, except that the inherit scheduler " |
| 482 |
"attribute is set to B<PTHREAD_INHERIT_SCHED>, meaning that threads created " |
| 483 |
"using the thread attributes object should ignore the scheduling attributes " |
| 484 |
"specified in the attributes object and instead take their scheduling " |
| 485 |
"attributes from the creating thread." |
| 486 |
msgstr "" |
| 487 |
|
| 488 |
#. type: Plain text |
| 489 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 490 |
#: opensuse-tumbleweed |
| 491 |
#, no-wrap |
| 492 |
msgid "" |
| 493 |
"#B< ./a.out -mf10 -ar20 -i i>;\n" |
| 494 |
"Scheduler settings of main thread\n" |
| 495 |
" policy=SCHED_FIFO, priority=10\n" |
| 496 |
"\\&\n" |
| 497 |
"Scheduler settings in \\[aq]attr\\[aq]\n" |
| 498 |
" policy=SCHED_RR, priority=20\n" |
| 499 |
" inheritsched is INHERIT\n" |
| 500 |
"\\&\n" |
| 501 |
"Scheduler attributes of new thread\n" |
| 502 |
" policy=SCHED_FIFO, priority=10\n" |
| 503 |
msgstr "" |
| 504 |
|
| 505 |
#. type: Plain text |
| 506 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 507 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 508 |
msgid "" |
| 509 |
"In the above output, one can see that the scheduling policy and priority " |
| 510 |
"were taken from the creating thread, rather than the thread attributes " |
| 511 |
"object." |
| 512 |
msgstr "" |
| 513 |
|
| 514 |
#. type: Plain text |
| 515 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 516 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 517 |
msgid "" |
| 518 |
"Note that if we had omitted the I<-i\\ i> option, the output would have been " |
| 519 |
"the same, since B<PTHREAD_INHERIT_SCHED> is the default for the inherit " |
| 520 |
"scheduler attribute." |
| 521 |
msgstr "" |
| 522 |
|
| 523 |
#. type: SS |
| 524 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 525 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 526 |
#, no-wrap |
| 527 |
msgid "Program source" |
| 528 |
msgstr "" |
| 529 |
|
| 530 |
#. type: Plain text |
| 531 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 532 |
#: opensuse-tumbleweed |
| 533 |
#, no-wrap |
| 534 |
msgid "" |
| 535 |
"/* pthreads_sched_test.c */\n" |
| 536 |
"\\&\n" |
| 537 |
"#include E<lt>err.hE<gt>\n" |
| 538 |
"#include E<lt>errno.hE<gt>\n" |
| 539 |
"#include E<lt>pthread.hE<gt>\n" |
| 540 |
"#include E<lt>stdio.hE<gt>\n" |
| 541 |
"#include E<lt>stdlib.hE<gt>\n" |
| 542 |
"#include E<lt>unistd.hE<gt>\n" |
| 543 |
"\\&\n" |
| 544 |
"[[noreturn]]\n" |
| 545 |
"static void\n" |
| 546 |
"usage(char *prog_name, char *msg)\n" |
| 547 |
"{\n" |
| 548 |
" if (msg != NULL)\n" |
| 549 |
" fputs(msg, stderr);\n" |
| 550 |
"\\&\n" |
| 551 |
" fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" |
| 552 |
" fprintf(stderr, \"Options are:\\[rs]n\");\n" |
| 553 |
"#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" |
| 554 |
" fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\[rs]n\");\n" |
| 555 |
" fpe(\" thread attributes object\\[rs]n\");\n" |
| 556 |
" fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n" |
| 557 |
" fpe(\" f SCHED_FIFO\\[rs]n\");\n" |
| 558 |
" fpe(\" r SCHED_RR\\[rs]n\");\n" |
| 559 |
" fpe(\" o SCHED_OTHER\\[rs]n\");\n" |
| 560 |
" fpe(\"-A Use default thread attributes object\\[rs]n\");\n" |
| 561 |
" fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" |
| 562 |
" fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\[rs]n\");\n" |
| 563 |
" fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\[rs]n\");\n" |
| 564 |
" fpe(\" main thread before pthread_create() call\\[rs]n\");\n" |
| 565 |
" exit(EXIT_FAILURE);\n" |
| 566 |
"}\n" |
| 567 |
"\\&\n" |
| 568 |
"static int\n" |
| 569 |
"get_policy(char p, int *policy)\n" |
| 570 |
"{\n" |
| 571 |
" switch (p) {\n" |
| 572 |
" case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" |
| 573 |
" case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" |
| 574 |
" case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" |
| 575 |
" default: return 0;\n" |
| 576 |
" }\n" |
| 577 |
"}\n" |
| 578 |
"\\&\n" |
| 579 |
"static void\n" |
| 580 |
"display_sched_attr(int policy, const struct sched_param *param)\n" |
| 581 |
"{\n" |
| 582 |
" printf(\" policy=%s, priority=%d\\[rs]n\",\n" |
| 583 |
" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" |
| 584 |
" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" |
| 585 |
" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" |
| 586 |
" \"???\",\n" |
| 587 |
" param-E<gt>sched_priority);\n" |
| 588 |
"}\n" |
| 589 |
"\\&\n" |
| 590 |
"static void\n" |
| 591 |
"display_thread_sched_attr(char *msg)\n" |
| 592 |
"{\n" |
| 593 |
" int policy, s;\n" |
| 594 |
" struct sched_param param;\n" |
| 595 |
"\\&\n" |
| 596 |
" s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" |
| 597 |
" if (s != 0)\n" |
| 598 |
" errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n" |
| 599 |
"\\&\n" |
| 600 |
" printf(\"%s\\[rs]n\", msg);\n" |
| 601 |
" display_sched_attr(policy, ¶m);\n" |
| 602 |
"}\n" |
| 603 |
"\\&\n" |
| 604 |
"static void *\n" |
| 605 |
"thread_start(void *arg)\n" |
| 606 |
"{\n" |
| 607 |
" display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" |
| 608 |
"\\&\n" |
| 609 |
" return NULL;\n" |
| 610 |
"}\n" |
| 611 |
"\\&\n" |
| 612 |
"int\n" |
| 613 |
"main(int argc, char *argv[])\n" |
| 614 |
"{\n" |
| 615 |
" int s, opt, inheritsched, use_null_attrib, policy;\n" |
| 616 |
" pthread_t thread;\n" |
| 617 |
" pthread_attr_t attr;\n" |
| 618 |
" pthread_attr_t *attrp;\n" |
| 619 |
" char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" |
| 620 |
" struct sched_param param;\n" |
| 621 |
"\\&\n" |
| 622 |
" /* Process command-line options. */\n" |
| 623 |
"\\&\n" |
| 624 |
" use_null_attrib = 0;\n" |
| 625 |
" attr_sched_str = NULL;\n" |
| 626 |
" main_sched_str = NULL;\n" |
| 627 |
" inheritsched_str = NULL;\n" |
| 628 |
"\\&\n" |
| 629 |
" while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" |
| 630 |
" switch (opt) {\n" |
| 631 |
" case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" |
| 632 |
" case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" |
| 633 |
" case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" |
| 634 |
" case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" |
| 635 |
" default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" |
| 636 |
" }\n" |
| 637 |
" }\n" |
| 638 |
"\\&\n" |
| 639 |
" if (use_null_attrib\n" |
| 640 |
" && (inheritsched_str != NULL || attr_sched_str != NULL))\n" |
| 641 |
" {\n" |
| 642 |
" usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" |
| 643 |
" }\n" |
| 644 |
"\\&\n" |
| 645 |
" /* Optionally set scheduling attributes of main thread,\n" |
| 646 |
" and display the attributes. */\n" |
| 647 |
"\\&\n" |
| 648 |
" if (main_sched_str != NULL) {\n" |
| 649 |
" if (!get_policy(main_sched_str[0], &policy))\n" |
| 650 |
" usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" |
| 651 |
" param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" |
| 652 |
"\\&\n" |
| 653 |
" s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" |
| 654 |
" if (s != 0)\n" |
| 655 |
" errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n" |
| 656 |
" }\n" |
| 657 |
"\\&\n" |
| 658 |
" display_thread_sched_attr(\"Scheduler settings of main thread\");\n" |
| 659 |
" printf(\"\\[rs]n\");\n" |
| 660 |
"\\&\n" |
| 661 |
" /* Initialize thread attributes object according to options. */\n" |
| 662 |
"\\&\n" |
| 663 |
" attrp = NULL;\n" |
| 664 |
"\\&\n" |
| 665 |
" if (!use_null_attrib) {\n" |
| 666 |
" s = pthread_attr_init(&attr);\n" |
| 667 |
" if (s != 0)\n" |
| 668 |
" errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" |
| 669 |
" attrp = &attr;\n" |
| 670 |
" }\n" |
| 671 |
"\\&\n" |
| 672 |
" if (inheritsched_str != NULL) {\n" |
| 673 |
" if (inheritsched_str[0] == \\[aq]e\\[aq])\n" |
| 674 |
" inheritsched = PTHREAD_EXPLICIT_SCHED;\n" |
| 675 |
" else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" |
| 676 |
" inheritsched = PTHREAD_INHERIT_SCHED;\n" |
| 677 |
" else\n" |
| 678 |
" usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or \\[aq]i\\[aq]\\[rs]n\");\n" |
| 679 |
"\\&\n" |
| 680 |
" s = pthread_attr_setinheritsched(&attr, inheritsched);\n" |
| 681 |
" if (s != 0)\n" |
| 682 |
" errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n" |
| 683 |
" }\n" |
| 684 |
"\\&\n" |
| 685 |
" if (attr_sched_str != NULL) {\n" |
| 686 |
" if (!get_policy(attr_sched_str[0], &policy))\n" |
| 687 |
" usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" |
| 688 |
" param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" |
| 689 |
"\\&\n" |
| 690 |
" s = pthread_attr_setschedpolicy(&attr, policy);\n" |
| 691 |
" if (s != 0)\n" |
| 692 |
" errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n" |
| 693 |
" s = pthread_attr_setschedparam(&attr, ¶m);\n" |
| 694 |
" if (s != 0)\n" |
| 695 |
" errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n" |
| 696 |
" }\n" |
| 697 |
"\\&\n" |
| 698 |
" /* If we initialized a thread attributes object, display\n" |
| 699 |
" the scheduling attributes that were set in the object. */\n" |
| 700 |
"\\&\n" |
| 701 |
" if (attrp != NULL) {\n" |
| 702 |
" s = pthread_attr_getschedparam(&attr, ¶m);\n" |
| 703 |
" if (s != 0)\n" |
| 704 |
" errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n" |
| 705 |
" s = pthread_attr_getschedpolicy(&attr, &policy);\n" |
| 706 |
" if (s != 0)\n" |
| 707 |
" errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n" |
| 708 |
"\\&\n" |
| 709 |
" printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" |
| 710 |
" display_sched_attr(policy, ¶m);\n" |
| 711 |
"\\&\n" |
| 712 |
" pthread_attr_getinheritsched(&attr, &inheritsched);\n" |
| 713 |
" printf(\" inheritsched is %s\\[rs]n\",\n" |
| 714 |
" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" |
| 715 |
" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" |
| 716 |
" \"???\");\n" |
| 717 |
" printf(\"\\[rs]n\");\n" |
| 718 |
" }\n" |
| 719 |
"\\&\n" |
| 720 |
" /* Create a thread that will display its scheduling attributes. */\n" |
| 721 |
"\\&\n" |
| 722 |
" s = pthread_create(&thread, attrp, &thread_start, NULL);\n" |
| 723 |
" if (s != 0)\n" |
| 724 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 725 |
"\\&\n" |
| 726 |
" /* Destroy unneeded thread attributes object. */\n" |
| 727 |
"\\&\n" |
| 728 |
" if (!use_null_attrib) {\n" |
| 729 |
" s = pthread_attr_destroy(&attr);\n" |
| 730 |
" if (s != 0)\n" |
| 731 |
" errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" |
| 732 |
" }\n" |
| 733 |
"\\&\n" |
| 734 |
" s = pthread_join(thread, NULL);\n" |
| 735 |
" if (s != 0)\n" |
| 736 |
" errc(EXIT_FAILURE, s, \"pthread_join\");\n" |
| 737 |
"\\&\n" |
| 738 |
" exit(EXIT_SUCCESS);\n" |
| 739 |
"}\n" |
| 740 |
msgstr "" |
| 741 |
|
| 742 |
#. SRC END |
| 743 |
#. type: SH |
| 744 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 745 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 746 |
#, no-wrap |
| 747 |
msgid "SEE ALSO" |
| 748 |
msgstr "" |
| 749 |
|
| 750 |
#. type: Plain text |
| 751 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 752 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 753 |
msgid "" |
| 754 |
"B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), " |
| 755 |
"B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), " |
| 756 |
"B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), " |
| 757 |
"B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)" |
| 758 |
msgstr "" |
| 759 |
|
| 760 |
#. type: TH |
| 761 |
#: debian-trixie |
| 762 |
#, no-wrap |
| 763 |
msgid "2024-06-15" |
| 764 |
msgstr "" |
| 765 |
|
| 766 |
#. type: TH |
| 767 |
#: debian-trixie |
| 768 |
#, no-wrap |
| 769 |
msgid "Linux man-pages 6.9.1" |
| 770 |
msgstr "" |
| 771 |
|
| 772 |
#. type: Plain text |
| 773 |
#: debian-trixie |
| 774 |
msgid "POSIX threads library (I<libpthread>, I<-lpthread>)" |
| 775 |
msgstr "" |
| 776 |
|
| 777 |
#. type: Plain text |
| 778 |
#: debian-trixie fedora-44 fedora-rawhide |
| 779 |
#, no-wrap |
| 780 |
msgid "" |
| 781 |
"$ B<su> # Need privilege to set real-time scheduling policies\n" |
| 782 |
"Password:\n" |
| 783 |
"# B<./a.out -mf10 -ar20 -i e>\n" |
| 784 |
"Scheduler settings of main thread\n" |
| 785 |
" policy=SCHED_FIFO, priority=10\n" |
| 786 |
"\\&\n" |
| 787 |
"Scheduler settings in \\[aq]attr\\[aq]\n" |
| 788 |
" policy=SCHED_RR, priority=20\n" |
| 789 |
" inheritsched is EXPLICIT\n" |
| 790 |
"\\&\n" |
| 791 |
"Scheduler attributes of new thread\n" |
| 792 |
" policy=SCHED_RR, priority=20\n" |
| 793 |
msgstr "" |
| 794 |
|
| 795 |
#. type: Plain text |
| 796 |
#: debian-trixie fedora-44 fedora-rawhide |
| 797 |
#, no-wrap |
| 798 |
msgid "" |
| 799 |
"# B<./a.out -mf10 -ar20 -i i>\n" |
| 800 |
"Scheduler settings of main thread\n" |
| 801 |
" policy=SCHED_FIFO, priority=10\n" |
| 802 |
"\\&\n" |
| 803 |
"Scheduler settings in \\[aq]attr\\[aq]\n" |
| 804 |
" policy=SCHED_RR, priority=20\n" |
| 805 |
" inheritsched is INHERIT\n" |
| 806 |
"\\&\n" |
| 807 |
"Scheduler attributes of new thread\n" |
| 808 |
" policy=SCHED_FIFO, priority=10\n" |
| 809 |
msgstr "" |
| 810 |
|
| 811 |
#. type: Plain text |
| 812 |
#: debian-trixie fedora-44 fedora-rawhide |
| 813 |
#, no-wrap |
| 814 |
msgid "" |
| 815 |
"/* pthreads_sched_test.c */\n" |
| 816 |
"\\&\n" |
| 817 |
"#include E<lt>errno.hE<gt>\n" |
| 818 |
"#include E<lt>pthread.hE<gt>\n" |
| 819 |
"#include E<lt>stdio.hE<gt>\n" |
| 820 |
"#include E<lt>stdlib.hE<gt>\n" |
| 821 |
"#include E<lt>unistd.hE<gt>\n" |
| 822 |
"\\&\n" |
| 823 |
"#define handle_error_en(en, msg) \\[rs]\n" |
| 824 |
" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" |
| 825 |
"\\&\n" |
| 826 |
"[[noreturn]]\n" |
| 827 |
"static void\n" |
| 828 |
"usage(char *prog_name, char *msg)\n" |
| 829 |
"{\n" |
| 830 |
" if (msg != NULL)\n" |
| 831 |
" fputs(msg, stderr);\n" |
| 832 |
"\\&\n" |
| 833 |
" fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" |
| 834 |
" fprintf(stderr, \"Options are:\\[rs]n\");\n" |
| 835 |
"#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" |
| 836 |
" fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\[rs]n\");\n" |
| 837 |
" fpe(\" thread attributes object\\[rs]n\");\n" |
| 838 |
" fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n" |
| 839 |
" fpe(\" f SCHED_FIFO\\[rs]n\");\n" |
| 840 |
" fpe(\" r SCHED_RR\\[rs]n\");\n" |
| 841 |
" fpe(\" o SCHED_OTHER\\[rs]n\");\n" |
| 842 |
" fpe(\"-A Use default thread attributes object\\[rs]n\");\n" |
| 843 |
" fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" |
| 844 |
" fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\[rs]n\");\n" |
| 845 |
" fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\[rs]n\");\n" |
| 846 |
" fpe(\" main thread before pthread_create() call\\[rs]n\");\n" |
| 847 |
" exit(EXIT_FAILURE);\n" |
| 848 |
"}\n" |
| 849 |
"\\&\n" |
| 850 |
"static int\n" |
| 851 |
"get_policy(char p, int *policy)\n" |
| 852 |
"{\n" |
| 853 |
" switch (p) {\n" |
| 854 |
" case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" |
| 855 |
" case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" |
| 856 |
" case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" |
| 857 |
" default: return 0;\n" |
| 858 |
" }\n" |
| 859 |
"}\n" |
| 860 |
"\\&\n" |
| 861 |
"static void\n" |
| 862 |
"display_sched_attr(int policy, const struct sched_param *param)\n" |
| 863 |
"{\n" |
| 864 |
" printf(\" policy=%s, priority=%d\\[rs]n\",\n" |
| 865 |
" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" |
| 866 |
" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" |
| 867 |
" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" |
| 868 |
" \"???\",\n" |
| 869 |
" param-E<gt>sched_priority);\n" |
| 870 |
"}\n" |
| 871 |
"\\&\n" |
| 872 |
"static void\n" |
| 873 |
"display_thread_sched_attr(char *msg)\n" |
| 874 |
"{\n" |
| 875 |
" int policy, s;\n" |
| 876 |
" struct sched_param param;\n" |
| 877 |
"\\&\n" |
| 878 |
" s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" |
| 879 |
" if (s != 0)\n" |
| 880 |
" handle_error_en(s, \"pthread_getschedparam\");\n" |
| 881 |
"\\&\n" |
| 882 |
" printf(\"%s\\[rs]n\", msg);\n" |
| 883 |
" display_sched_attr(policy, ¶m);\n" |
| 884 |
"}\n" |
| 885 |
"\\&\n" |
| 886 |
"static void *\n" |
| 887 |
"thread_start(void *arg)\n" |
| 888 |
"{\n" |
| 889 |
" display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" |
| 890 |
"\\&\n" |
| 891 |
" return NULL;\n" |
| 892 |
"}\n" |
| 893 |
"\\&\n" |
| 894 |
"int\n" |
| 895 |
"main(int argc, char *argv[])\n" |
| 896 |
"{\n" |
| 897 |
" int s, opt, inheritsched, use_null_attrib, policy;\n" |
| 898 |
" pthread_t thread;\n" |
| 899 |
" pthread_attr_t attr;\n" |
| 900 |
" pthread_attr_t *attrp;\n" |
| 901 |
" char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" |
| 902 |
" struct sched_param param;\n" |
| 903 |
"\\&\n" |
| 904 |
" /* Process command-line options. */\n" |
| 905 |
"\\&\n" |
| 906 |
" use_null_attrib = 0;\n" |
| 907 |
" attr_sched_str = NULL;\n" |
| 908 |
" main_sched_str = NULL;\n" |
| 909 |
" inheritsched_str = NULL;\n" |
| 910 |
"\\&\n" |
| 911 |
" while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" |
| 912 |
" switch (opt) {\n" |
| 913 |
" case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" |
| 914 |
" case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" |
| 915 |
" case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" |
| 916 |
" case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" |
| 917 |
" default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" |
| 918 |
" }\n" |
| 919 |
" }\n" |
| 920 |
"\\&\n" |
| 921 |
" if (use_null_attrib\n" |
| 922 |
" && (inheritsched_str != NULL || attr_sched_str != NULL))\n" |
| 923 |
" {\n" |
| 924 |
" usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" |
| 925 |
" }\n" |
| 926 |
"\\&\n" |
| 927 |
" /* Optionally set scheduling attributes of main thread,\n" |
| 928 |
" and display the attributes. */\n" |
| 929 |
"\\&\n" |
| 930 |
" if (main_sched_str != NULL) {\n" |
| 931 |
" if (!get_policy(main_sched_str[0], &policy))\n" |
| 932 |
" usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" |
| 933 |
" param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" |
| 934 |
"\\&\n" |
| 935 |
" s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" |
| 936 |
" if (s != 0)\n" |
| 937 |
" handle_error_en(s, \"pthread_setschedparam\");\n" |
| 938 |
" }\n" |
| 939 |
"\\&\n" |
| 940 |
" display_thread_sched_attr(\"Scheduler settings of main thread\");\n" |
| 941 |
" printf(\"\\[rs]n\");\n" |
| 942 |
"\\&\n" |
| 943 |
" /* Initialize thread attributes object according to options. */\n" |
| 944 |
"\\&\n" |
| 945 |
" attrp = NULL;\n" |
| 946 |
"\\&\n" |
| 947 |
" if (!use_null_attrib) {\n" |
| 948 |
" s = pthread_attr_init(&attr);\n" |
| 949 |
" if (s != 0)\n" |
| 950 |
" handle_error_en(s, \"pthread_attr_init\");\n" |
| 951 |
" attrp = &attr;\n" |
| 952 |
" }\n" |
| 953 |
"\\&\n" |
| 954 |
" if (inheritsched_str != NULL) {\n" |
| 955 |
" if (inheritsched_str[0] == \\[aq]e\\[aq])\n" |
| 956 |
" inheritsched = PTHREAD_EXPLICIT_SCHED;\n" |
| 957 |
" else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" |
| 958 |
" inheritsched = PTHREAD_INHERIT_SCHED;\n" |
| 959 |
" else\n" |
| 960 |
" usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or \\[aq]i\\[aq]\\[rs]n\");\n" |
| 961 |
"\\&\n" |
| 962 |
" s = pthread_attr_setinheritsched(&attr, inheritsched);\n" |
| 963 |
" if (s != 0)\n" |
| 964 |
" handle_error_en(s, \"pthread_attr_setinheritsched\");\n" |
| 965 |
" }\n" |
| 966 |
"\\&\n" |
| 967 |
" if (attr_sched_str != NULL) {\n" |
| 968 |
" if (!get_policy(attr_sched_str[0], &policy))\n" |
| 969 |
" usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" |
| 970 |
" param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" |
| 971 |
"\\&\n" |
| 972 |
" s = pthread_attr_setschedpolicy(&attr, policy);\n" |
| 973 |
" if (s != 0)\n" |
| 974 |
" handle_error_en(s, \"pthread_attr_setschedpolicy\");\n" |
| 975 |
" s = pthread_attr_setschedparam(&attr, ¶m);\n" |
| 976 |
" if (s != 0)\n" |
| 977 |
" handle_error_en(s, \"pthread_attr_setschedparam\");\n" |
| 978 |
" }\n" |
| 979 |
"\\&\n" |
| 980 |
" /* If we initialized a thread attributes object, display\n" |
| 981 |
" the scheduling attributes that were set in the object. */\n" |
| 982 |
"\\&\n" |
| 983 |
" if (attrp != NULL) {\n" |
| 984 |
" s = pthread_attr_getschedparam(&attr, ¶m);\n" |
| 985 |
" if (s != 0)\n" |
| 986 |
" handle_error_en(s, \"pthread_attr_getschedparam\");\n" |
| 987 |
" s = pthread_attr_getschedpolicy(&attr, &policy);\n" |
| 988 |
" if (s != 0)\n" |
| 989 |
" handle_error_en(s, \"pthread_attr_getschedpolicy\");\n" |
| 990 |
"\\&\n" |
| 991 |
" printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" |
| 992 |
" display_sched_attr(policy, ¶m);\n" |
| 993 |
"\\&\n" |
| 994 |
" pthread_attr_getinheritsched(&attr, &inheritsched);\n" |
| 995 |
" printf(\" inheritsched is %s\\[rs]n\",\n" |
| 996 |
" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" |
| 997 |
" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" |
| 998 |
" \"???\");\n" |
| 999 |
" printf(\"\\[rs]n\");\n" |
| 1000 |
" }\n" |
| 1001 |
"\\&\n" |
| 1002 |
" /* Create a thread that will display its scheduling attributes. */\n" |
| 1003 |
"\\&\n" |
| 1004 |
" s = pthread_create(&thread, attrp, &thread_start, NULL);\n" |
| 1005 |
" if (s != 0)\n" |
| 1006 |
" handle_error_en(s, \"pthread_create\");\n" |
| 1007 |
"\\&\n" |
| 1008 |
" /* Destroy unneeded thread attributes object. */\n" |
| 1009 |
"\\&\n" |
| 1010 |
" if (!use_null_attrib) {\n" |
| 1011 |
" s = pthread_attr_destroy(&attr);\n" |
| 1012 |
" if (s != 0)\n" |
| 1013 |
" handle_error_en(s, \"pthread_attr_destroy\");\n" |
| 1014 |
" }\n" |
| 1015 |
"\\&\n" |
| 1016 |
" s = pthread_join(thread, NULL);\n" |
| 1017 |
" if (s != 0)\n" |
| 1018 |
" handle_error_en(s, \"pthread_join\");\n" |
| 1019 |
"\\&\n" |
| 1020 |
" exit(EXIT_SUCCESS);\n" |
| 1021 |
"}\n" |
| 1022 |
msgstr "" |
| 1023 |
|
| 1024 |
#. type: TH |
| 1025 |
#: fedora-44 fedora-rawhide |
| 1026 |
#, no-wrap |
| 1027 |
msgid "2024-07-23" |
| 1028 |
msgstr "" |
| 1029 |
|
| 1030 |
#. type: TH |
| 1031 |
#: fedora-44 fedora-rawhide |
| 1032 |
#, no-wrap |
| 1033 |
msgid "Linux man-pages 6.13" |
| 1034 |
msgstr "" |
| 1035 |
|
| 1036 |
#. type: TH |
| 1037 |
#: mageia-cauldron |
| 1038 |
#, no-wrap |
| 1039 |
msgid "Linux man-pages 6.17" |
| 1040 |
msgstr "" |
| 1041 |
|
| 1042 |
#. type: TH |
| 1043 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1044 |
#, no-wrap |
| 1045 |
msgid "Linux man-pages (unreleased)" |
| 1046 |
msgstr "" |