1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" 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
.\" Deutsche Uebersetzung 1995 by Jonas Rovan
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified by Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de)
.\" Modified Sat Jul 24 10:54:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Thu May 18 11:00:31 1995 by Rik Faith (faith@cs.unc.edu)
.\" to add comments suggested by Todd Larason (jtl@molehill.org)
.\" Modified Thu Feb 08 00:19:35 1996 by Jonas Rovan (jonas@blitz.de)
.\" Modified Mon Jun 10 23:33:05 1996 by Martin Schulze (joey@linux.de)
.\"
.TH STAT 2 "6. Februar 1996" "Linux 1.2.13" "Systemaufrufe"
.SH BEZEICHNUNG
stat, fstat, lstat \- Ermittle Dateistatus
.SH BERSICHT
.B #include <sys/stat.h>
.br
.B #include <unistd.h>
.sp
.BI "int stat(const char *" file_name ", struct stat *" buf );
.br
.BI "int fstat(int " filedes ", struct stat *" buf );
.br
.BI "int lstat(const char *" file_name ", struct stat *" buf );
.SH UEBERBLICK
.PP
Beim Aufruf geben diese Funktionen Informationen ber die angegebene Datei
zurck. Dazu bentigt man keinerlei Rechte an der angegebene Datei, sehr
wohl aber die ''Search''-Rechte im rekursiven Pfad zu dieser Datei.
.PP
.B stat
liefert die Informationen zu der in
.I file_name
angegebenen Datei und bergibt diese an
.IR buf .
.B lstat
ist hnlich
.BR stat ,
nur dass, bei Links, Informationen zum Link und nicht der bezogenen Datei an
.IR buf
bergeben werden.
.B fstat
ist wie
.BR stat ,
doch wird statt
.IR file_name
die, von
-I fopen(3)
bergebene
.I filedes
verwendet.
.PP
Alle Aufrufe geben eine Struktur vom Typ
.I stat
zurck, die folgendermassen aufgebaut ist:
.PP
.RS
.nf
struct stat
{
dev_t st_dev; /* Device */
ino_t st_ino; /* INode */
umode_t st_mode; /* Protection */
nlink_t st_nlink; /* Anzahl d. Hard_Links */
uid_t st_uid; /* UID des Besitzers */
gid_t st_gid; /* GID des Besitzers */
dev_t st_rdev; /* Typ (wenn INode-Device) */
off_t st_size; /* Grsse in Bytes*/
unsigned long st_blksize; /* Blockgrsse */
unsigned long st_blocks; /* Allozierte Blocks */
time_t st_atime; /* Letzter Zugriff */
time_t st_mtime; /* Letzte Modifikation */
time_t st_ctime; /* Letzte Aenderung */
};
.fi
.RE
.PP
CAVEAT:
.I st_blocks
muss nicht unbedingt die Blockgrsse darstellen und
.IR st_blksize
kann auch die optimale Blockgrsse fr die Dateioperationen
angeben.
.PP
Nicht alle, von Linux untersttzte, Dateisysteme verwenden alle Felder.
Normalerweise ndert sich
.I st_atime
durch den Einsatz von
.BR mknod "(2), " utime "(2), " read "(2), " write "(2), und " truncate (2).
.I st_mtime
verndert sich beim Einsatz von
.BR mknod "(2), " utime "(2), und " write (2).
.I st_mtime
wird
.I nicht
durch ndern von Besitzer, Gruppe, Hardlink-Count, oder Mode verndert.
.I st_ctime
wird durch das Aendern der INode-Informationen neu gesetzt.
.PP
Folgende Makros sind fr den Dateityp definiert:
.RS
.TP 1.2i
S_ISLNK(m)
Testet auf einen Symbolischen Link,
.TP
S_ISREG(m)
auf regulre Dateien,
.TP
S_ISDIR(m)
auf Verzeichnisse,
.TP
S_ISCHR(m)
checkt auf Character-Devices,
.TP
S_ISBLK(m)
auf Block-Devices, whrend
.TP
S_ISFIFO(m)
auf FiFos und
.TP
S_ISSOCK(m)
auf Sockets berprft.
.RE
.PP
Folgende Flags sind fr
.I st_mode
definiert:
.RS
.TP 0.9i
S_IFMT
00170000 Bitmaske fr den Dateityp
.TP
S_IFSOCK
0140000 Sockets
.TP
S_IFLNK
0120000 Symbolische Links
.TP
S_IFREG
0100000 regulre Dateien
.TP
S_IFBLK
0060000 Block-Devices
.TP
S_IFDIR
0040000 Verzeichnisse
.TP
S_IFCHR
0020000 Char-Devices
.TP
S_IFIFO
0010000 FIFOs
.TP
S_ISUID
0004000 SUID-bit
.TP
S_ISGID
0002000 SGID-bit
.TP
S_ISVTX
0001000 Stickybit ( Wer's braucht :) )
.TP
S_IRWXU
00700 rwx fr (u)ser
.TP
S_IRUSR (S_IREAD)
00400 r-- fr (u)ser
.TP
S_IWUSR (S_IWRITE)
00200 -w- fr (u)ser
.TP
S_IXUSR (S_IEXEC)
00100 --x fr (u)ser
.TP
S_IRWXG
00070 rwx fr (g)roup
.TP
S_IRGRP
00040 r-- fr (g)roup
.TP
S_IWGRP
00020 -w- fr (g)roup
.TP
S_IXGRP
00010 --x fr (g)roup
.TP
S_IRWXO
00007 rwx fr (o)thers
.TP
S_IROTH
00004 r-- fr (o)thers
.TP
S_IWOTH
00002 -w- fr (o)thers
.TP
S_IXOTH
00001 --x fr (o)thers
.RE
.SH "RETURN VALUE"
Erfolg gibt 0, ein Fehler gibt \-1 zurck und setzt
.I errno
entsprechend.
.SH FEHLER
.TP
.B EBADF
.I filedes
falsch oder nicht vorhanden.
.TP
.B ENOENT
Datei existiert nicht.
.SH "KONFORM ZU"
SVID (not
.BR lstat() ),
AT&T (not
.BR lstat() ),
POSIX (not
.BR lstat() ),
X/OPEN (not
.BR lstat() ),
BSD 4.3
.SH "SIEHE AUCH"
.BR chmod (2),
.BR chown (2),
.BR readlink (2),
.BR utime (2).
.SH "DEUTSCH VON"
Jonas Rovan
.BR <jonas@blitz.de> ,
der das GerMan-Projekt fr eine der besten Ideen hlt, die
jemals gehabt wurden und Andries Brouwer
.B <aeb@win.tue.nl>
fr dessen Engagement herzlichst dankt.
|