.\" -*- coding: UTF-8 -*- .\" Copyright 1983-1991, The Regents of the University of California. .\" Copyright 2011, Guillem Jover .\" Copyright 2006-2014, Michael Kerrisk .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: BSD-4-Clause-UC .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH readlink 2 "8 februari 2026" "Linux man\-paginas 6.17" .SH NAAM readlink, readlinkat \- lees waarde van een symbolische koppeling .SH BIBLIOTHEEK Standaard C bibliotheek (\fIlibc\fP, \fI\-lc\fP) .SH SAMENVATTING .nf \fB#include \fP .P \fBssize_t readlink(\fPsize_t bufsiz; \fB const char *restrict \fP\fIpath\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict \fP\fIbufsiz\fP\fB], size_t \fP\fIbufsiz\fP\fB);\fP .P \fB#include \fP/* Definitie van of \fBAT_*\fP constanten */ \fB#include \fP .P \fBssize_t readlinkat(\fPsize_t bufsiz; \fB int \fP\fIdirfd\fP\fB, const char *restrict \fP\fIpath\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict \fP\fIbufsiz\fP\fB], size_t \fP\fIbufsiz\fP\fB);\fP .P .fi .RS -4 Feature Test Macro Requirements voor glibc (zie \fBfeature_test_macros\fP(7)): .RE .P \fBreadlink\fP(): .nf .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L || /* glibc <= 2.19: */ _BSD_SOURCE .fi .P \fBreadlinkat\fP(): .nf Vanaf glibc 2.10: _POSIX_C_SOURCE >= 200809L Voor glibc 2.10: _ATFILE_SOURCE .fi .SH BESCHRIJVING \fBreadlink\fP() places the contents of the symbolic link \fIpath\fP in the buffer \fIbuf\fP, which has size \fIbufsiz\fP. \fBreadlink\fP() does not append a terminating null byte to \fIbuf\fP. It will (silently) truncate the contents (to a length of \fIbufsiz\fP characters), in case the buffer is too small to hold all of the contents. .SS readlinkat() De \fBreadlinkat\fP() systeem aanroep werkt op exact dezelfde manier als \fBreadlink\fP(), behalve voor de hier beschreven verschillen. .P If \fIpath\fP is relative, then it is interpreted relative to the directory referred to by the file descriptor \fIdirfd\fP (rather than relative to the current working directory of the calling process, as is done by \fBreadlink\fP() for a relative pathname). .P If \fIpath\fP is relative and \fIdirfd\fP is the special value \fBAT_FDCWD\fP, then \fIpath\fP is interpreted relative to the current working directory of the calling process (like \fBreadlink\fP()). .P Als \fIpadnaam\fP absoluut is, dan wordt \fImapbi\fP genegeerd. .P .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d Since Linux 2.6.39, \fIpath\fP can be an empty string, in which case the call operates on the symbolic link referred to by \fIdirfd\fP (which should have been obtained using \fBopen\fP(2) with the \fBO_PATH\fP and \fBO_NOFOLLOW\fP flags). .P Zie \fBopenat\fP(2) voor de uitleg over de noodzaak van \fBreadlinkat\fP(). .SH "EIND WAARDE" Bij succes, geven deze aanroepen het aantal bytes terug dat in de buffer werd geplaatst (als de teruggegeven waarde gelijk is aan \fIbufsiz\fP, dan kan afbreken zijn opgetreden.) Bij de fout wordt \-1 teruggegeven en wordt \fIerrno\fP gezet om de fout aan te geven. .SH FOUTEN .TP \fBEACCES\fP Zoek toestemming werd geweigerd voor een deel van het pad voorvoegsel. (Zie ook \fBpath_resolution\fP(7).) .TP \fBEBADF\fP (\fBreadlinkat\fP()) \fIpath\fP is relative but \fIdirfd\fP is neither \fBAT_FDCWD\fP nor a valid file descriptor. .TP \fBEFAULT\fP \fIbuf\fP strekt zich uit voorbij de aan het proces toegewezen adres ruimte. .TP \fBEINVAL\fP .\" At the glibc level, bufsiz is unsigned, so this error can only occur .\" if bufsiz==0. However, the in the kernel syscall, bufsiz is signed, .\" and this error can also occur if bufsiz < 0. .\" See: http://thread.gmane.org/gmane.linux.man/380 .\" Subject: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall? \fIbufmaat\fP is niet positief. .TP \fBEINVAL\fP The named file (i.e., the final filename component of \fIpath\fP) is not a symbolic link. .TP \fBEIO\fP Een In/Uit fout trad op terwijl er van het bestandsysteem gelezen werd. .TP \fBELOOP\fP Teveel symbolische koppelingen werden tegengekomen bij het vertalen van de padnaam. .TP \fBENAMETOOLONG\fP Een padnaam, of een deel van een padnaam, was te lang. .TP \fBENOENT\fP Het genoemde bestand bestaat niet. .TP \fBENOMEM\fP Onvoldoende kernelgeheugen voorhanden. .TP \fBENOTDIR\fP Een deel van het pad\-voorvoegsel is geen map. .TP \fBENOTDIR\fP (\fBreadlinkat\fP()) \fIpath\fP is relative and \fIdirfd\fP is a file descriptor referring to a file other than a directory. .SH STANDAARDEN POSIX.1\-2024. .SH HISTORIE .TP \fBreadlink\fP() 4.4BSD (verscheen voor het eerst in 4.2BSD), POSIX.1\-2001, POSIX.1\-2008. .TP \fBreadlinkat\fP() POSIX.1\-2008. Linux 2.6.16, glibc 2.4. .P Tot en met glibc 2.4 was het uitvoer type van \fBreadlink\fP() gedeclareerd als \fIint\fP. Tegenwoordig is het uitvoer type gedeclareerd als \fIssize_t\fP, als (nieuw) vereist in POSIX.1\-2001. .SS glibc On older kernels where \fBreadlinkat\fP() is unavailable, the glibc wrapper function falls back to the use of \fBreadlink\fP(). When \fIpath\fP is relative, glibc constructs a pathname based on the symbolic link in \fI/proc/self/fd\fP that corresponds to the \fIdirfd\fP argument. .SH OPMERKINGEN Gebruik van een buffer met een statische grootte kan niet genoeg ruimte opleveren voor de inhoud van de symbolische koppeling. De vereiste grootte van de buffer kan worden verkregen van de \fIstat_st_size\fP waarde zoals teruggegeven door \fBlstat\fP(2) op de koppeling. Echter moet het aantal door \fBreadlink\fP() en \fBreadlinkat\fP() geschreven bytes gecontroleerd worden om er van zeker te zijn dat de grootte van de symbolische koppeling niet toenam tussen de twee aanroepen in. Het dynamisch toewijzen van de buffer voor \fBreadlink\fP() en \fBreadlinkat\fP() adresseert ook een vaak voorkomend portabiliteit probleem bij het gebruik van \fBPATH_MAX\fP voor de buffer grootte, omdat deze constante niet gegarandeerd gedefinieerd wordt conform POSIX als het systeem niet deze limiet heeft. .SH VOORBEELDEN Het volgende programma wijst de door \fBreadlink\fP() benodigde buffer dynamisch toe aan de hand van de informatie voorzien door \fBlstat\fP(2), met terug vallende naar een buffer van \fBPATH_MAX\fP grootte in die gevallen waar \fBlstat\fP(2) een grootte van nul meldt. .P .\" SRC BEGIN (readlink.c) .EX #include #include #include #include #include #include \& int main(int argc, char *argv[]) { char *buf; ssize_t nbytes, bufsiz; struct stat sb; \& if (argc != 2) { fprintf(stderr, "Usage: %s \[rs]n", argv[0]); exit(EXIT_FAILURE); } \& if (lstat(argv[1], &sb) == \-1) { perror("lstat"); exit(EXIT_FAILURE); } \& /* Add one to the link size, so that we can determine whether the buffer returned by readlink() was truncated. */ \& bufsiz = sb.st_size + 1; \& /* Some magic symlinks under (for example) /proc and /sys report \[aq]st_size\[aq] as zero. In that case, take PATH_MAX as a "good enough" estimate. */ \& if (sb.st_size == 0) bufsiz = PATH_MAX; \& buf = malloc(bufsiz); if (buf == NULL) { perror("malloc"); exit(EXIT_FAILURE); } \& nbytes = readlink(argv[1], buf, bufsiz); if (nbytes == \-1) { perror("readlink"); exit(EXIT_FAILURE); } \& /* Print only \[aq]nbytes\[aq] of \[aq]buf\[aq], as it doesn't contain a terminating null byte (\[aq]\[rs]0\[aq]). */ printf("\[aq]%s\[aq] points to \[aq]%.*s\[aq]\[rs]n", argv[1], (int) nbytes, buf); \& /* If the return value was equal to the buffer size, then the link target was larger than expected (perhaps because the target was changed between the call to lstat() and the call to readlink()). Warn the user that the returned target may have been truncated. */ \& if (nbytes == bufsiz) printf("(Returned buffer may have been truncated)\[rs]n"); \& free(buf); exit(EXIT_SUCCESS); } .EE .\" SRC END .SH "ZIE OOK" \fBreadlink\fP(1), \fBlstat\fP(2), \fBstat\fP(2), \fBsymlink\fP(2), \fBrealpath\fP(3), \fBpath_resolution\fP(7), \fBsymlink\fP(7) .PP .SH VERTALING De Nederlandse vertaling van deze handleiding is geschreven door Jos Boersema , Mario Blättermann en Luc Castermans . .PP Deze vertaling is vrije documentatie; lees de .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE of later over de Copyright-voorwaarden. Er is geen AANSPRAKELIJKHEID. .PP Indien U fouten in de vertaling van deze handleiding zou vinden, stuur een e-mail naar .MT debian-l10n-dutch@lists.debian.org .ME .