| 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:30+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 "membarrier" |
| 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 "membarrier - issue memory barriers on a set of threads" |
| 50 |
msgstr "" |
| 51 |
|
| 52 |
#. type: SH |
| 53 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 54 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 55 |
#, no-wrap |
| 56 |
msgid "LIBRARY" |
| 57 |
msgstr "" |
| 58 |
|
| 59 |
#. type: Plain text |
| 60 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 61 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 62 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 63 |
msgstr "" |
| 64 |
|
| 65 |
#. type: SH |
| 66 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 67 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 68 |
#, no-wrap |
| 69 |
msgid "SYNOPSIS" |
| 70 |
msgstr "" |
| 71 |
|
| 72 |
#. type: Plain text |
| 73 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 74 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 75 |
#, no-wrap |
| 76 |
msgid "" |
| 77 |
"B<#include E<lt>linux/membarrier.hE<gt>> /* Definition of B<MEMBARRIER_*> constants */\n" |
| 78 |
"B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n" |
| 79 |
"B<#include E<lt>unistd.hE<gt>>\n" |
| 80 |
msgstr "" |
| 81 |
|
| 82 |
#. type: Plain text |
| 83 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 84 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 85 |
#, no-wrap |
| 86 |
msgid "B<int syscall(SYS_membarrier, int >I<cmd>B<, unsigned int >I<flags>B<, int >I<cpu_id>B<);>\n" |
| 87 |
msgstr "" |
| 88 |
|
| 89 |
#. type: Plain text |
| 90 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 91 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 92 |
msgid "" |
| 93 |
"I<Note>: glibc provides no wrapper for B<membarrier>(), necessitating the " |
| 94 |
"use of B<syscall>(2)." |
| 95 |
msgstr "" |
| 96 |
|
| 97 |
#. type: SH |
| 98 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 99 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 100 |
#, no-wrap |
| 101 |
msgid "DESCRIPTION" |
| 102 |
msgstr "" |
| 103 |
|
| 104 |
#. type: Plain text |
| 105 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 106 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 107 |
msgid "" |
| 108 |
"The B<membarrier>() system call helps reducing the overhead of the memory " |
| 109 |
"barrier instructions required to order memory accesses on multi-core " |
| 110 |
"systems. However, this system call is heavier than a memory barrier, so " |
| 111 |
"using it effectively is I<not> as simple as replacing memory barriers with " |
| 112 |
"this system call, but requires understanding of the details below." |
| 113 |
msgstr "" |
| 114 |
|
| 115 |
#. type: Plain text |
| 116 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 117 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 118 |
msgid "" |
| 119 |
"Use of memory barriers needs to be done taking into account that a memory " |
| 120 |
"barrier always needs to be either matched with its memory barrier " |
| 121 |
"counterparts, or that the architecture's memory model doesn't require the " |
| 122 |
"matching barriers." |
| 123 |
msgstr "" |
| 124 |
|
| 125 |
#. type: Plain text |
| 126 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 127 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 128 |
msgid "" |
| 129 |
"There are cases where one side of the matching barriers (which we will refer " |
| 130 |
"to as \"fast side\") is executed much more often than the other (which we " |
| 131 |
"will refer to as \"slow side\"). This is a prime target for the use of " |
| 132 |
"B<membarrier>(). The key idea is to replace, for these matching barriers, " |
| 133 |
"the fast-side memory barriers by simple compiler barriers, for example:" |
| 134 |
msgstr "" |
| 135 |
|
| 136 |
#. type: Plain text |
| 137 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 138 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 139 |
#, no-wrap |
| 140 |
msgid "asm volatile (\"\" : : : \"memory\")\n" |
| 141 |
msgstr "" |
| 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 "and replace the slow-side memory barriers by calls to B<membarrier>()." |
| 147 |
msgstr "" |
| 148 |
|
| 149 |
#. type: Plain text |
| 150 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 151 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 152 |
msgid "" |
| 153 |
"This will add overhead to the slow side, and remove overhead from the fast " |
| 154 |
"side, thus resulting in an overall performance increase as long as the slow " |
| 155 |
"side is infrequent enough that the overhead of the B<membarrier>() calls " |
| 156 |
"does not outweigh the performance gain on the fast side." |
| 157 |
msgstr "" |
| 158 |
|
| 159 |
#. type: Plain text |
| 160 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 161 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 162 |
msgid "The I<cmd> argument is one of the following:" |
| 163 |
msgstr "" |
| 164 |
|
| 165 |
#. type: TP |
| 166 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 167 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 168 |
#, no-wrap |
| 169 |
msgid "B<MEMBARRIER_CMD_QUERY> (since Linux 4.3)" |
| 170 |
msgstr "" |
| 171 |
|
| 172 |
#. type: Plain text |
| 173 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 174 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 175 |
msgid "" |
| 176 |
"Query the set of supported commands. The return value of the call is a bit " |
| 177 |
"mask of supported commands. B<MEMBARRIER_CMD_QUERY>, which has the value 0, " |
| 178 |
"is not itself included in this bit mask. This command is always supported " |
| 179 |
"(on kernels where B<membarrier>() is provided)." |
| 180 |
msgstr "" |
| 181 |
|
| 182 |
#. type: TP |
| 183 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 184 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 185 |
#, no-wrap |
| 186 |
msgid "B<MEMBARRIER_CMD_GLOBAL> (since Linux 4.16)" |
| 187 |
msgstr "" |
| 188 |
|
| 189 |
#. type: Plain text |
| 190 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 191 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 192 |
msgid "" |
| 193 |
"Ensure that all threads from all processes on the system pass through a " |
| 194 |
"state where all memory accesses to user-space addresses match program order " |
| 195 |
"between entry to and return from the B<membarrier>() system call. All " |
| 196 |
"threads on the system are targeted by this command." |
| 197 |
msgstr "" |
| 198 |
|
| 199 |
#. type: TP |
| 200 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 201 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 202 |
#, no-wrap |
| 203 |
msgid "B<MEMBARRIER_CMD_GLOBAL_EXPEDITED> (since Linux 4.16)" |
| 204 |
msgstr "" |
| 205 |
|
| 206 |
#. type: Plain text |
| 207 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 208 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 209 |
msgid "" |
| 210 |
"Execute a memory barrier on all running threads of all processes that " |
| 211 |
"previously registered with B<MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED>." |
| 212 |
msgstr "" |
| 213 |
|
| 214 |
#. type: Plain text |
| 215 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 216 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 217 |
msgid "" |
| 218 |
"Upon return from the system call, the calling thread has a guarantee that " |
| 219 |
"all running threads have passed through a state where all memory accesses to " |
| 220 |
"user-space addresses match program order between entry to and return from " |
| 221 |
"the system call (non-running threads are de facto in such a state). This " |
| 222 |
"guarantee is provided only for the threads of processes that previously " |
| 223 |
"registered with B<MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED>." |
| 224 |
msgstr "" |
| 225 |
|
| 226 |
#. type: Plain text |
| 227 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 228 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 229 |
msgid "" |
| 230 |
"Given that registration is about the intent to receive the barriers, it is " |
| 231 |
"valid to invoke B<MEMBARRIER_CMD_GLOBAL_EXPEDITED> from a process that has " |
| 232 |
"not employed B<MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED>." |
| 233 |
msgstr "" |
| 234 |
|
| 235 |
#. type: Plain text |
| 236 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 237 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 238 |
msgid "" |
| 239 |
"The \"expedited\" commands complete faster than the non-expedited ones; they " |
| 240 |
"never block, but have the downside of causing extra overhead." |
| 241 |
msgstr "" |
| 242 |
|
| 243 |
#. type: TP |
| 244 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 245 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 246 |
#, no-wrap |
| 247 |
msgid "B<MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED> (since Linux 4.16)" |
| 248 |
msgstr "" |
| 249 |
|
| 250 |
#. type: Plain text |
| 251 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 252 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 253 |
msgid "" |
| 254 |
"Register the process's intent to receive B<MEMBARRIER_CMD_GLOBAL_EXPEDITED> " |
| 255 |
"memory barriers." |
| 256 |
msgstr "" |
| 257 |
|
| 258 |
#. type: TP |
| 259 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 260 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 261 |
#, no-wrap |
| 262 |
msgid "B<MEMBARRIER_CMD_PRIVATE_EXPEDITED> (since Linux 4.14)" |
| 263 |
msgstr "" |
| 264 |
|
| 265 |
#. type: Plain text |
| 266 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 267 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 268 |
msgid "" |
| 269 |
"Execute a memory barrier on each running thread belonging to the same " |
| 270 |
"process as the calling thread." |
| 271 |
msgstr "" |
| 272 |
|
| 273 |
#. type: Plain text |
| 274 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 275 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 276 |
msgid "" |
| 277 |
"Upon return from the system call, the calling thread has a guarantee that " |
| 278 |
"all its running thread siblings have passed through a state where all memory " |
| 279 |
"accesses to user-space addresses match program order between entry to and " |
| 280 |
"return from the system call (non-running threads are de facto in such a " |
| 281 |
"state). This guarantee is provided only for threads in the same process as " |
| 282 |
"the calling thread." |
| 283 |
msgstr "" |
| 284 |
|
| 285 |
#. type: Plain text |
| 286 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 287 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 288 |
msgid "" |
| 289 |
"A process must register its intent to use the private expedited command " |
| 290 |
"prior to using it." |
| 291 |
msgstr "" |
| 292 |
|
| 293 |
#. type: TP |
| 294 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 295 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 296 |
#, no-wrap |
| 297 |
msgid "B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED> (since Linux 4.14)" |
| 298 |
msgstr "" |
| 299 |
|
| 300 |
#. type: Plain text |
| 301 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 302 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 303 |
msgid "" |
| 304 |
"Register the process's intent to use B<MEMBARRIER_CMD_PRIVATE_EXPEDITED>." |
| 305 |
msgstr "" |
| 306 |
|
| 307 |
#. type: TP |
| 308 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 309 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 310 |
#, no-wrap |
| 311 |
msgid "B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE> (since Linux 4.16)" |
| 312 |
msgstr "" |
| 313 |
|
| 314 |
#. type: Plain text |
| 315 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 316 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 317 |
msgid "" |
| 318 |
"In addition to providing the memory ordering guarantees described in " |
| 319 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED>, upon return from system call the " |
| 320 |
"calling thread has a guarantee that all its running thread siblings have " |
| 321 |
"executed a core serializing instruction. This guarantee is provided only " |
| 322 |
"for threads in the same process as the calling thread." |
| 323 |
msgstr "" |
| 324 |
|
| 325 |
#. type: Plain text |
| 326 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 327 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 328 |
msgid "" |
| 329 |
"The \"expedited\" commands complete faster than the non-expedited ones, they " |
| 330 |
"never block, but have the downside of causing extra overhead." |
| 331 |
msgstr "" |
| 332 |
|
| 333 |
#. type: Plain text |
| 334 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 335 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 336 |
msgid "" |
| 337 |
"A process must register its intent to use the private expedited sync core " |
| 338 |
"command prior to using it." |
| 339 |
msgstr "" |
| 340 |
|
| 341 |
#. type: TP |
| 342 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 343 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 344 |
#, no-wrap |
| 345 |
msgid "B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE> (since Linux 4.16)" |
| 346 |
msgstr "" |
| 347 |
|
| 348 |
#. type: Plain text |
| 349 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 350 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 351 |
msgid "" |
| 352 |
"Register the process's intent to use " |
| 353 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE>." |
| 354 |
msgstr "" |
| 355 |
|
| 356 |
#. type: TP |
| 357 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 358 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 359 |
#, no-wrap |
| 360 |
msgid "B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ> (since Linux 5.10)" |
| 361 |
msgstr "" |
| 362 |
|
| 363 |
#. type: Plain text |
| 364 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 365 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 366 |
msgid "" |
| 367 |
"Ensure the caller thread, upon return from system call, that all its running " |
| 368 |
"thread siblings have any currently running rseq critical sections restarted " |
| 369 |
"if I<flags> parameter is 0; if I<flags> parameter is " |
| 370 |
"B<MEMBARRIER_CMD_FLAG_CPU>, then this operation is performed only on CPU " |
| 371 |
"indicated by I<cpu_id>. This guarantee is provided only for threads in the " |
| 372 |
"same process as the calling thread." |
| 373 |
msgstr "" |
| 374 |
|
| 375 |
#. type: Plain text |
| 376 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 377 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 378 |
msgid "RSEQ membarrier is only available in the \"private expedited\" form." |
| 379 |
msgstr "" |
| 380 |
|
| 381 |
#. type: Plain text |
| 382 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 383 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 384 |
msgid "" |
| 385 |
"A process must register its intent to use the private expedited rseq command " |
| 386 |
"prior to using it." |
| 387 |
msgstr "" |
| 388 |
|
| 389 |
#. type: TP |
| 390 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 391 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 392 |
#, no-wrap |
| 393 |
msgid "B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ> (since Linux 5.10)" |
| 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 "" |
| 400 |
"Register the process's intent to use " |
| 401 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ>." |
| 402 |
msgstr "" |
| 403 |
|
| 404 |
#. type: TP |
| 405 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 406 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 407 |
#, no-wrap |
| 408 |
msgid "B<MEMBARRIER_CMD_SHARED> (since Linux 4.3)" |
| 409 |
msgstr "" |
| 410 |
|
| 411 |
#. type: Plain text |
| 412 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 413 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 414 |
msgid "" |
| 415 |
"This is an alias for B<MEMBARRIER_CMD_GLOBAL> that exists for header " |
| 416 |
"backward compatibility." |
| 417 |
msgstr "" |
| 418 |
|
| 419 |
#. type: Plain text |
| 420 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 421 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 422 |
msgid "" |
| 423 |
"The I<flags> argument must be specified as 0 unless the command is " |
| 424 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ>, in which case I<flags> can be " |
| 425 |
"either 0 or B<MEMBARRIER_CMD_FLAG_CPU>." |
| 426 |
msgstr "" |
| 427 |
|
| 428 |
#. type: Plain text |
| 429 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 430 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 431 |
msgid "" |
| 432 |
"The I<cpu_id> argument is ignored unless I<flags> is " |
| 433 |
"B<MEMBARRIER_CMD_FLAG_CPU>, in which case it must specify the CPU targeted " |
| 434 |
"by this membarrier command." |
| 435 |
msgstr "" |
| 436 |
|
| 437 |
#. type: Plain text |
| 438 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 439 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 440 |
msgid "" |
| 441 |
"All memory accesses performed in program order from each targeted thread are " |
| 442 |
"guaranteed to be ordered with respect to B<membarrier>()." |
| 443 |
msgstr "" |
| 444 |
|
| 445 |
#. type: Plain text |
| 446 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 447 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 448 |
msgid "" |
| 449 |
"If we use the semantic I<barrier()> to represent a compiler barrier forcing " |
| 450 |
"memory accesses to be performed in program order across the barrier, and " |
| 451 |
"I<smp_mb()> to represent explicit memory barriers forcing full memory " |
| 452 |
"ordering across the barrier, we have the following ordering table for each " |
| 453 |
"pairing of I<barrier()>, B<membarrier>(), and I<smp_mb()>. The pair " |
| 454 |
"ordering is detailed as (O: ordered, X: not ordered):" |
| 455 |
msgstr "" |
| 456 |
|
| 457 |
#. type: tbl table |
| 458 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 459 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 460 |
#, no-wrap |
| 461 |
msgid "barrier()" |
| 462 |
msgstr "" |
| 463 |
|
| 464 |
#. type: tbl table |
| 465 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 466 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 467 |
#, no-wrap |
| 468 |
msgid "smp_mb()" |
| 469 |
msgstr "" |
| 470 |
|
| 471 |
#. type: tbl table |
| 472 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 473 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 474 |
#, no-wrap |
| 475 |
msgid "membarrier()" |
| 476 |
msgstr "" |
| 477 |
|
| 478 |
#. type: tbl table |
| 479 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 480 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 481 |
#, no-wrap |
| 482 |
msgid "X" |
| 483 |
msgstr "" |
| 484 |
|
| 485 |
#. type: tbl table |
| 486 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 487 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 488 |
#, no-wrap |
| 489 |
msgid "O" |
| 490 |
msgstr "" |
| 491 |
|
| 492 |
#. type: SH |
| 493 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 494 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 495 |
#, no-wrap |
| 496 |
msgid "RETURN VALUE" |
| 497 |
msgstr "" |
| 498 |
|
| 499 |
#. type: Plain text |
| 500 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 501 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 502 |
msgid "" |
| 503 |
"On success, the B<MEMBARRIER_CMD_QUERY> operation returns a bit mask of " |
| 504 |
"supported commands, and the B<MEMBARRIER_CMD_GLOBAL>, " |
| 505 |
"B<MEMBARRIER_CMD_GLOBAL_EXPEDITED>, " |
| 506 |
"B<MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED>, " |
| 507 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED>, " |
| 508 |
"B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED>, " |
| 509 |
"B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE>, and " |
| 510 |
"B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE> operations return " |
| 511 |
"zero. On error, -1 is returned, and I<errno> is set to indicate the error." |
| 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 |
"For a given command, with I<flags> set to 0, this system call is guaranteed " |
| 519 |
"to always return the same value until reboot. Further calls with the same " |
| 520 |
"arguments will lead to the same result. Therefore, with I<flags> set to 0, " |
| 521 |
"error handling is required only for the first call to B<membarrier>()." |
| 522 |
msgstr "" |
| 523 |
|
| 524 |
#. type: SH |
| 525 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 526 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 527 |
#, no-wrap |
| 528 |
msgid "ERRORS" |
| 529 |
msgstr "" |
| 530 |
|
| 531 |
#. type: TP |
| 532 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 533 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 534 |
#, no-wrap |
| 535 |
msgid "B<EINVAL>" |
| 536 |
msgstr "" |
| 537 |
|
| 538 |
#. type: Plain text |
| 539 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 540 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 541 |
msgid "" |
| 542 |
"I<cmd> is invalid, or I<flags> is nonzero, or the B<MEMBARRIER_CMD_GLOBAL> " |
| 543 |
"command is disabled because the I<nohz_full> CPU parameter has been set, or " |
| 544 |
"the B<MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE> and " |
| 545 |
"B<MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE> commands are not " |
| 546 |
"implemented by the architecture." |
| 547 |
msgstr "" |
| 548 |
|
| 549 |
#. type: TP |
| 550 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 551 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 552 |
#, no-wrap |
| 553 |
msgid "B<ENOSYS>" |
| 554 |
msgstr "" |
| 555 |
|
| 556 |
#. type: Plain text |
| 557 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 558 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 559 |
msgid "The B<membarrier>() system call is not implemented by this kernel." |
| 560 |
msgstr "" |
| 561 |
|
| 562 |
#. type: TP |
| 563 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 564 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 565 |
#, no-wrap |
| 566 |
msgid "B<EPERM>" |
| 567 |
msgstr "" |
| 568 |
|
| 569 |
#. type: Plain text |
| 570 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 571 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 572 |
msgid "" |
| 573 |
"The current process was not registered prior to using private expedited " |
| 574 |
"commands." |
| 575 |
msgstr "" |
| 576 |
|
| 577 |
#. type: SH |
| 578 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 579 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 580 |
#, no-wrap |
| 581 |
msgid "STANDARDS" |
| 582 |
msgstr "" |
| 583 |
|
| 584 |
#. type: Plain text |
| 585 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 586 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 587 |
msgid "Linux." |
| 588 |
msgstr "" |
| 589 |
|
| 590 |
#. type: SH |
| 591 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 592 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 593 |
#, no-wrap |
| 594 |
msgid "HISTORY" |
| 595 |
msgstr "" |
| 596 |
|
| 597 |
#. type: Plain text |
| 598 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 599 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 600 |
msgid "Linux 4.3." |
| 601 |
msgstr "" |
| 602 |
|
| 603 |
#. type: Plain text |
| 604 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 605 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 606 |
msgid "Before Linux 5.10, the prototype was:" |
| 607 |
msgstr "" |
| 608 |
|
| 609 |
#. type: Plain text |
| 610 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 611 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 612 |
#, no-wrap |
| 613 |
msgid "B<int membarrier(int >I<cmd>B<, int >I<flags>B<);>\n" |
| 614 |
msgstr "" |
| 615 |
|
| 616 |
#. type: SH |
| 617 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 618 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 619 |
#, no-wrap |
| 620 |
msgid "NOTES" |
| 621 |
msgstr "" |
| 622 |
|
| 623 |
#. type: Plain text |
| 624 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 625 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 626 |
msgid "" |
| 627 |
"A memory barrier instruction is part of the instruction set of architectures " |
| 628 |
"with weakly ordered memory models. It orders memory accesses prior to the " |
| 629 |
"barrier and after the barrier with respect to matching barriers on other " |
| 630 |
"cores. For instance, a load fence can order loads prior to and following " |
| 631 |
"that fence with respect to stores ordered by store fences." |
| 632 |
msgstr "" |
| 633 |
|
| 634 |
#. type: Plain text |
| 635 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 636 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 637 |
msgid "" |
| 638 |
"Program order is the order in which instructions are ordered in the program " |
| 639 |
"assembly code." |
| 640 |
msgstr "" |
| 641 |
|
| 642 |
#. type: Plain text |
| 643 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 644 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 645 |
msgid "" |
| 646 |
"Examples where B<membarrier>() can be useful include implementations of " |
| 647 |
"Read-Copy-Update libraries and garbage collectors." |
| 648 |
msgstr "" |
| 649 |
|
| 650 |
#. type: SH |
| 651 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 652 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 653 |
#, no-wrap |
| 654 |
msgid "EXAMPLES" |
| 655 |
msgstr "" |
| 656 |
|
| 657 |
#. type: Plain text |
| 658 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 659 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 660 |
msgid "" |
| 661 |
"Assuming a multithreaded application where \"fast_path()\" is executed very " |
| 662 |
"frequently, and where \"slow_path()\" is executed infrequently, the " |
| 663 |
"following code (x86) can be transformed using B<membarrier>():" |
| 664 |
msgstr "" |
| 665 |
|
| 666 |
#. type: Plain text |
| 667 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 668 |
#: opensuse-tumbleweed |
| 669 |
#, no-wrap |
| 670 |
msgid "" |
| 671 |
"#include E<lt>stdlib.hE<gt>\n" |
| 672 |
"\\&\n" |
| 673 |
"static volatile int a, b;\n" |
| 674 |
"\\&\n" |
| 675 |
"static void\n" |
| 676 |
"fast_path(int *read_b)\n" |
| 677 |
"{\n" |
| 678 |
" a = 1;\n" |
| 679 |
" asm volatile (\"mfence\" : : : \"memory\");\n" |
| 680 |
" *read_b = b;\n" |
| 681 |
"}\n" |
| 682 |
"\\&\n" |
| 683 |
"static void\n" |
| 684 |
"slow_path(int *read_a)\n" |
| 685 |
"{\n" |
| 686 |
" b = 1;\n" |
| 687 |
" asm volatile (\"mfence\" : : : \"memory\");\n" |
| 688 |
" *read_a = a;\n" |
| 689 |
"}\n" |
| 690 |
"\\&\n" |
| 691 |
"int\n" |
| 692 |
"main(void)\n" |
| 693 |
"{\n" |
| 694 |
" int read_a, read_b;\n" |
| 695 |
"\\&\n" |
| 696 |
" /*\n" |
| 697 |
" * Real applications would call fast_path() and slow_path()\n" |
| 698 |
" * from different threads. Call those from main() to keep\n" |
| 699 |
" * this example short.\n" |
| 700 |
" */\n" |
| 701 |
"\\&\n" |
| 702 |
" slow_path(&read_a);\n" |
| 703 |
" fast_path(&read_b);\n" |
| 704 |
"\\&\n" |
| 705 |
" /*\n" |
| 706 |
" * read_b == 0 implies read_a == 1 and\n" |
| 707 |
" * read_a == 0 implies read_b == 1.\n" |
| 708 |
" */\n" |
| 709 |
"\\&\n" |
| 710 |
" if (read_b == 0 && read_a == 0)\n" |
| 711 |
" abort();\n" |
| 712 |
"\\&\n" |
| 713 |
" exit(EXIT_SUCCESS);\n" |
| 714 |
"}\n" |
| 715 |
msgstr "" |
| 716 |
|
| 717 |
#. type: Plain text |
| 718 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 719 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 720 |
msgid "The code above transformed to use B<membarrier>() becomes:" |
| 721 |
msgstr "" |
| 722 |
|
| 723 |
#. type: Plain text |
| 724 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 725 |
#: opensuse-tumbleweed |
| 726 |
#, no-wrap |
| 727 |
msgid "" |
| 728 |
"#define _GNU_SOURCE\n" |
| 729 |
"#include E<lt>stdlib.hE<gt>\n" |
| 730 |
"#include E<lt>stdio.hE<gt>\n" |
| 731 |
"#include E<lt>unistd.hE<gt>\n" |
| 732 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 733 |
"#include E<lt>linux/membarrier.hE<gt>\n" |
| 734 |
"\\&\n" |
| 735 |
"static volatile int a, b;\n" |
| 736 |
"\\&\n" |
| 737 |
"static int\n" |
| 738 |
"membarrier(int cmd, unsigned int flags, int cpu_id)\n" |
| 739 |
"{\n" |
| 740 |
" return syscall(__NR_membarrier, cmd, flags, cpu_id);\n" |
| 741 |
"}\n" |
| 742 |
"\\&\n" |
| 743 |
"static int\n" |
| 744 |
"init_membarrier(void)\n" |
| 745 |
"{\n" |
| 746 |
" int ret;\n" |
| 747 |
"\\&\n" |
| 748 |
" /* Check that membarrier() is supported. */\n" |
| 749 |
"\\&\n" |
| 750 |
" ret = membarrier(MEMBARRIER_CMD_QUERY, 0, 0);\n" |
| 751 |
" if (ret E<lt> 0) {\n" |
| 752 |
" perror(\"membarrier\");\n" |
| 753 |
" return -1;\n" |
| 754 |
" }\n" |
| 755 |
"\\&\n" |
| 756 |
" if (!(ret & MEMBARRIER_CMD_GLOBAL)) {\n" |
| 757 |
" fprintf(stderr,\n" |
| 758 |
" \"membarrier does not support MEMBARRIER_CMD_GLOBAL\\[rs]n\");\n" |
| 759 |
" return -1;\n" |
| 760 |
" }\n" |
| 761 |
"\\&\n" |
| 762 |
" return 0;\n" |
| 763 |
"}\n" |
| 764 |
"\\&\n" |
| 765 |
"static void\n" |
| 766 |
"fast_path(int *read_b)\n" |
| 767 |
"{\n" |
| 768 |
" a = 1;\n" |
| 769 |
" asm volatile (\"\" : : : \"memory\");\n" |
| 770 |
" *read_b = b;\n" |
| 771 |
"}\n" |
| 772 |
"\\&\n" |
| 773 |
"static void\n" |
| 774 |
"slow_path(int *read_a)\n" |
| 775 |
"{\n" |
| 776 |
" b = 1;\n" |
| 777 |
" membarrier(MEMBARRIER_CMD_GLOBAL, 0, 0);\n" |
| 778 |
" *read_a = a;\n" |
| 779 |
"}\n" |
| 780 |
"\\&\n" |
| 781 |
"int\n" |
| 782 |
"main(int argc, char *argv[])\n" |
| 783 |
"{\n" |
| 784 |
" int read_a, read_b;\n" |
| 785 |
"\\&\n" |
| 786 |
" if (init_membarrier())\n" |
| 787 |
" exit(EXIT_FAILURE);\n" |
| 788 |
"\\&\n" |
| 789 |
" /*\n" |
| 790 |
" * Real applications would call fast_path() and slow_path()\n" |
| 791 |
" * from different threads. Call those from main() to keep\n" |
| 792 |
" * this example short.\n" |
| 793 |
" */\n" |
| 794 |
"\\&\n" |
| 795 |
" slow_path(&read_a);\n" |
| 796 |
" fast_path(&read_b);\n" |
| 797 |
"\\&\n" |
| 798 |
" /*\n" |
| 799 |
" * read_b == 0 implies read_a == 1 and\n" |
| 800 |
" * read_a == 0 implies read_b == 1.\n" |
| 801 |
" */\n" |
| 802 |
"\\&\n" |
| 803 |
" if (read_b == 0 && read_a == 0)\n" |
| 804 |
" abort();\n" |
| 805 |
"\\&\n" |
| 806 |
" exit(EXIT_SUCCESS);\n" |
| 807 |
"}\n" |
| 808 |
msgstr "" |
| 809 |
|
| 810 |
#. type: TH |
| 811 |
#: debian-trixie |
| 812 |
#, no-wrap |
| 813 |
msgid "2024-06-15" |
| 814 |
msgstr "" |
| 815 |
|
| 816 |
#. type: TH |
| 817 |
#: debian-trixie |
| 818 |
#, no-wrap |
| 819 |
msgid "Linux man-pages 6.9.1" |
| 820 |
msgstr "" |
| 821 |
|
| 822 |
#. type: Plain text |
| 823 |
#: debian-trixie |
| 824 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 825 |
msgstr "" |
| 826 |
|
| 827 |
#. type: Plain text |
| 828 |
#: debian-trixie fedora-44 fedora-rawhide |
| 829 |
#, no-wrap |
| 830 |
msgid "" |
| 831 |
"#include E<lt>stdlib.hE<gt>\n" |
| 832 |
"\\&\n" |
| 833 |
"static volatile int a, b;\n" |
| 834 |
"\\&\n" |
| 835 |
"static void\n" |
| 836 |
"fast_path(int *read_b)\n" |
| 837 |
"{\n" |
| 838 |
" a = 1;\n" |
| 839 |
" asm volatile (\"mfence\" : : : \"memory\");\n" |
| 840 |
" *read_b = b;\n" |
| 841 |
"}\n" |
| 842 |
"\\&\n" |
| 843 |
"static void\n" |
| 844 |
"slow_path(int *read_a)\n" |
| 845 |
"{\n" |
| 846 |
" b = 1;\n" |
| 847 |
" asm volatile (\"mfence\" : : : \"memory\");\n" |
| 848 |
" *read_a = a;\n" |
| 849 |
"}\n" |
| 850 |
"\\&\n" |
| 851 |
"int\n" |
| 852 |
"main(void)\n" |
| 853 |
"{\n" |
| 854 |
" int read_a, read_b;\n" |
| 855 |
"\\&\n" |
| 856 |
" /*\n" |
| 857 |
" * Real applications would call fast_path() and slow_path()\n" |
| 858 |
" * from different threads. Call those from main() to keep\n" |
| 859 |
" * this example short.\n" |
| 860 |
" */\n" |
| 861 |
"\\&\n" |
| 862 |
" slow_path(&read_a);\n" |
| 863 |
" fast_path(&read_b);\n" |
| 864 |
"\\&\n" |
| 865 |
" /*\n" |
| 866 |
" * read_b == 0 implies read_a == 1 and\n" |
| 867 |
" * read_a == 0 implies read_b == 1.\n" |
| 868 |
" */\n" |
| 869 |
"\\&\n" |
| 870 |
" if (read_b == 0 && read_a == 0)\n" |
| 871 |
" abort();\n" |
| 872 |
"\\&\n" |
| 873 |
" exit(EXIT_SUCCESS);\n" |
| 874 |
"}\n" |
| 875 |
msgstr "" |
| 876 |
|
| 877 |
#. type: Plain text |
| 878 |
#: debian-trixie fedora-44 fedora-rawhide |
| 879 |
#, no-wrap |
| 880 |
msgid "" |
| 881 |
"#define _GNU_SOURCE\n" |
| 882 |
"#include E<lt>stdlib.hE<gt>\n" |
| 883 |
"#include E<lt>stdio.hE<gt>\n" |
| 884 |
"#include E<lt>unistd.hE<gt>\n" |
| 885 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 886 |
"#include E<lt>linux/membarrier.hE<gt>\n" |
| 887 |
"\\&\n" |
| 888 |
"static volatile int a, b;\n" |
| 889 |
"\\&\n" |
| 890 |
"static int\n" |
| 891 |
"membarrier(int cmd, unsigned int flags, int cpu_id)\n" |
| 892 |
"{\n" |
| 893 |
" return syscall(__NR_membarrier, cmd, flags, cpu_id);\n" |
| 894 |
"}\n" |
| 895 |
"\\&\n" |
| 896 |
"static int\n" |
| 897 |
"init_membarrier(void)\n" |
| 898 |
"{\n" |
| 899 |
" int ret;\n" |
| 900 |
"\\&\n" |
| 901 |
" /* Check that membarrier() is supported. */\n" |
| 902 |
"\\&\n" |
| 903 |
" ret = membarrier(MEMBARRIER_CMD_QUERY, 0, 0);\n" |
| 904 |
" if (ret E<lt> 0) {\n" |
| 905 |
" perror(\"membarrier\");\n" |
| 906 |
" return -1;\n" |
| 907 |
" }\n" |
| 908 |
"\\&\n" |
| 909 |
" if (!(ret & MEMBARRIER_CMD_GLOBAL)) {\n" |
| 910 |
" fprintf(stderr,\n" |
| 911 |
" \"membarrier does not support MEMBARRIER_CMD_GLOBAL\\[rs]n\");\n" |
| 912 |
" return -1;\n" |
| 913 |
" }\n" |
| 914 |
"\\&\n" |
| 915 |
" return 0;\n" |
| 916 |
"}\n" |
| 917 |
"\\&\n" |
| 918 |
"static void\n" |
| 919 |
"fast_path(int *read_b)\n" |
| 920 |
"{\n" |
| 921 |
" a = 1;\n" |
| 922 |
" asm volatile (\"\" : : : \"memory\");\n" |
| 923 |
" *read_b = b;\n" |
| 924 |
"}\n" |
| 925 |
"\\&\n" |
| 926 |
"static void\n" |
| 927 |
"slow_path(int *read_a)\n" |
| 928 |
"{\n" |
| 929 |
" b = 1;\n" |
| 930 |
" membarrier(MEMBARRIER_CMD_GLOBAL, 0, 0);\n" |
| 931 |
" *read_a = a;\n" |
| 932 |
"}\n" |
| 933 |
"\\&\n" |
| 934 |
"int\n" |
| 935 |
"main(int argc, char *argv[])\n" |
| 936 |
"{\n" |
| 937 |
" int read_a, read_b;\n" |
| 938 |
"\\&\n" |
| 939 |
" if (init_membarrier())\n" |
| 940 |
" exit(EXIT_FAILURE);\n" |
| 941 |
"\\&\n" |
| 942 |
" /*\n" |
| 943 |
" * Real applications would call fast_path() and slow_path()\n" |
| 944 |
" * from different threads. Call those from main() to keep\n" |
| 945 |
" * this example short.\n" |
| 946 |
" */\n" |
| 947 |
"\\&\n" |
| 948 |
" slow_path(&read_a);\n" |
| 949 |
" fast_path(&read_b);\n" |
| 950 |
"\\&\n" |
| 951 |
" /*\n" |
| 952 |
" * read_b == 0 implies read_a == 1 and\n" |
| 953 |
" * read_a == 0 implies read_b == 1.\n" |
| 954 |
" */\n" |
| 955 |
"\\&\n" |
| 956 |
" if (read_b == 0 && read_a == 0)\n" |
| 957 |
" abort();\n" |
| 958 |
"\\&\n" |
| 959 |
" exit(EXIT_SUCCESS);\n" |
| 960 |
"}\n" |
| 961 |
msgstr "" |
| 962 |
|
| 963 |
#. type: TH |
| 964 |
#: fedora-44 fedora-rawhide |
| 965 |
#, no-wrap |
| 966 |
msgid "2024-07-23" |
| 967 |
msgstr "" |
| 968 |
|
| 969 |
#. type: TH |
| 970 |
#: fedora-44 fedora-rawhide |
| 971 |
#, no-wrap |
| 972 |
msgid "Linux man-pages 6.13" |
| 973 |
msgstr "" |
| 974 |
|
| 975 |
#. type: TH |
| 976 |
#: mageia-cauldron |
| 977 |
#, no-wrap |
| 978 |
msgid "Linux man-pages 6.17" |
| 979 |
msgstr "" |
| 980 |
|
| 981 |
#. type: TH |
| 982 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 983 |
#, no-wrap |
| 984 |
msgid "Linux man-pages (unreleased)" |
| 985 |
msgstr "" |