Debian Codegraph @

templates/man2/readlink.2.pot

raw
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:39+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 "readlink"
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 "readlink, readlinkat - read value of a symbolic link"
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-unstable mageia-cauldron opensuse-leap-16-1
81 #: opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<ssize_t readlink(>size_t bufsiz;\n"
85 "B< const char *restrict >I<path>B<,>\n"
86 "B< char >I<buf>B<[restrict >I<bufsiz>B<], size_t >I<bufsiz>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 #, no-wrap
93 msgid ""
94 "B<#include E<lt>fcntl.hE<gt> >/* Definition of B<AT_*> constants */\n"
95 "B<#include E<lt>unistd.hE<gt>>\n"
96 msgstr ""
97
98 #. type: Plain text
99 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
100 #: opensuse-tumbleweed
101 #, no-wrap
102 msgid ""
103 "B<ssize_t readlinkat(>size_t bufsiz;\n"
104 "B< int >I<dirfd>B<, const char *restrict >I<path>B<,>\n"
105 "B< char >I<buf>B<[restrict >I<bufsiz>B<], size_t >I<bufsiz>B<);>\n"
106 msgstr ""
107
108 #. type: Plain text
109 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
110 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
111 msgid ""
112 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
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 "B<readlink>():"
119 msgstr ""
120
121 #. || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 #, no-wrap
126 msgid ""
127 " _XOPEN_SOURCE E<gt>= 500 || _POSIX_C_SOURCE E<gt>= 200112L\n"
128 " || /* glibc E<lt>= 2.19: */ _BSD_SOURCE\n"
129 msgstr ""
130
131 #. type: Plain text
132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
134 msgid "B<readlinkat>():"
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 #, no-wrap
141 msgid ""
142 " Since glibc 2.10:\n"
143 " _POSIX_C_SOURCE E<gt>= 200809L\n"
144 " Before glibc 2.10:\n"
145 " _ATFILE_SOURCE\n"
146 msgstr ""
147
148 #. type: SH
149 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
150 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
151 #, no-wrap
152 msgid "DESCRIPTION"
153 msgstr ""
154
155 #. type: Plain text
156 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
157 #: opensuse-tumbleweed
158 msgid ""
159 "B<readlink>() places the contents of the symbolic link I<path> in the "
160 "buffer I<buf>, which has size I<bufsiz>. B<readlink>() does not append a "
161 "terminating null byte to I<buf>. It will (silently) truncate the contents "
162 "(to a length of I<bufsiz> characters), in case the buffer is too small to "
163 "hold all of the contents."
164 msgstr ""
165
166 #. type: SS
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 #, no-wrap
170 msgid "readlinkat()"
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid ""
177 "The B<readlinkat>() system call operates in exactly the same way as "
178 "B<readlink>(), except for the differences described here."
179 msgstr ""
180
181 #. type: Plain text
182 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
183 #: opensuse-tumbleweed
184 msgid ""
185 "If I<path> is relative, then it is interpreted relative to the directory "
186 "referred to by the file descriptor I<dirfd> (rather than relative to the "
187 "current working directory of the calling process, as is done by "
188 "B<readlink>() for a relative pathname)."
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
193 #: opensuse-tumbleweed
194 msgid ""
195 "If I<path> is relative and I<dirfd> is the special value B<AT_FDCWD>, then "
196 "I<path> is interpreted relative to the current working directory of the "
197 "calling process (like B<readlink>())."
198 msgstr ""
199
200 #. type: Plain text
201 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
202 #: opensuse-tumbleweed
203 msgid "If I<path> is absolute, then I<dirfd> is ignored."
204 msgstr ""
205
206 #. commit 65cfc6722361570bfe255698d9cd4dccaf47570d
207 #. type: Plain text
208 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
209 #: opensuse-tumbleweed
210 msgid ""
211 "Since Linux 2.6.39, I<path> can be an empty string, in which case the call "
212 "operates on the symbolic link referred to by I<dirfd> (which should have "
213 "been obtained using B<open>(2) with the B<O_PATH> and B<O_NOFOLLOW> flags)."
214 msgstr ""
215
216 #. type: Plain text
217 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
218 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
219 msgid "See B<openat>(2) for an explanation of the need for B<readlinkat>()."
220 msgstr ""
221
222 #. type: SH
223 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
224 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
225 #, no-wrap
226 msgid "RETURN VALUE"
227 msgstr ""
228
229 #. type: Plain text
230 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
231 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
232 msgid ""
233 "On success, these calls return the number of bytes placed in I<buf>. (If "
234 "the returned value equals I<bufsiz>, then truncation may have occurred.) On "
235 "error, -1 is returned and I<errno> is set to indicate the error."
236 msgstr ""
237
238 #. type: SH
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 #, no-wrap
242 msgid "ERRORS"
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<EACCES>"
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 ""
256 "Search permission is denied for a component of the path prefix. (See also "
257 "B<path_resolution>(7).)"
258 msgstr ""
259
260 #. type: TP
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 #, no-wrap
264 msgid "B<EBADF>"
265 msgstr ""
266
267 #. type: Plain text
268 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
269 #: opensuse-tumbleweed
270 msgid ""
271 "(B<readlinkat>()) I<path> is relative but I<dirfd> is neither B<AT_FDCWD> "
272 "nor a valid file descriptor."
273 msgstr ""
274
275 #. type: TP
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 #, no-wrap
279 msgid "B<EFAULT>"
280 msgstr ""
281
282 #. type: Plain text
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 msgid "I<buf> extends outside the process's allocated address space."
286 msgstr ""
287
288 #. type: TP
289 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
290 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
291 #, no-wrap
292 msgid "B<EINVAL>"
293 msgstr ""
294
295 #. At the glibc level, bufsiz is unsigned, so this error can only occur
296 #. if bufsiz==0. However, the in the kernel syscall, bufsiz is signed,
297 #. and this error can also occur if bufsiz < 0.
298 #. See: http://thread.gmane.org/gmane.linux.man/380
299 #. Subject: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
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 "I<bufsiz> is not positive."
304 msgstr ""
305
306 #. type: Plain text
307 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
308 #: opensuse-tumbleweed
309 msgid ""
310 "The named file (i.e., the final filename component of I<path>) is not a "
311 "symbolic link."
312 msgstr ""
313
314 #. type: TP
315 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
316 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
317 #, no-wrap
318 msgid "B<EIO>"
319 msgstr ""
320
321 #. type: Plain text
322 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
323 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
324 msgid "An I/O error occurred while reading from the filesystem."
325 msgstr ""
326
327 #. type: TP
328 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
329 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
330 #, no-wrap
331 msgid "B<ELOOP>"
332 msgstr ""
333
334 #. type: Plain text
335 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
336 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
337 msgid "Too many symbolic links were encountered in translating the pathname."
338 msgstr ""
339
340 #. type: TP
341 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
342 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
343 #, no-wrap
344 msgid "B<ENAMETOOLONG>"
345 msgstr ""
346
347 #. type: Plain text
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 msgid "A pathname, or a component of a pathname, was too long."
351 msgstr ""
352
353 #. type: TP
354 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
355 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
356 #, no-wrap
357 msgid "B<ENOENT>"
358 msgstr ""
359
360 #. type: Plain text
361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
363 msgid "The named file does not exist."
364 msgstr ""
365
366 #. type: TP
367 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
368 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
369 #, no-wrap
370 msgid "B<ENOMEM>"
371 msgstr ""
372
373 #. type: Plain text
374 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
375 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
376 msgid "Insufficient kernel memory was available."
377 msgstr ""
378
379 #. type: TP
380 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
381 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
382 #, no-wrap
383 msgid "B<ENOTDIR>"
384 msgstr ""
385
386 #. type: Plain text
387 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
388 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
389 msgid "A component of the path prefix is not a directory."
390 msgstr ""
391
392 #. type: Plain text
393 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
394 #: opensuse-tumbleweed
395 msgid ""
396 "(B<readlinkat>()) I<path> is relative and I<dirfd> is a file descriptor "
397 "referring to a file other than a directory."
398 msgstr ""
399
400 #. type: SH
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 #, no-wrap
404 msgid "STANDARDS"
405 msgstr ""
406
407 #. type: Plain text
408 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
409 #: opensuse-tumbleweed
410 msgid "POSIX.1-2024."
411 msgstr ""
412
413 #. type: SH
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 #, no-wrap
417 msgid "HISTORY"
418 msgstr ""
419
420 #. type: TP
421 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
422 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
423 #, no-wrap
424 msgid "B<readlink>()"
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 "4.4BSD (first appeared in 4.2BSD), POSIX.1-2001, POSIX.1-2008."
431 msgstr ""
432
433 #. type: TP
434 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
435 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
436 #, no-wrap
437 msgid "B<readlinkat>()"
438 msgstr ""
439
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid "POSIX.1-2008. Linux 2.6.16, glibc 2.4."
444 msgstr ""
445
446 #. type: Plain text
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 msgid ""
450 "Up to and including glibc 2.4, the return type of B<readlink>() was "
451 "declared as I<int>. Nowadays, the return type is declared as I<ssize_t>, as "
452 "(newly) required in POSIX.1-2001."
453 msgstr ""
454
455 #. type: SS
456 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
457 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
458 #, no-wrap
459 msgid "glibc"
460 msgstr ""
461
462 #. type: Plain text
463 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
464 #: opensuse-tumbleweed
465 msgid ""
466 "On older kernels where B<readlinkat>() is unavailable, the glibc wrapper "
467 "function falls back to the use of B<readlink>(). When I<path> is relative, "
468 "glibc constructs a pathname based on the symbolic link in I</proc/self/fd> "
469 "that corresponds to the I<dirfd> argument."
470 msgstr ""
471
472 #. type: SH
473 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
474 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
475 #, no-wrap
476 msgid "NOTES"
477 msgstr ""
478
479 #. type: Plain text
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 msgid ""
483 "Using a statically sized buffer might not provide enough room for the "
484 "symbolic link contents. The required size for the buffer can be obtained "
485 "from the I<stat.st_size> value returned by a call to B<lstat>(2) on the "
486 "link. However, the number of bytes written by B<readlink>() and "
487 "B<readlinkat>() should be checked to make sure that the size of the "
488 "symbolic link did not increase between the calls. Dynamically allocating "
489 "the buffer for B<readlink>() and B<readlinkat>() also addresses a common "
490 "portability problem when using B<PATH_MAX> for the buffer size, as this "
491 "constant is not guaranteed to be defined per POSIX if the system does not "
492 "have such limit."
493 msgstr ""
494
495 #. type: SH
496 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
497 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
498 #, no-wrap
499 msgid "EXAMPLES"
500 msgstr ""
501
502 #. type: Plain text
503 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
504 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
505 msgid ""
506 "The following program allocates the buffer needed by B<readlink>() "
507 "dynamically from the information provided by B<lstat>(2), falling back to a "
508 "buffer of size B<PATH_MAX> in cases where B<lstat>(2) reports a size of "
509 "zero."
510 msgstr ""
511
512 #. type: Plain text
513 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
514 #: opensuse-tumbleweed
515 #, no-wrap
516 msgid ""
517 "#include E<lt>limits.hE<gt>\n"
518 "#include E<lt>stdio.hE<gt>\n"
519 "#include E<lt>stdlib.hE<gt>\n"
520 "#include E<lt>sys/stat.hE<gt>\n"
521 "#include E<lt>sys/types.hE<gt>\n"
522 "#include E<lt>unistd.hE<gt>\n"
523 "\\&\n"
524 "int\n"
525 "main(int argc, char *argv[])\n"
526 "{\n"
527 " char *buf;\n"
528 " ssize_t nbytes, bufsiz;\n"
529 " struct stat sb;\n"
530 "\\&\n"
531 " if (argc != 2) {\n"
532 " fprintf(stderr, \"Usage: %s E<lt>pathE<gt>\\[rs]n\", argv[0]);\n"
533 " exit(EXIT_FAILURE);\n"
534 " }\n"
535 "\\&\n"
536 " if (lstat(argv[1], &sb) == -1) {\n"
537 " perror(\"lstat\");\n"
538 " exit(EXIT_FAILURE);\n"
539 " }\n"
540 "\\&\n"
541 " /* Add one to the link size, so that we can determine whether\n"
542 " the buffer returned by readlink() was truncated. */\n"
543 "\\&\n"
544 " bufsiz = sb.st_size + 1;\n"
545 "\\&\n"
546 " /* Some magic symlinks under (for example) /proc and /sys\n"
547 " report \\[aq]st_size\\[aq] as zero. In that case, take PATH_MAX as\n"
548 " a \"good enough\" estimate. */\n"
549 "\\&\n"
550 " if (sb.st_size == 0)\n"
551 " bufsiz = PATH_MAX;\n"
552 "\\&\n"
553 " buf = malloc(bufsiz);\n"
554 " if (buf == NULL) {\n"
555 " perror(\"malloc\");\n"
556 " exit(EXIT_FAILURE);\n"
557 " }\n"
558 "\\&\n"
559 " nbytes = readlink(argv[1], buf, bufsiz);\n"
560 " if (nbytes == -1) {\n"
561 " perror(\"readlink\");\n"
562 " exit(EXIT_FAILURE);\n"
563 " }\n"
564 "\\&\n"
565 " /* Print only \\[aq]nbytes\\[aq] of \\[aq]buf\\[aq], as it doesn't contain a terminating\n"
566 " null byte (\\[aq]\\[rs]0\\[aq]). */\n"
567 " printf(\"\\[aq]%s\\[aq] points to \\[aq]%.*s\\[aq]\\[rs]n\", argv[1], (int) nbytes, buf);\n"
568 "\\&\n"
569 " /* If the return value was equal to the buffer size, then\n"
570 " the link target was larger than expected (perhaps because the\n"
571 " target was changed between the call to lstat() and the call to\n"
572 " readlink()). Warn the user that the returned target may have\n"
573 " been truncated. */\n"
574 "\\&\n"
575 " if (nbytes == bufsiz)\n"
576 " printf(\"(Returned buffer may have been truncated)\\[rs]n\");\n"
577 "\\&\n"
578 " free(buf);\n"
579 " exit(EXIT_SUCCESS);\n"
580 "}\n"
581 msgstr ""
582
583 #. SRC END
584 #. type: SH
585 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
586 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
587 #, no-wrap
588 msgid "SEE ALSO"
589 msgstr ""
590
591 #. type: Plain text
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 msgid ""
595 "B<readlink>(1), B<lstat>(2), B<stat>(2), B<symlink>(2), B<realpath>(3), "
596 "B<path_resolution>(7), B<symlink>(7)"
597 msgstr ""
598
599 #. type: TH
600 #: debian-trixie
601 #, no-wrap
602 msgid "2024-06-15"
603 msgstr ""
604
605 #. type: TH
606 #: debian-trixie
607 #, no-wrap
608 msgid "Linux man-pages 6.9.1"
609 msgstr ""
610
611 #. type: Plain text
612 #: debian-trixie
613 msgid "Standard C library (I<libc>, I<-lc>)"
614 msgstr ""
615
616 #. type: Plain text
617 #: debian-trixie
618 #, no-wrap
619 msgid ""
620 "B<ssize_t readlink(const char *restrict >I<pathname>B<, char *restrict >I<buf>B<,>\n"
621 "B< size_t >I<bufsiz>B<);>\n"
622 msgstr ""
623
624 #. type: Plain text
625 #: debian-trixie
626 #, no-wrap
627 msgid ""
628 "B<ssize_t readlinkat(int >I<dirfd>B<, const char *restrict >I<pathname>B<,>\n"
629 "B< char *restrict >I<buf>B<, size_t >I<bufsiz>B<);>\n"
630 msgstr ""
631
632 #. type: Plain text
633 #: debian-trixie fedora-44 fedora-rawhide
634 msgid ""
635 "B<readlink>() places the contents of the symbolic link I<pathname> in the "
636 "buffer I<buf>, which has size I<bufsiz>. B<readlink>() does not append a "
637 "terminating null byte to I<buf>. It will (silently) truncate the contents "
638 "(to a length of I<bufsiz> characters), in case the buffer is too small to "
639 "hold all of the contents."
640 msgstr ""
641
642 #. type: Plain text
643 #: debian-trixie fedora-44 fedora-rawhide
644 msgid ""
645 "If the pathname given in I<pathname> is relative, then it is interpreted "
646 "relative to the directory referred to by the file descriptor I<dirfd> "
647 "(rather than relative to the current working directory of the calling "
648 "process, as is done by B<readlink>() for a relative pathname)."
649 msgstr ""
650
651 #. type: Plain text
652 #: debian-trixie fedora-44 fedora-rawhide
653 msgid ""
654 "If I<pathname> is relative and I<dirfd> is the special value B<AT_FDCWD>, "
655 "then I<pathname> is interpreted relative to the current working directory of "
656 "the calling process (like B<readlink>())."
657 msgstr ""
658
659 #. type: Plain text
660 #: debian-trixie fedora-44 fedora-rawhide
661 msgid "If I<pathname> is absolute, then I<dirfd> is ignored."
662 msgstr ""
663
664 #. commit 65cfc6722361570bfe255698d9cd4dccaf47570d
665 #. type: Plain text
666 #: debian-trixie fedora-44 fedora-rawhide
667 msgid ""
668 "Since Linux 2.6.39, I<pathname> can be an empty string, in which case the "
669 "call operates on the symbolic link referred to by I<dirfd> (which should "
670 "have been obtained using B<open>(2) with the B<O_PATH> and B<O_NOFOLLOW> "
671 "flags)."
672 msgstr ""
673
674 #. type: Plain text
675 #: debian-trixie fedora-44 fedora-rawhide
676 msgid ""
677 "(B<readlinkat>()) I<pathname> is relative but I<dirfd> is neither "
678 "B<AT_FDCWD> nor a valid file descriptor."
679 msgstr ""
680
681 #. type: Plain text
682 #: debian-trixie fedora-44 fedora-rawhide
683 msgid ""
684 "The named file (i.e., the final filename component of I<pathname>) is not a "
685 "symbolic link."
686 msgstr ""
687
688 #. type: Plain text
689 #: debian-trixie fedora-44 fedora-rawhide
690 msgid ""
691 "(B<readlinkat>()) I<pathname> is relative and I<dirfd> is a file descriptor "
692 "referring to a file other than a directory."
693 msgstr ""
694
695 #. type: Plain text
696 #: debian-trixie fedora-44 fedora-rawhide
697 msgid "POSIX.1-2008."
698 msgstr ""
699
700 #. type: Plain text
701 #: debian-trixie fedora-44 fedora-rawhide
702 msgid ""
703 "On older kernels where B<readlinkat>() is unavailable, the glibc wrapper "
704 "function falls back to the use of B<readlink>(). When I<pathname> is a "
705 "relative pathname, glibc constructs a pathname based on the symbolic link in "
706 "I</proc/self/fd> that corresponds to the I<dirfd> argument."
707 msgstr ""
708
709 #. type: Plain text
710 #: debian-trixie fedora-44 fedora-rawhide
711 #, no-wrap
712 msgid ""
713 "#include E<lt>limits.hE<gt>\n"
714 "#include E<lt>stdio.hE<gt>\n"
715 "#include E<lt>stdlib.hE<gt>\n"
716 "#include E<lt>sys/stat.hE<gt>\n"
717 "#include E<lt>sys/types.hE<gt>\n"
718 "#include E<lt>unistd.hE<gt>\n"
719 "\\&\n"
720 "int\n"
721 "main(int argc, char *argv[])\n"
722 "{\n"
723 " char *buf;\n"
724 " ssize_t nbytes, bufsiz;\n"
725 " struct stat sb;\n"
726 "\\&\n"
727 " if (argc != 2) {\n"
728 " fprintf(stderr, \"Usage: %s E<lt>pathnameE<gt>\\[rs]n\", argv[0]);\n"
729 " exit(EXIT_FAILURE);\n"
730 " }\n"
731 "\\&\n"
732 " if (lstat(argv[1], &sb) == -1) {\n"
733 " perror(\"lstat\");\n"
734 " exit(EXIT_FAILURE);\n"
735 " }\n"
736 "\\&\n"
737 " /* Add one to the link size, so that we can determine whether\n"
738 " the buffer returned by readlink() was truncated. */\n"
739 "\\&\n"
740 " bufsiz = sb.st_size + 1;\n"
741 "\\&\n"
742 " /* Some magic symlinks under (for example) /proc and /sys\n"
743 " report \\[aq]st_size\\[aq] as zero. In that case, take PATH_MAX as\n"
744 " a \"good enough\" estimate. */\n"
745 "\\&\n"
746 " if (sb.st_size == 0)\n"
747 " bufsiz = PATH_MAX;\n"
748 "\\&\n"
749 " buf = malloc(bufsiz);\n"
750 " if (buf == NULL) {\n"
751 " perror(\"malloc\");\n"
752 " exit(EXIT_FAILURE);\n"
753 " }\n"
754 "\\&\n"
755 " nbytes = readlink(argv[1], buf, bufsiz);\n"
756 " if (nbytes == -1) {\n"
757 " perror(\"readlink\");\n"
758 " exit(EXIT_FAILURE);\n"
759 " }\n"
760 "\\&\n"
761 " /* Print only \\[aq]nbytes\\[aq] of \\[aq]buf\\[aq], as it doesn't contain a terminating\n"
762 " null byte (\\[aq]\\[rs]0\\[aq]). */\n"
763 " printf(\"\\[aq]%s\\[aq] points to \\[aq]%.*s\\[aq]\\[rs]n\", argv[1], (int) nbytes, buf);\n"
764 "\\&\n"
765 " /* If the return value was equal to the buffer size, then\n"
766 " the link target was larger than expected (perhaps because the\n"
767 " target was changed between the call to lstat() and the call to\n"
768 " readlink()). Warn the user that the returned target may have\n"
769 " been truncated. */\n"
770 "\\&\n"
771 " if (nbytes == bufsiz)\n"
772 " printf(\"(Returned buffer may have been truncated)\\[rs]n\");\n"
773 "\\&\n"
774 " free(buf);\n"
775 " exit(EXIT_SUCCESS);\n"
776 "}\n"
777 msgstr ""
778
779 #. type: TH
780 #: fedora-44 fedora-rawhide
781 #, no-wrap
782 msgid "2024-11-28"
783 msgstr ""
784
785 #. type: TH
786 #: fedora-44 fedora-rawhide
787 #, no-wrap
788 msgid "Linux man-pages 6.13"
789 msgstr ""
790
791 #. type: Plain text
792 #: fedora-44 fedora-rawhide
793 #, no-wrap
794 msgid ""
795 "B<ssize_t readlink(const char *restrict >I<pathname>B<,>\n"
796 "B< char >I<buf>B<[restrict .>I<bufsiz>B<], size_t >I<bufsiz>B<);>\n"
797 msgstr ""
798
799 #. type: Plain text
800 #: fedora-44 fedora-rawhide
801 #, no-wrap
802 msgid ""
803 "B<ssize_t readlinkat(int >I<dirfd>B<, const char *restrict >I<pathname>B<,>\n"
804 "B< char >I<buf>B<[restrict .>I<bufsiz>B<], size_t >I<bufsiz>B<);>\n"
805 msgstr ""
806
807 #. type: TH
808 #: mageia-cauldron
809 #, no-wrap
810 msgid "Linux man-pages 6.17"
811 msgstr ""
812
813 #. type: TH
814 #: opensuse-leap-16-1 opensuse-tumbleweed
815 #, no-wrap
816 msgid "Linux man-pages (unreleased)"
817 msgstr ""