.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992 .\" Parts Copyright (c) 1995 Nicolai Langfeldt (janl@ifi.uio.no), 1/1/95 .\" and Copyright (c) 2006, 2007, 2014 Michael Kerrisk .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" Modified by Michael Haardt .\" Modified 1993-07-24 by Rik Faith .\" Modified 1995-05-18 by Todd Larason .\" Modified 1997-01-31 by Eric S. Raymond .\" Modified 1995-01-09 by Richard Kettlewell .\" Modified 1998-05-13 by Michael Haardt .\" Modified 1999-07-06 by aeb & Albert Cahalan .\" Modified 2000-01-07 by aeb .\" Modified 2004-06-23 by Michael Kerrisk .\" 2007-06-08 mtk: Added example program .\" 2007-07-05 mtk: Added details on underlying system call interfaces .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH stat 2 "3 mei 2023" "Linux man\-pagina's 6.05.01" .SH NAAM stat, fstat, lstat, fstatat \- verkrijg bestand status. .SH BIBLIOTHEEK Standard C bibliotheek (\fIlibc\fP, \fI\-lc\fP) .SH SAMENVATTING .nf \fB#include \fP .PP \fBint stat(const char *beperk \fP\fIpadnaam\fP\fB,\fP \fB struct stat *beperk \fP\fIstatbuf\fP\fB);\fP \fBint fstat(int \fP\fIfd\fP\fB, struct stat *\fP\fIstatbuf\fP\fB);\fP \fBint lstat(const char *beperk \fP\fIpadnaam\fP\fB,\fP \fB struct stat *beperk \fP\fIstatbuf\fP\fB);\fP .PP \fB#include \fP/* Definitie van \fBAT_*\fP constanten */ \fB#include \fP .PP \fBint fstatat(int \fP\fIdirfd\fP\fB, const char *restrict \fP\fIpadnaam\fP\fB,\fP \fB struct stat *beperk \fP\fIstatbuf\fP\fB, int \fP\fIvlaggen\fP\fB);\fP .fi .PP .RS -4 Feature Test Macro´s eisen in glibc (zie \fBfeature_test_macros\fP(7)): .RE .PP \fBlstat\fP(): .nf .\" _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED /* Vanaf glibc 2.20 */ _DEFAULT_SOURCE || _XOPEN_SOURCE >= 500 || /* Vanaf glibc 2.10: */ _POSIX_C_SOURCE >= 200112L || /* glibc 2.19 en eerder */ _BSD_SOURCE .fi .PP \fBfstatat\fP(): .nf Vanaf glibc 2.10: _POSIX_C_SOURCE >= 200809L Voor glibc 2.10: _ATFILE_SOURCE .fi .SH BESCHRIJVING Deze functies retourneren informatie over een bestand in de buffer aangewezen door \fIstatbuf\fP. Er zijn geen rechten vereist op het bestand zelf, maar \[em]in het geval van \fBstat\fP(), \fBfstatat\fP() en \fBlstat\fP()\[em] zijn uitvoer (zoek) rechten vereist op alle mappen in \fIpadnaam\fP die naar het bestand leiden. .PP \fBstat\fP() en \fBfstatat\fP() geven informatie over het bestand aangewezen door \fIpadnaam\fP; de verschillen voor \fBfstatat\fP() worden hieronder beschreven. .PP \fBlstat\fP() is gelijk aan \fBstat\fP(), behalve dat als \fIpadnaam\fP een symbolische koppeling is, dan informatie over de koppeling zéqlf wordt teruggegeven, en niet van het bestand waar naar verwezen wordt. .PP .\" \fBfstat\fP() is gelijk aan \fBstat\fP(), behalve dat het bestand van welk de informatie wordt opgevraagd wordt gespecificeerd door de bestandsindicator \fIfd\fP. .SS "De stat structuur" Al deze systeem aanroepen retourneren een \fIstat\fP structure (zie \fBstat\fP(3type)): .PP .\" Background: inode attributes are modified with i_mutex held, but .\" read by stat() without taking the mutex. \fIOpmerking\fP: vanwege prestatie redenen en vanwege de eenvoud, mogen diverse velden in de \fIstat\fP structuur status informatie bevatten over verschillende momenten gedurende de uitvoer van de systeem aanroep. Bijvoorbeeld, als \fIst_mode\fP of \fIst_uid\fP werd veranderd door een ander proces door de aanroep van \fBchmod\fP(2) of \fBchown\fP(2), dan mag \fBstat\fP(2) de oude \fIst_mode\fP teruggeven, samen met de nieuwe \fIst_uid\fP, of de oude \fIst_uid\fP samen met de nieuwe \fIst_mode\fP. .SS fstatat() De \fBfstatat\fP() systeem aanroep is een meer algemeen interface voor het verkrijgen van bestandsinformatie dat nog steeds exact hetzelfde gedrag kan bieden van elk van \fBstat\fP(), \fBlstat\fP(), and \fBfstat\fP(). .PP Als de padnaam opgegeven in \fIpadnaam\fP relatief is, dan wordt deze geïnterpreteerd als relatief aan de map aangewezen door de bestandsindicator \fIdirfd\fP (in plaats van relatief ten opzichte van de huidige werkmap van het aanroepende proces, zoals dit gedaan wordt door \fBstat\fP() en \fBlstat\fP() voor een relatieve padnaam). .PP Als \fIpadnaam\fP relatief is en \fIdirfd\fP heeft de speciale waarde \fBAT_FDCWD\fP, dan wordt \fIpadnaam\fP geïnterpreteerd als relatief ten opzichte van de huidige werkmap van het aanroepende proces (zoals \fBstat\fP() en \fBlstat\fP()). .PP Als \fIpadnaam\fP absoluut is, dan wordt \fImapbi\fP genegeerd. .PP \fIvlaggen\fP kan ofwel 0 zijn, of kan een of meer van de volgende vlaggen ORed bevatten: .TP \fBAT_EMPTY_PATH\fP (vanaf Linux 2.6.39) .\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d .\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed Als \fIpadnaam\fP een lege tekenreeks is, werk dan op het bestand aangewezen doorzoek \fIdirfd\fP (die kan zijn verkregen door het gebruik van \fBopen\fP(2) \fBO_PATH\fP vlag). In dit geval kan \fIdirfd\fP naar elk type bestand wijzen, niet slechts een map, en het gedrag van \fBfstatat\fP() is vergelijkbaar met dat van \fBfstat\fP(). Als \fIdirfd\fP gelijk is aan \fBAT_FDCWD\fP, dan werkt de aanroep op de huidige werkmap. Deze vlag is Linux\-specifiek; definieer \fB_GNU_SOURCE\fP om de definiete te verkrijgen. .TP \fBAT_NO_AUTOMOUNT\fP (vanaf Linux 2.6.38) Automount de laatste component van het einde ("basename") van \fIp[adnaam\fP niet. Vanaf Linux 3.1 wordt deze vlag genegeerd. Vanaf Linux 4.11 is deze vlag impliciet. .TP \fBAT_SYMLINK_NOFOLLOW\fP Als \fIpadnaam\fP een symbolische koppeling is, volg deze niet: in plaats daarvan retourneer informatie over de koppeling zelf, zoals \fBlstat\fP(). (Standaard volgt \fBfstatat\fP() symbolische koppelingen, net als \fBstat\fP().) .PP Zie \fBopenat\fP(2) voor een uitleg over de noodzaak van \fBfstatat\fP(). .SH "EIND WAARDE" Bij succes wordt nul teruggegeven. Bij falen wordt \-1 teruggegeven en wordt \fIerrno\fP overeenkomstig gezet. .SH FOUTEN .TP \fBEACCES\fP Het doorzoek recht werd geweigerd voor een van de mappen in de pad voorvoegsel van \fIpadnaam\fP. (Zie ook \fBpath_resolution\fP(7).) .TP \fBEBADF\fP \fIbi\fP is niet een geldige open\-voor\-schrijven bestandindicator. .TP \fBEBADF\fP (\fBfstatat\fP()) \fIpadnaam\fP is relatief maar \fIdirfd\fP is noch \fBAT_FDCWD\fP noch een geldige bestandsindicator. .TP \fBEFAULT\fP Verkeerd adres. .TP \fBEINVAL\fP (\fBfstatat\fP()) Ongeldige vlag opgegeven in \fIvlaggen\fP. .TP \fBELOOP\fP Teveel symbolische koppelingen werden tegengekomen bij het doorlopen van \fIpadnaam\fP. .TP \fBENAMETOOLONG\fP \fIpadnaam\fP is te lang. .TP \fBENOENT\fP Een map\-deel van \fIpadnaam\fP zou toegankelijk geweest zijn maar bestaat niet of was een zwevende symbolische koppeling. .TP \fBENOENT\fP \fIpadnaam\fP is een lege tekenreeks en \fBAT_EMPTY_PATH\fP werd niet opgegeven in \fIvlaggen\fP. .TP \fBENOMEM\fP Geheugen is op (kernel geheugen). .TP \fBENOTDIR\fP Een onderdeel in het pad voorvoegsel in \fIpadnaam\fP is geen map. .TP \fBENOTDIR\fP (\fBfstatat\fP()) \fIpadnaam\fP is relatief en \fImapbi\fP is een bestandsindicator die naar een bestand wijst dat geen map is. .TP \fBEOVERFLOW\fP \fIpadnaam\fP of \fIfd\fP wijst naar een bestand waarvan grootte, inode nummer of aantal blokken niet kan worden gerepresenteerd in respectievelijk de velden \fIoff_t\fP, \fIino_t\fP, of \fIblkcnt_t\fP. Deze fout kan optreden wanneer bij voorbeeld een applicatie die compileert werd op een 32\-bit platform zonder \fI\-D_FILE_OFFSET_BITS=64\fP, \fBstat\fP() aanroept op een bestand waarvan de grootte meer is dan \fI(1<<31)\-1\fP bytes. .SH "VOLDOET AAN" POSIX.1\-2008. .SH GESCHIEDENIS .TP \fBstat\fP() .TQ \fBfstat\fP() .TQ \fBlstat\fP() .\" SVr4 documents additional .\" .BR fstat () .\" error conditions EINTR, ENOLINK, and EOVERFLOW. SVr4 .\" documents additional .\" .BR stat () .\" and .\" .BR lstat () .\" error conditions EINTR, EMULTIHOP, ENOLINK, and EOVERFLOW. SVr4, 4.3BSD, POSIX.1\-2001. .TP \fBfstatat\fP() POSIX.1\-2008. Linux 2.6.16, glibc 2.4. .PP Volgens POSIX.1\-2001, moet \fBlstat\fP() voor een symbolische koppeling geldige informatie retourneren in het \fIst_size\fP veld en het bestandstype van het \fIst_mode\fP veld van de \fIstat\fP structure. POSIX.1\-2008 vernauwt deze specificatie door te vereisen dat \fBlstat\fP() geldige informatie moet retourneren in alle velden behalve de mode bits in \fIst_mode\fP. .PP Gebruik van de \fIst_blocks\fP en \fIst_blksize\fP velden is minder overdraagbaar. (Deze werden geïntroduceerd in BSD. De interpretatie verschilt tussen systemen, en mogelijk zelfs op een enkel systeem waar NFS koppelingen gebruikt worden.) .SS "C library/kernel verschillen" .\" See include/asm-i386/stat.h in the Linux 2.4 source code for the .\" various versions of the structure definitions In de loop van de tijd hebben vergrotingen van de \fIstat\fP structure geleid tot drie opeenvolgende versies van \fBstat\fP(0: \fIsys_stat\fP() (slot \fI__NR_oldstat\fP), \fIsys_newstat\fP() (slot \fI__NR_stat\fP), en \fIsys_stat64()\fP (slot \fI__NR_stat64\fP) op 32\-bit platformen zoals i386. De eerste twee versies waren al aanwezig in Linux 1.0 (hoewel met verschillende namen); de laatste werd toegevoegd in Linux 2.4. Vergelijkbare opmerkingen zijn van toepassing op \fBfstat\fP() en \fBlstat\fP(). .PP De interne kernel versies van de \fIstat\fP structure die behandelt worden door de verschillende versies, zijn respectievelijk: .TP \fI__old_kernel_stat\fP De originele structure, met nogal kleine velden en zonder opvulling. .TP \fIstat\fP Een groter \fIst_ino\fP veld en opvulling toegevoegd aan verschillende delen van de structure om toekomstige uitbreidingen toe te staan. .TP \fIstat64\fP Een nog groter \fIst_ino\fP veld, grotere \fIst_uid\fP en \fIst_gid\fP velden om in de expansie van UID´s EN GID´s naar 32 bits door Linux\-2.4 te voorzien, en verschillende andere vergrote velden en meer opvulling in de structure. (Diverse opvul bytes werden geconsumeerd in Linux 2.6, met de aankomst van 32\-bit apparaat ID´s en nanoseconden componenten in de tijdstempel velden.) .PP .\" .\" A note from Andries Brouwer, July 2007 .\" .\" > Is the story not rather more complicated for some calls like .\" > stat(2)? .\" .\" Yes and no, mostly no. See /usr/include/sys/stat.h . .\" .\" The idea is here not so much that syscalls change, but that .\" the definitions of struct stat and of the types dev_t and mode_t change. .\" This means that libc (even if it does not call the kernel .\" but only calls some internal function) must know what the .\" format of dev_t or of struct stat is. .\" The communication between the application and libc goes via .\" the include file that defines a _STAT_VER and .\" _MKNOD_VER describing the layout of the data that user space .\" uses. Each (almost each) occurrence of stat() is replaced by .\" an occurrence of xstat() where the first parameter of xstat() .\" is this version number _STAT_VER. .\" .\" Now, also the definitions used by the kernel change. .\" But glibc copes with this in the standard way, and the .\" struct stat as returned by the kernel is repacked into .\" the struct stat as expected by the application. .\" Thus, _STAT_VER and this setup cater for the application-libc .\" interface, rather than the libc-kernel interface. .\" .\" (Note that the details depend on gcc being used as c compiler.) De glibc \fBstat\fP() omwikkel functies verbergen deze details van de applicaties, door het aanroepen van de meest recente versie van de systeem aanroep die door de kernel beschikbaar wordt gesteld en het opnieuw inpakken van de verkregen informatie indien nodig voor oude toepassingen. .PP Op moderne 64\-bit systemen is het leven eenvoudiger: daar bestaat een enkele \fBstat\fP() systeem aanroep en de kernel werkt met een \fIstat\fP structure die velden van voldoende grootte bevat. .PP .\" strace(1) shows the name "newfstatat" on x86-64 De onderliggende systeem aanroep gebruikt door de glibc \fBfstatat\fP() omwikkel functie heet eigenlijk \fBfstatat64\fP() of op sommige architecturen \fBnewfstatat\fP(). .SH VOORBEELDEN Het volgende programma roept \fBlstat\fP() aan en toont geselecteerde velden in de teruggegeven \fIstat\fP structure. .PP .\" SRC BEGIN (stat.c) .EX #include #include #include #include #include #include \& int main(int argc, char *argv[]) { struct stat sb; \& if (argc != 2) { fprintf(stderr, "Gebruik: %s \en", argv[0]); exit(EXIT_FAILURE); } \& if (lstat(argv[1], &sb) == \-1) { perror("lstat"); exit(EXIT_FAILURE); } \& printf("ID van het apparaat: [%x,%x]\en", major(sb.st_dev), minor(sb.st_dev)); \& printf("Bestand type: "); \& switch (sb.st_mode & S_IFMT) { case S_IFBLK: printf("blok apparaat\en"); break; case S_IFCHR: printf("teken apparaat\en"); break; case S_IFDIR: printf("map\en"); break; case S_IFIFO: printf("FIFO/pipe\en"); break; case S_IFLNK: printf("symlink\en"); break; case S_IFREG: printf("regulier bestand\en"); break; case S_IFSOCK: printf("socket\en"); break; default: printf("onbekend?\en"); break; } \& printf("I\-node number: %ju\en", (uintmax_t) sb.st_ino); \& printf("Mode: %jo (octal)\en", (uintmax_t) sb.st_mode); \& printf("Link teller: %ju\en", (uintmax_t) sb.st_nlink); printf("Eigenaarschap: UID=%ju GID=%ju\en", (uintmax_t) sb.st_uid, (uintmax_t) sb.st_gid); \& printf("Voorkeur I/O blok grootte: %jd bytes\en", (intmax_t) sb.st_blksize); printf("File size: %jd bytes\en", (intmax_t) sb.st_size); printf("Blokken toegekend: %jd\en", (intmax_t) sb.st_blocks); \& printf("Laatste status verandering: %s", ctime(&sb.st_ctime)); printf("Laatste bestand toegang: %s", ctime(&sb.st_atime)); printf("Laatste bestand wijziging: %s", ctime(&sb.st_mtime)); \& exit(EXIT_SUCCESS); } .EE .\" SRC END .SH "ZIE OOK" \fBls\fP(1), \fBstat\fP(1), \fBaccess\fP(2), \fBchmod\fP(2), \fBchown\fP(2), \fBreadlink\fP(2), \fBstatx\fP(2), \fButime\fP(2), \fBstat\fP(3type), \fBcapabilities\fP(7), \fBinode\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 .