| 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:23+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 "dup" |
| 24 |
msgstr "" |
| 25 |
|
| 26 |
#. type: TH |
| 27 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 28 |
#: opensuse-tumbleweed |
| 29 |
#, no-wrap |
| 30 |
msgid "2026-02-08" |
| 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 "dup, dup2, dup3 - duplicate a file descriptor" |
| 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 "B<#include E<lt>unistd.hE<gt>>\n" |
| 77 |
msgstr "" |
| 78 |
|
| 79 |
#. type: Plain text |
| 80 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 81 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 82 |
#, no-wrap |
| 83 |
msgid "" |
| 84 |
"B<int dup(int >I<oldfd>B<);>\n" |
| 85 |
"B<int dup2(int >I<oldfd>B<, int >I<newfd>B<);>\n" |
| 86 |
msgstr "" |
| 87 |
|
| 88 |
#. type: Plain text |
| 89 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 90 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 91 |
#, no-wrap |
| 92 |
msgid "" |
| 93 |
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 94 |
"B<#include E<lt>fcntl.hE<gt>> /* Definition of B<O_*> constants */\n" |
| 95 |
"B<#include E<lt>unistd.hE<gt>>\n" |
| 96 |
msgstr "" |
| 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 "B<int dup3(int >I<oldfd>B<, int >I<newfd>B<, int >I<flags>B<);>\n" |
| 103 |
msgstr "" |
| 104 |
|
| 105 |
#. type: SH |
| 106 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 107 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 108 |
#, no-wrap |
| 109 |
msgid "DESCRIPTION" |
| 110 |
msgstr "" |
| 111 |
|
| 112 |
#. type: Plain text |
| 113 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 114 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 115 |
msgid "" |
| 116 |
"The B<dup>() system call allocates a new file descriptor that refers to the " |
| 117 |
"same open file description as the descriptor I<oldfd>. (For an explanation " |
| 118 |
"of open file descriptions, see B<open>(2).) The new file descriptor number " |
| 119 |
"is guaranteed to be the lowest-numbered file descriptor that was unused in " |
| 120 |
"the calling process." |
| 121 |
msgstr "" |
| 122 |
|
| 123 |
#. type: Plain text |
| 124 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 125 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 126 |
msgid "" |
| 127 |
"After a successful return, the old and new file descriptors may be used " |
| 128 |
"interchangeably. Since the two file descriptors refer to the same open file " |
| 129 |
"description, they share file offset and file status flags; for example, if " |
| 130 |
"the file offset is modified by using B<lseek>(2) on one of the file " |
| 131 |
"descriptors, the offset is also changed for the other file descriptor." |
| 132 |
msgstr "" |
| 133 |
|
| 134 |
#. type: Plain text |
| 135 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 136 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 137 |
msgid "" |
| 138 |
"The two file descriptors do not share file descriptor flags (the close-on-" |
| 139 |
"exec flag). The close-on-exec flag (B<FD_CLOEXEC>; see B<fcntl>(2)) for " |
| 140 |
"the duplicate descriptor is off." |
| 141 |
msgstr "" |
| 142 |
|
| 143 |
#. type: SS |
| 144 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 145 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 146 |
#, no-wrap |
| 147 |
msgid "dup2()" |
| 148 |
msgstr "" |
| 149 |
|
| 150 |
#. type: Plain text |
| 151 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 152 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 153 |
msgid "" |
| 154 |
"The B<dup2>() system call performs the same task as B<dup>(), but instead " |
| 155 |
"of using the lowest-numbered unused file descriptor, it uses the file " |
| 156 |
"descriptor number specified in I<newfd>. In other words, the file " |
| 157 |
"descriptor I<newfd> is adjusted so that it now refers to the same open file " |
| 158 |
"description as I<oldfd>." |
| 159 |
msgstr "" |
| 160 |
|
| 161 |
#. type: Plain text |
| 162 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 163 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 164 |
msgid "" |
| 165 |
"If the file descriptor I<newfd> was previously open, it is closed before " |
| 166 |
"being reused; the close is performed silently (i.e., any errors during the " |
| 167 |
"close are not reported by B<dup2>())." |
| 168 |
msgstr "" |
| 169 |
|
| 170 |
#. type: Plain text |
| 171 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 172 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 173 |
msgid "" |
| 174 |
"The steps of closing and reusing the file descriptor I<newfd> are performed " |
| 175 |
"I<atomically>. This is important, because trying to implement equivalent " |
| 176 |
"functionality using B<close>(2) and B<dup>() would be subject to race " |
| 177 |
"conditions, whereby I<newfd> might be reused between the two steps. Such " |
| 178 |
"reuse could happen because the main program is interrupted by a signal " |
| 179 |
"handler that allocates a file descriptor, or because a parallel thread " |
| 180 |
"allocates a file descriptor." |
| 181 |
msgstr "" |
| 182 |
|
| 183 |
#. type: Plain text |
| 184 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 185 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 186 |
msgid "Note the following points:" |
| 187 |
msgstr "" |
| 188 |
|
| 189 |
#. type: IP |
| 190 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 191 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 192 |
#, no-wrap |
| 193 |
msgid "\\[bu]" |
| 194 |
msgstr "" |
| 195 |
|
| 196 |
#. type: Plain text |
| 197 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 198 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 199 |
msgid "" |
| 200 |
"If I<oldfd> is not a valid file descriptor, then the call fails, and " |
| 201 |
"I<newfd> is not closed." |
| 202 |
msgstr "" |
| 203 |
|
| 204 |
#. type: Plain text |
| 205 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 206 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 207 |
msgid "" |
| 208 |
"If I<oldfd> is a valid file descriptor, and I<newfd> has the same value as " |
| 209 |
"I<oldfd>, then B<dup2>() does nothing, and returns I<newfd>." |
| 210 |
msgstr "" |
| 211 |
|
| 212 |
#. type: SS |
| 213 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 214 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 215 |
#, no-wrap |
| 216 |
msgid "dup3()" |
| 217 |
msgstr "" |
| 218 |
|
| 219 |
#. type: Plain text |
| 220 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 221 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 222 |
msgid "B<dup3>() is the same as B<dup2>(), except that:" |
| 223 |
msgstr "" |
| 224 |
|
| 225 |
#. type: Plain text |
| 226 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 227 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 228 |
msgid "" |
| 229 |
"The caller can force the close-on-exec flag to be set for the new file " |
| 230 |
"descriptor by specifying B<O_CLOEXEC> in I<flags>. See the description of " |
| 231 |
"the same flag in B<open>(2) for reasons why this may be useful." |
| 232 |
msgstr "" |
| 233 |
|
| 234 |
#. Ulrich Drepper, LKML, 2008-10-09: |
| 235 |
#. We deliberately decided on this change. Otherwise, what is the |
| 236 |
#. result of dup3(fd, fd, O_CLOEXEC)? |
| 237 |
#. type: Plain text |
| 238 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 239 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 240 |
msgid "" |
| 241 |
"If I<oldfd> equals I<newfd>, then B<dup3>() fails with the error B<EINVAL>." |
| 242 |
msgstr "" |
| 243 |
|
| 244 |
#. type: SH |
| 245 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 246 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 247 |
#, no-wrap |
| 248 |
msgid "RETURN VALUE" |
| 249 |
msgstr "" |
| 250 |
|
| 251 |
#. type: Plain text |
| 252 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 253 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 254 |
msgid "" |
| 255 |
"On success, these system calls return the new file descriptor. On error, -1 " |
| 256 |
"is returned, and I<errno> is set to indicate the error." |
| 257 |
msgstr "" |
| 258 |
|
| 259 |
#. type: SH |
| 260 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 261 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 262 |
#, no-wrap |
| 263 |
msgid "ERRORS" |
| 264 |
msgstr "" |
| 265 |
|
| 266 |
#. type: TP |
| 267 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 268 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 269 |
#, no-wrap |
| 270 |
msgid "B<EBADF>" |
| 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 "I<oldfd> isn't an open file descriptor." |
| 277 |
msgstr "" |
| 278 |
|
| 279 |
#. type: Plain text |
| 280 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 281 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 282 |
msgid "" |
| 283 |
"I<newfd> is out of the allowed range for file descriptors (see the " |
| 284 |
"discussion of B<RLIMIT_NOFILE> in B<getrlimit>(2))." |
| 285 |
msgstr "" |
| 286 |
|
| 287 |
#. type: TP |
| 288 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 289 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 290 |
#, no-wrap |
| 291 |
msgid "B<EBUSY>" |
| 292 |
msgstr "" |
| 293 |
|
| 294 |
#. type: Plain text |
| 295 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 296 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 297 |
msgid "" |
| 298 |
"(Linux only) This may be returned by B<dup2>() or B<dup3>() during a race " |
| 299 |
"condition with B<open>(2) and B<dup>()." |
| 300 |
msgstr "" |
| 301 |
|
| 302 |
#. type: TP |
| 303 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 304 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 305 |
#, no-wrap |
| 306 |
msgid "B<EINTR>" |
| 307 |
msgstr "" |
| 308 |
|
| 309 |
#. type: Plain text |
| 310 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 311 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 312 |
msgid "" |
| 313 |
"The B<dup2>() or B<dup3>() call was interrupted by a signal; see " |
| 314 |
"B<signal>(7)." |
| 315 |
msgstr "" |
| 316 |
|
| 317 |
#. type: TP |
| 318 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 319 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 320 |
#, no-wrap |
| 321 |
msgid "B<EINVAL>" |
| 322 |
msgstr "" |
| 323 |
|
| 324 |
#. type: Plain text |
| 325 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 326 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 327 |
msgid "(B<dup3>()) I<flags> contain an invalid value." |
| 328 |
msgstr "" |
| 329 |
|
| 330 |
#. type: Plain text |
| 331 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 332 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 333 |
msgid "(B<dup3>()) I<oldfd> was equal to I<newfd>." |
| 334 |
msgstr "" |
| 335 |
|
| 336 |
#. type: TP |
| 337 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 338 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 339 |
#, no-wrap |
| 340 |
msgid "B<EMFILE>" |
| 341 |
msgstr "" |
| 342 |
|
| 343 |
#. type: Plain text |
| 344 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 345 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 346 |
msgid "" |
| 347 |
"The per-process limit on the number of open file descriptors has been " |
| 348 |
"reached (see the discussion of B<RLIMIT_NOFILE> in B<getrlimit>(2))." |
| 349 |
msgstr "" |
| 350 |
|
| 351 |
#. type: TP |
| 352 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 353 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 354 |
#, no-wrap |
| 355 |
msgid "B<ENOMEM>" |
| 356 |
msgstr "" |
| 357 |
|
| 358 |
#. type: Plain text |
| 359 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 360 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 361 |
msgid "Insufficient kernel memory was available." |
| 362 |
msgstr "" |
| 363 |
|
| 364 |
#. type: SH |
| 365 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 366 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 367 |
#, no-wrap |
| 368 |
msgid "STANDARDS" |
| 369 |
msgstr "" |
| 370 |
|
| 371 |
#. type: Plain text |
| 372 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 373 |
#: opensuse-tumbleweed |
| 374 |
msgid "POSIX.1-2024." |
| 375 |
msgstr "" |
| 376 |
|
| 377 |
#. type: SH |
| 378 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 379 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 380 |
#, no-wrap |
| 381 |
msgid "HISTORY" |
| 382 |
msgstr "" |
| 383 |
|
| 384 |
#. type: TP |
| 385 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 386 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 387 |
#, no-wrap |
| 388 |
msgid "B<dup>()" |
| 389 |
msgstr "" |
| 390 |
|
| 391 |
#. type: TQ |
| 392 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 393 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 394 |
#, no-wrap |
| 395 |
msgid "B<dup2>()" |
| 396 |
msgstr "" |
| 397 |
|
| 398 |
#. SVr4 documents additional |
| 399 |
#. EINTR and ENOLINK error conditions. POSIX.1 adds EINTR. |
| 400 |
#. The EBUSY return is Linux-specific. |
| 401 |
#. type: Plain text |
| 402 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 403 |
#: opensuse-tumbleweed |
| 404 |
msgid "4.3BSD, SVr4, POSIX.1-1988." |
| 405 |
msgstr "" |
| 406 |
|
| 407 |
#. type: TP |
| 408 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 409 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 410 |
#, no-wrap |
| 411 |
msgid "B<dup3>()" |
| 412 |
msgstr "" |
| 413 |
|
| 414 |
#. type: Plain text |
| 415 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 416 |
#: opensuse-tumbleweed |
| 417 |
msgid "POSIX.1-2024. Linux 2.6.27, glibc 2.9." |
| 418 |
msgstr "" |
| 419 |
|
| 420 |
#. type: SH |
| 421 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 422 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 423 |
#, no-wrap |
| 424 |
msgid "NOTES" |
| 425 |
msgstr "" |
| 426 |
|
| 427 |
#. type: Plain text |
| 428 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 429 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 430 |
msgid "" |
| 431 |
"The error returned by B<dup2>() is different from that returned by " |
| 432 |
"B<fcntl(>..., B<F_DUPFD>, ...B<)> when I<newfd> is out of range. On some " |
| 433 |
"systems, B<dup2>() also sometimes returns B<EINVAL> like B<F_DUPFD>." |
| 434 |
msgstr "" |
| 435 |
|
| 436 |
#. type: Plain text |
| 437 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 438 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 439 |
msgid "" |
| 440 |
"If I<newfd> was open, any errors that would have been reported at " |
| 441 |
"B<close>(2) time are lost. If this is of concern, then\\[em]unless the " |
| 442 |
"program is single-threaded and does not allocate file descriptors in signal " |
| 443 |
"handlers\\[em]the correct approach is I<not> to close I<newfd> before " |
| 444 |
"calling B<dup2>(), because of the race condition described above. Instead, " |
| 445 |
"code something like the following could be used:" |
| 446 |
msgstr "" |
| 447 |
|
| 448 |
#. type: Plain text |
| 449 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 450 |
#: opensuse-tumbleweed |
| 451 |
#, no-wrap |
| 452 |
msgid "" |
| 453 |
"/* Obtain a duplicate of \\[aq]newfd\\[aq] that can subsequently\n" |
| 454 |
" be used to check for close() errors; an EBADF error\n" |
| 455 |
" means that \\[aq]newfd\\[aq] was not open. */\n" |
| 456 |
"\\&\n" |
| 457 |
"tmpfd = dup(newfd);\n" |
| 458 |
"if (tmpfd == -1 && errno != EBADF) {\n" |
| 459 |
" /* Handle unexpected dup() error. */\n" |
| 460 |
"}\n" |
| 461 |
"\\&\n" |
| 462 |
"/* Atomically duplicate \\[aq]oldfd\\[aq] on \\[aq]newfd\\[aq]. */\n" |
| 463 |
"\\&\n" |
| 464 |
"if (dup2(oldfd, newfd) == -1) {\n" |
| 465 |
" /* Handle dup2() error. */\n" |
| 466 |
"}\n" |
| 467 |
"\\&\n" |
| 468 |
"/* Now check for close() errors on the file originally\n" |
| 469 |
" referred to by \\[aq]newfd\\[aq]. */\n" |
| 470 |
"\\&\n" |
| 471 |
"if (tmpfd != -1) {\n" |
| 472 |
" if (close(tmpfd) == -1) {\n" |
| 473 |
" /* Handle errors from close. */\n" |
| 474 |
" }\n" |
| 475 |
"}\n" |
| 476 |
msgstr "" |
| 477 |
|
| 478 |
#. type: SH |
| 479 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 480 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 481 |
#, no-wrap |
| 482 |
msgid "SEE ALSO" |
| 483 |
msgstr "" |
| 484 |
|
| 485 |
#. type: Plain text |
| 486 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 487 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 488 |
msgid "B<close>(2), B<fcntl>(2), B<open>(2), B<pidfd_getfd>(2)" |
| 489 |
msgstr "" |
| 490 |
|
| 491 |
#. type: TH |
| 492 |
#: debian-trixie |
| 493 |
#, no-wrap |
| 494 |
msgid "2024-05-02" |
| 495 |
msgstr "" |
| 496 |
|
| 497 |
#. type: TH |
| 498 |
#: debian-trixie |
| 499 |
#, no-wrap |
| 500 |
msgid "Linux man-pages 6.9.1" |
| 501 |
msgstr "" |
| 502 |
|
| 503 |
#. type: Plain text |
| 504 |
#: debian-trixie |
| 505 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 506 |
msgstr "" |
| 507 |
|
| 508 |
#. type: Plain text |
| 509 |
#: debian-trixie fedora-44 fedora-rawhide |
| 510 |
msgid "POSIX.1-2008." |
| 511 |
msgstr "" |
| 512 |
|
| 513 |
#. type: Plain text |
| 514 |
#: debian-trixie fedora-44 fedora-rawhide |
| 515 |
msgid "Linux." |
| 516 |
msgstr "" |
| 517 |
|
| 518 |
#. SVr4 documents additional |
| 519 |
#. EINTR and ENOLINK error conditions. POSIX.1 adds EINTR. |
| 520 |
#. The EBUSY return is Linux-specific. |
| 521 |
#. type: Plain text |
| 522 |
#: debian-trixie fedora-44 fedora-rawhide |
| 523 |
msgid "POSIX.1-2001, SVr4, 4.3BSD." |
| 524 |
msgstr "" |
| 525 |
|
| 526 |
#. type: Plain text |
| 527 |
#: debian-trixie fedora-44 fedora-rawhide |
| 528 |
msgid "Linux 2.6.27, glibc 2.9." |
| 529 |
msgstr "" |
| 530 |
|
| 531 |
#. type: Plain text |
| 532 |
#: debian-trixie fedora-44 fedora-rawhide |
| 533 |
#, no-wrap |
| 534 |
msgid "" |
| 535 |
"/* Obtain a duplicate of \\[aq]newfd\\[aq] that can subsequently\n" |
| 536 |
" be used to check for close() errors; an EBADF error\n" |
| 537 |
" means that \\[aq]newfd\\[aq] was not open. */\n" |
| 538 |
"\\&\n" |
| 539 |
"tmpfd = dup(newfd);\n" |
| 540 |
"if (tmpfd == -1 && errno != EBADF) {\n" |
| 541 |
" /* Handle unexpected dup() error. */\n" |
| 542 |
"}\n" |
| 543 |
"\\&\n" |
| 544 |
"/* Atomically duplicate \\[aq]oldfd\\[aq] on \\[aq]newfd\\[aq]. */\n" |
| 545 |
"\\&\n" |
| 546 |
"if (dup2(oldfd, newfd) == -1) {\n" |
| 547 |
" /* Handle dup2() error. */\n" |
| 548 |
"}\n" |
| 549 |
"\\&\n" |
| 550 |
"/* Now check for close() errors on the file originally\n" |
| 551 |
" referred to by \\[aq]newfd\\[aq]. */\n" |
| 552 |
"\\&\n" |
| 553 |
"if (tmpfd != -1) {\n" |
| 554 |
" if (close(tmpfd) == -1) {\n" |
| 555 |
" /* Handle errors from close. */\n" |
| 556 |
" }\n" |
| 557 |
"}\n" |
| 558 |
msgstr "" |
| 559 |
|
| 560 |
#. type: TH |
| 561 |
#: fedora-44 fedora-rawhide |
| 562 |
#, no-wrap |
| 563 |
msgid "2024-11-01" |
| 564 |
msgstr "" |
| 565 |
|
| 566 |
#. type: TH |
| 567 |
#: fedora-44 fedora-rawhide |
| 568 |
#, no-wrap |
| 569 |
msgid "Linux man-pages 6.13" |
| 570 |
msgstr "" |
| 571 |
|
| 572 |
#. type: TH |
| 573 |
#: mageia-cauldron |
| 574 |
#, no-wrap |
| 575 |
msgid "Linux man-pages 6.17" |
| 576 |
msgstr "" |
| 577 |
|
| 578 |
#. type: TH |
| 579 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 580 |
#, no-wrap |
| 581 |
msgid "Linux man-pages (unreleased)" |
| 582 |
msgstr "" |